Skip to content

Commit aa55380

Browse files
author
HenryLee
committed
更新文档
更新文档
1 parent e0fbef1 commit aa55380

File tree

3 files changed

+89
-2
lines changed

3 files changed

+89
-2
lines changed

Cli-Tools/one_kick_tool.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
import json
4+
import os
5+
import random
6+
import requests
7+
import subprocess
8+
9+
def get_cid(fil):
10+
cid = input("请输入CID(直接回车导入本地文件):")
11+
if cid == "":
12+
file_path = input("请输入文件绝对路径:")
13+
while os.path.exists(file_path) == False:
14+
print("该路径文件不存在,请重新输入")
15+
else:
16+
if os.path.isfile(file_path):
17+
ipfs_add_cmd = """ipfs add %s""" % file_path
18+
ipfs_cli_output = str(subprocess.check_output(ipfs_add_cmd.split()), "utf-8")
19+
cid = ipfs_cli_output.split()[-2]
20+
elif os.path.isdir(file_path):
21+
ipfs_add_cmd = """ipfs add -r %s""" % file_path
22+
ipfs_cli_output = str(subprocess.check_output(ipfs_add_cmd.split()), "utf-8")
23+
cid = ipfs_cli_output.split()[-2]
24+
else:
25+
pass
26+
else:
27+
pass
28+
print("已获取到CID:%s" % cid)
29+
return cid
30+
31+
def get_vshare_nodeid():
32+
minerid_list = json.loads(requests.get('https://fil-api.ipns.tech/filtools/miner_list.php').text)
33+
minerid_list = minerid_list["data"]
34+
minerid = random.choice(minerid_list)
35+
print("已选取到节点:%s" % minerid)
36+
return minerid
37+
38+
39+
def ipfs_gc(cid):
40+
print("开始垃圾清理")
41+
subprocess.run("ipfs pin rm %s" % cid, shell=True)
42+
print("垃圾清理已完成")
43+
pass
44+
45+
#Main
46+
mode = input(" 1.托管数据至VshareCloud\n 2.托管数据到自定义FileCoin节点\n 3.托管数据到全球FileCoin节点(性价比最高,但是交易成功率与数据可靠性未知)\n 请选择交易类型(输入纯数字):")
47+
deal_duration = input("请输入交易天数(纯数字,最低180天):")
48+
cid = get_cid()
49+
if mode == "1":
50+
minerid = get_vshare_nodeid()
51+
cmd = "expect /opt/vsharecloud-tools/scripts/single_deal.sh %s %s %s" % (cid, deal_duration, minerid)
52+
subprocess.run(cmd, shell=True)
53+
print("交易已发起,请通过命令 lotus client list-deals 查询交易状态")
54+
if_gc = input("是否清理刚刚导入的文件缓存?(y/n)")
55+
if if_gc == "y":
56+
ipfs_gc(cid)
57+
else:
58+
print("程序退出")
59+
exit()
60+
elif mode == "2":
61+
minerid = input("请输入FileCoin节点ID(格式:f0xxxxx):")
62+
cmd = "expect /opt/vsharecloud-tools/scripts/single_deal.sh %s %s %s" % (cid, deal_duration, minerid)
63+
subprocess.run(cmd, shell=True)
64+
print("交易已发起,请通过命令 lotus client list-deals 查询交易状态")
65+
if_gc = input("是否清理刚刚导入的文件缓存?(y/n)")
66+
if if_gc == "y":
67+
ipfs_gc(cid)
68+
else:
69+
print("程序退出")
70+
exit()
71+
elif mode == "3":
72+
deal_times = input("请输入本次发起的交易次数(纯数字):")
73+
max_budget = input("请输入最大的价格预算(纯数字)")
74+
cmd = "expect /opt/vsharecloud-tools/scripts/global_deal.sh %s %s %s %s" % (cid, deal_duration, max_budget, deal_times)
75+
subprocess.run(cmd, shell=True)
76+
print("交易已发起,请通过命令 lotus client list-deals 查询交易状态")
77+
if_gc = input("是否清理刚刚导入的文件缓存?(y/n)")
78+
if if_gc == "y":
79+
ipfs_gc(cid)
80+
else:
81+
print("程序退出")
82+
exit()
83+
else:
84+
print("输入无效,退出程序")
85+
exit()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ root@devmachine:~# vsharecloud-cli
4949
#### *关于VshareCloud联盟
5050
VshareCloud联盟是由本项目发起方组织的节点联盟,优势如下:
5151
- 我们对联盟内的节点进行了审核,确保服务商技术方案稳定可靠
52-
- 我们采用了动态稳定定价机制,确保所有节点的交易储存价格始终稳定在 0.01CNY/GiB/月 附近(后续根据全网资源,可能会有所微调)
52+
- ~~我们采用了动态稳定定价机制,确保所有节点的交易储存价格始终稳定在 0.01CNY/GiB/月 附近(后续根据全网资源,可能会有所微调)~~ **当前无限期免费!!!**
5353
- 节点优化了接单接口的全球可达性,节点具备全球接单能力的同时,也具备了全球范围内的快速数据取回
5454

5555
当您使用本工具进行数据存储并选择托管到VshareCloud节点(选项1)时,将会为您快速地匹配联盟内的节点,进行稳定高效的数据存储。

Tools/fil_price_sync.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ def get_pirce_data():
1212
price_data = get_pirce_data()
1313
cmd = """/usr/local/bin/lotus-miner storage-deals set-ask --price %s --verified-price 0.000000000000000001 --min-piece-size 16MiB --max-piece-size 60GiB""" % price_data["fil_stable_price"]
1414
subprocess.run(cmd, shell=True)
15-
print("价格已更新至:" + str(price_data["fil_stable_price"]))
15+
print("价格已更新至:" + str(price_data["fil_stable_price"]))
16+
#Todo
17+
#lotus-miner retrieval-deals set-ask --price 0.000000000000000001 --unseal-price 0.000000000000000001

0 commit comments

Comments
 (0)