美文网首页
如何加入FileCoin测试网

如何加入FileCoin测试网

作者: 袁俊亮技术博客 | 来源:发表于2020-05-11 11:09 被阅读0次

如何加入FileCoin测试网

: 本节所用到的操作系统是ubuntu 18.04,如有其他操作系统平台,请参考官方文档

官方文档地址: https://docs.lotu.sh/

如果不想自己编译,可以使用官方编译好的版本: https://github.com/filecoin-project/lotus/releases

编译lotus

编译lotus需要安装以下依赖

go (1.13 or higher)
gcc (7.4.0 or higher)
git (version 2 or higher)
bzr (some go dependency needs this)
jq
pkg-config
opencl-icd-loader
opencl driver (like nvidia-opencl on arch) (for GPU acceleration)
opencl-headers (build)
rustup (proofs build)
llvm (proofs build)
clang (proofs build)
  1. 更新ubuntu的源
sudo apt update
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev
  1. 编译基础依赖环境
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt install golang-go gcc git bzr jq pkg-config mesa-opencl-icd ocl-icd-opencl-dev
  1. 下载lotus源码
git clone https://github.com/filecoin-project/lotus.git
cd lotus/
  1. 编译并安装
make clean && make all
sudo make install

安装完lotus就可以通过lotuscli命令加入到FileCoin测试网

  1. 执行lotus -h会返回如下命令行帮助文档
NAME:
   lotus - Filecoin decentralized storage network client

USAGE:
   lotus [global options] command [command options] [arguments...]

VERSION:
   0.2.8+git749db0bf

COMMANDS:
     daemon        Start a lotus daemon process
     auth          Manage RPC permissions
     chain         Interact with filecoin blockchain
     client        Make deals, store data, retrieve data
     fetch-params  Fetch proving parameters
     mpool         Manage message pool
     msig          Interact with a multisig wallet
     net           Manage P2P Network
     paych         Manage payment channels
     send          Send funds between accounts
     state         Interact with and query filecoin chain state
     sync          Inspect or interact with the chain syncer
     version       Print version
     wallet        Manage wallet
     log           Manage logging
     help, h       Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help (default: false)
   --version, -v  print the version (default: false)

如果启动lotus遇到问题,可以尝试下面两种解决方法

方法一: 升级lotus

执行以下命令升级

# get the latest
git pull origin master

# clean and remake the binaries
make clean && make build

方法二: 如果之前运行过Lotus,可以使用以下命令删除相关文件

rm -rf ~/.lotus ~/.lotusstorage

改命令通常可以解决正在运行时,执行命令的所有问题

启动节点

注意

如果您想在中国使用。您应该在计算机上设置以下环境变量

IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
  1. 启动节点
lotus daemon
  1. 在新窗口中确认节点是否连接到网络
lotus net peers | wc -l
  1. 运行以下命令以查看链同步进度
lotus sync wait

要查看当前块高,可以访问troubleshooting notes

  • 此步骤将花费几个小时到几天不等。
  • 完成后,就能够执行Lotus Testnet操作

创建钱包

  1. 初始化一个新的钱包
lotus wallet new

返回钱包地址

t13h2372zowvvbhe5pclnaoi4pbxhx3f3nyff2vxq

: 去水龙头获取测试代币

  1. 查看钱包余额
lotus wallet balance <YOUR_NEW_ADDRESS>

换算汇率: 1 attoFil = 10^-18 FIL

如果您的链未完全同步,您的钱包中将看不到任何attoFIL

挖矿

初始化矿工

  1. 用以下命令确保您的钱包中至少有一个BLS地址(以t3开头)
lotus wallet list

如果没有,先通过以下命令创建一个

lotus wallet new bls

返回如下地址

t3v4m2nzenwnz23oqpui77sm7maxgicw3qpbxicj662cmsadu6ubnj7rbbc46nt6xdbmm7b5xk67rgnzhnarga
  1. 创建矿工
  • 访问水龙头
  • 点击[Create Miner]
  • bls地址填进去,点击create miner

: 这个操作需要等待大约5分钟左右,中间不能刷新网页

当您看到以下内容时,任务将完成:

New storage miners address is: <YOUR_NEW_MINING_ADDRESS>

eg:New storage miners address is: t045710

  1. 初始化矿工

在CLI窗口中,使用以下命令启动您的矿工:

lotus-storage-miner init --actor=ACTOR_VALUE_RECEIVED --owner=OWNER_VALUE_RECEIVED
  • ACTOR_VALUE_RECEIVED: 就是第2步申请的矿工地址: t045710
  • OWNER_VALUE_RECEIVED: bls地址

eg:

lotus-storage-miner init --actor=t045710 --owner=t3v4m2nzenwnz23oqpui77sm7maxgicw3qpbxicj662cmsadu6ubnj7rbbc46nt6xdbmm7b5xk67rgnzhnarga

这个需要等一会儿才能完成

  1. 开始挖矿
lotus-storage-miner run

如果下载Filecoin Proof Parameters,则下载可能需要一些时间

获取矿工信息

lotus-storage-miner info

密封数据并提交时空证明(PoSts)

lotus-storage-miner pledge-sector

查看算力以及扇区信息

lotus-storage-miner state power
# returns total power

lotus-storage-miner state power <miner>

lotus-storage-miner state sectors <miner>

FileCoin知识点解析

  • 什么是FileCoin证明参数(Filecoin Proof Parameters)

FileCoin的证明算法依赖大型二进制参数

  • 什么是时空证明(PoSts)

我们如何证明数据在一段时间内都一直被存储?为了解决这个问题,filecoin介绍了新的证明,时空证明(proof-of-spacetime,post),时空证明提出了证明链的数据结构,证明链由挑战(challenge)和证明(proof)链接起来形成,在证明链的基础上添加上时间段,这样就得到了一段时间内的矿工存储数据的证明,这就是时空证明(Proof of Spacetime,PoSt)

测试截图

6451589166467_.pic_hd.jpg

相关文章

网友评论

      本文标题:如何加入FileCoin测试网

      本文链接:https://www.haomeiwen.com/subject/mjoynhtx.html