Skip to content

Commit

Permalink
更新文档
Browse files Browse the repository at this point in the history
更新文档
  • Loading branch information
HenryLee committed Mar 14, 2022
1 parent e0fbef1 commit aa55380
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 2 deletions.
85 changes: 85 additions & 0 deletions Cli-Tools/one_kick_tool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import os
import random
import requests
import subprocess

def get_cid(fil):
cid = input("请输入CID(直接回车导入本地文件):")
if cid == "":
file_path = input("请输入文件绝对路径:")
while os.path.exists(file_path) == False:
print("该路径文件不存在,请重新输入")
else:
if os.path.isfile(file_path):
ipfs_add_cmd = """ipfs add %s""" % file_path
ipfs_cli_output = str(subprocess.check_output(ipfs_add_cmd.split()), "utf-8")
cid = ipfs_cli_output.split()[-2]
elif os.path.isdir(file_path):
ipfs_add_cmd = """ipfs add -r %s""" % file_path
ipfs_cli_output = str(subprocess.check_output(ipfs_add_cmd.split()), "utf-8")
cid = ipfs_cli_output.split()[-2]
else:
pass
else:
pass
print("已获取到CID:%s" % cid)
return cid

def get_vshare_nodeid():
minerid_list = json.loads(requests.get('https://fil-api.ipns.tech/filtools/miner_list.php').text)
minerid_list = minerid_list["data"]
minerid = random.choice(minerid_list)
print("已选取到节点:%s" % minerid)
return minerid


def ipfs_gc(cid):
print("开始垃圾清理")
subprocess.run("ipfs pin rm %s" % cid, shell=True)
print("垃圾清理已完成")
pass

#Main
mode = input(" 1.托管数据至VshareCloud\n 2.托管数据到自定义FileCoin节点\n 3.托管数据到全球FileCoin节点(性价比最高,但是交易成功率与数据可靠性未知)\n 请选择交易类型(输入纯数字):")
deal_duration = input("请输入交易天数(纯数字,最低180天):")
cid = get_cid()
if mode == "1":
minerid = get_vshare_nodeid()
cmd = "expect /opt/vsharecloud-tools/scripts/single_deal.sh %s %s %s" % (cid, deal_duration, minerid)
subprocess.run(cmd, shell=True)
print("交易已发起,请通过命令 lotus client list-deals 查询交易状态")
if_gc = input("是否清理刚刚导入的文件缓存?(y/n)")
if if_gc == "y":
ipfs_gc(cid)
else:
print("程序退出")
exit()
elif mode == "2":
minerid = input("请输入FileCoin节点ID(格式:f0xxxxx):")
cmd = "expect /opt/vsharecloud-tools/scripts/single_deal.sh %s %s %s" % (cid, deal_duration, minerid)
subprocess.run(cmd, shell=True)
print("交易已发起,请通过命令 lotus client list-deals 查询交易状态")
if_gc = input("是否清理刚刚导入的文件缓存?(y/n)")
if if_gc == "y":
ipfs_gc(cid)
else:
print("程序退出")
exit()
elif mode == "3":
deal_times = input("请输入本次发起的交易次数(纯数字):")
max_budget = input("请输入最大的价格预算(纯数字)")
cmd = "expect /opt/vsharecloud-tools/scripts/global_deal.sh %s %s %s %s" % (cid, deal_duration, max_budget, deal_times)
subprocess.run(cmd, shell=True)
print("交易已发起,请通过命令 lotus client list-deals 查询交易状态")
if_gc = input("是否清理刚刚导入的文件缓存?(y/n)")
if if_gc == "y":
ipfs_gc(cid)
else:
print("程序退出")
exit()
else:
print("输入无效,退出程序")
exit()
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ root@devmachine:~# vsharecloud-cli
#### *关于VshareCloud联盟
VshareCloud联盟是由本项目发起方组织的节点联盟,优势如下:
- 我们对联盟内的节点进行了审核,确保服务商技术方案稳定可靠
- 我们采用了动态稳定定价机制,确保所有节点的交易储存价格始终稳定在 0.01CNY/GiB/月 附近(后续根据全网资源,可能会有所微调)
- ~~我们采用了动态稳定定价机制,确保所有节点的交易储存价格始终稳定在 0.01CNY/GiB/月 附近(后续根据全网资源,可能会有所微调)~~ **当前无限期免费!!!**
- 节点优化了接单接口的全球可达性,节点具备全球接单能力的同时,也具备了全球范围内的快速数据取回

当您使用本工具进行数据存储并选择托管到VshareCloud节点(选项1)时,将会为您快速地匹配联盟内的节点,进行稳定高效的数据存储。
Expand Down
4 changes: 3 additions & 1 deletion Tools/fil_price_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ def get_pirce_data():
price_data = get_pirce_data()
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"]
subprocess.run(cmd, shell=True)
print("价格已更新至:" + str(price_data["fil_stable_price"]))
print("价格已更新至:" + str(price_data["fil_stable_price"]))
#Todo
#lotus-miner retrieval-deals set-ask --price 0.000000000000000001 --unseal-price 0.000000000000000001

0 comments on commit aa55380

Please sign in to comment.