lotus testnet-staging DOCS 0.0.4

lotus testnet-staging DOCS 0.0.4

  • 1,ubuntu安装lotus
  • 2,设置全局代理或者修改IPFS网关
    • 2.1,设置全局代理
    • 2.2,修改IPFS公共网关
  • 3,lotus 命令

1,ubuntu安装lotus

  • 依赖安装
# add-apt-repository ppa:longsleep/golang-backports
# apt update
# apt install -y golang-go gcc git bzr jq pkg-config mesa-opencl-icd ocl-icd-* opencl-headers llvm clang
  • go版本不能为1.13.5

  • 设置终端代理

  • 安装依赖rustup

# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# source $HOME/.cargo/env
# rustup --version
rustup 1.20.2 (13979c968 2019-10-16)
# git clone https://github.com/filecoin-project/lotus.git
# cd lotus/
# git show
commit f16cc0322e9d298b559e094dc41b1dbd91891c75 (HEAD -> master, origin/master, origin/HEAD)
Merge: c7feb44b 4beb6a4d
Author: Whyrusleeping 
Date:   Wed Dec 11 18:54:20 2019 +0100

    Merge pull request #817 from filecoin-project/testnet-staging

    Testnet
    
# make clean all && make install

rm -f lotus
go build  -o lotus ./cmd/lotus
go run github.com/GeertJohan/go.rice/rice append --exec lotus -i ./build
rm -f lotus-storage-miner
go build  -o lotus-storage-miner ./cmd/lotus-storage-miner
go run github.com/GeertJohan/go.rice/rice append --exec lotus-storage-miner -i ./build
rm -f lotus-seal-worker
go build  -o lotus-seal-worker ./cmd/lotus-seal-worker
go run github.com/GeertJohan/go.rice/rice append --exec lotus-seal-worker -i ./build
install -C ./lotus /usr/local/bin/lotus
install -C ./lotus-storage-miner /usr/local/bin/lotus-storage-miner
install -C ./lotus-seal-worker /usr/local/bin/lotus-seal-worker
  • 下载测试网分支
# git clone  -b testnet-staging https://github.com/filecoin-project/lotus.git
  • 查看lotus版本
# git tag
v0.1.0
 git checkout v0.1.0
HEAD is now at 4beb6a4d Testnet
# git fetch
remote: Enumerating objects: 86, done.
remote: Counting objects: 100% (86/86), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 92 (delta 64), reused 75 (delta 60), pack-reused 6
Unpacking objects: 100% (92/92), done.
From https://github.com/filecoin-project/lotus
   830f2cbd..04691a13  feat/chainwatch-pg          -> origin/feat/chainwatch-pg
 * [new branch]        feat/storage-market-tracing -> origin/feat/storage-market-tracing
 * [new branch]        fix/map-too-large           -> origin/fix/map-too-large
 * [new branch]        fix/message-count           -> origin/fix/message-count
   67f79e81..3f67b7c5  master                      -> origin/master
 * [new branch]        misc/remove-createminer     -> origin/misc/remove-createminer
 * [new tag]           v0.1.1                      -> v0.1.1
  • lotus 切换到v0.1.1
# git checkout v0.1.1
Previous HEAD position was 4beb6a4d Testnet
HEAD is now at 16a6c6a1 Merge pull request #891 from filecoin-project/feat/v0.1.1
# lotus version
0.1.1+api0.1.1
lotus version 0.1.1-16a6c6a1
  • 设置lotus目录
/dev/sdb       ext4      7.3T  106M  6.9T   1% /storage

# tail .bashrc

export LOTUS_STORAGE_PATH=/storage/lotuswork/lotusstorage
export LOTUS_PATH=/storage/lotuswork/lotus
export WORKER_PATH=/storage/lotuswork/lotusworker
  • lotus守护进程运行后可以搜索日志
2019-12-13T09:57:38.205+0800	INFO	repo	repo/fsrepo.go:97	Initializing repo at '/storage/lotuswork/lotus'
  • go包下载超时设置
  • error
go: contrib.go.opencensus.io/exporter/[email protected]: Get https://proxy.golang.org/contrib.go.opencensus.io/exporter/jaeger/@v/v0.1.0.mod: dial tcp 216.58.200.49:443: i/o timeout
# export GO111MODULE=on
# export GOPROXY=https://goproxy.io
  • 下载复制证明需要的参数
  • 扇区大小设置1G,复制证明参数6.9G
  • 下载复制证明参数lotus fetch-params --proving-params=
  • 1G扇区1073741824
# lotus fetch-params --proving-params=1073741824
  • 重新编译安装
# rm -rf ~/.lotus ~/.lotusstorage
# rm -rf /usr/local/bin/lotus /usr/local/bin/lotus-storage-miner /usr/local/bin/lotus-seal-worker
# lotus daemon >> /var/log/lotus.log 2>&1 &
# lotus fetch-params --proving-params=1073741824
2019-12-12T01:31:48.739+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-b46f3a1051afbb67f70aae7082da95def62eee943662f3e1bf69837fb08aaae4.vk is ok
2019-12-12T01:31:48.739+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-117839dacd1ef31e5968a6fd13bcd6fa86638d85c40c9241a1d07c2a954eb89b.vk is ok
2019-12-12T01:31:48.739+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-09ae025de08399327e14f0cb6b4c907b6fe1e8b77046e31de8921bde588de900.vk is ok
2019-12-12T01:31:48.739+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-f571ee2386f4c65a68e802747f2d78691006fc81a67971c4d9641403fffece16.vk is ok
2019-12-12T01:31:48.739+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-6c7cbfe7eed40b6c0b23a213a70648770aed65d9ca03ae85451573c18532304b.vk is ok
2019-12-12T01:31:48.739+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-7e98e29a3b6fd661ce53507e168a8194bc7c8a29aa069b5c057d95462a8fcf9f.vk is ok
2019-12-12T01:31:48.740+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-4a2342062706429612fac099694f77294e355c6c9265b80feaff12a0268b0a92.vk is ok
2019-12-12T01:31:48.740+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-512f5e6dc00a37fa13c8b0e468188f85957b7bf1ab36d17fb9fe9ed49ae8d657.vk is ok
2019-12-12T01:31:48.740+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-e71093863cadc71de61f38311ee45816633973bbf34849316b147f8d2e66f199.vk is ok
2019-12-12T01:31:48.740+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-e99a585174b6a45b254ba4780d72c89ad808c305c6d11711009ade4f39dba8e9.vk is ok
2019-12-12T01:31:53.156+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-512f5e6dc00a37fa13c8b0e468188f85957b7bf1ab36d17fb9fe9ed49ae8d657.params is ok
2019-12-12T01:31:57.203+0800	INFO	build	build/paramfetch.go:121	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-e99a585174b6a45b254ba4780d72c89ad808c305c6d11711009ade4f39dba8e9.params is ok
  • 报错连接超时
  - the following errors occurred:
     -  fetching file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-e99a585174b6a45b254ba4780d72c89ad808c305c6d11711009ade4f39dba8e9.vk failed:
            github.com/filecoin-project/lotus/build.(*fetch).maybeFetchAsync.func1
                /root/lotus/build/paramfetch.go:87
          - Get https://ipfs.io/ipfs/QmWReGfbuoozNErbskmFvqV4q36BY6F2WWb4cVFc3zoYkA: dial tcp 199.59.150.11:443: i/o timeout
     -  fetching file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-4a2342062706429612fac099694f77294e355c6c9265b80feaff12a0268b0a92.vk failed:
            github.com/filecoin-project/lotus/build.(*fetch).maybeFetchAsync.func1
                /root/lotus/build/paramfetch.go:87
          - Get https://ipfs.io/ipfs/QmSDyi3BQrYXTQp4vSVAjZSF2RfU5iZJzzJ8jM5WSMTgjd: dial tcp 199.59.150.11:443: i/o timeout
     -  fetching file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-09ae025de08399327e14f0cb6b4c907b6fe1e8b77046e31de8921bde588de900.vk failed:
            github.com/filecoin-project/lotus/build.(*fetch).maybeFetchAsync.func1
                /root/lotus/build/paramfetch.go:87
          - Get https://ipfs.io/ipfs/QmUEsQPP46mjiZkFoVdgJMBt8yhDxrzGTdqExWHAMA2eAX: dial tcp 31.13.70.1:443: connect: connection refused

2,设置全局代理或者修改IPFS网关

2.1,设置全局代理

# apt install -y privoxy
# cd /etc/privoxy/
# cp config{,.backup}
  • vim config
#        forward-socks5t   /               127.0.0.1:9050 .
         forward-socks5t   /               127.0.0.1:1080 .
# systemctl restart  privoxy.service
  • 重新初始化
# rm -rf ~/.lotus ~/.lotusstorage
# lotus daemon >> /var/log/lotus.log 2>&1 &

2.2,修改IPFS公共网关

# rm -rf ~/.lotus ~/.lotusstorage
# vim lotus/build/paramfetch.go
//const gateway = "https://ipfs.io/ipfs/"
const gateway = "https://ipfs.greyh.at/ipfs/"

# cd lotus/
# systemctl status  s-libev-local@config
# export ALL_PROXY=socks5://127.0.0.1:1080

# make clean all && make install

/tmp/filecoin-ffi-Linux_16669127.tar.gz

install -C ./lotus /usr/local/bin/lotus
install -C ./lotus-storage-miner /usr/local/bin/lotus-storage-miner
install -C ./lotus-seal-worker /usr/local/bin/lotus-seal-worker
# lotus daemon >> /var/log/lotus.log 2>&1 &

3,lotus 命令

  • 节点连接数量 lotus net peers | wc -l
# lotus net peers | wc -l
39
  • 查看区块高度同步 lotus sync wait 等待区块高度同步完成,进行下一步
# lotus sync wait
Worker 2: Target: [bafy2bzacea3ymndtkudztankkibtxhowohrovjhxyhmdrdzv65ocefr57pj52]	State: message sync	Height: 660
  • 区块高度同步完成
# lotus sync wait
Worker 0: Target: [bafy2bzacec6riw7yo4pptylj2ycznl7do5ludgbfy5mzhmjb745e2licylfxw]	State: complete	Height: 4944
Done!
  • 查看钱包地址
# lotus wallet list
  • 创建钱包地址
# lotus wallet new bls
t3v33nxgz43bmakdrshdday2ppjw6cwt6fbhjhswcybyva4det75zpid6romojomyjmaigi4jxhr5r77uwxcta
# lotus wallet list
t3v33nxgz43bmakdrshdday2ppjw6cwt6fbhjhswcybyva4det75zpid6romojomyjmaigi4jxhr5r77uwxcta
  • 查看钱包余额
# lotus wallet balance
0
  • 创建矿工

  • Create Miner

  • 内存16G,创建1GB扇区
    lotus testnet-staging DOCS 0.0.4_第1张图片

  • 水龙头获取矿工,扇区大小1GB
    lotus testnet-staging DOCS 0.0.4_第2张图片

  • 初始化存储矿工

# lotus-storage-miner init --actor=t01541 --owner=t3v33nxgz43bmakdrshdday2ppjw6cwt6fbhjhswcybyva4det75zpid6romojomyjmaigi4jxhr5r77uwxcta
2019-12-07T17:09:46.210+0800	INFO	main	lotus-storage-miner/init.go:80	Initializing lotus storage miner
2019-12-07T17:09:46.210+0800	INFO	main	lotus-storage-miner/init.go:84	Checking proof parameters
2019-12-07T17:09:46.210+0800	INFO	build	build/paramfetch.go:122	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-b46f3a1051afbb67f70aae7082da95def62eee943662f3e1bf69837fb08aaae4.vk is ok
2019-12-07T17:09:46.210+0800	INFO	build	build/paramfetch.go:122	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-512f5e6dc00a37fa13c8b0e468188f85957b7bf1ab36d17fb9fe9ed49ae8d657.vk is ok
2019-12-07T17:09:46.210+0800	INFO	build	build/paramfetch.go:122	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-09ae025de08399327e14f0cb6b4c907b6fe1e8b77046e31de8921bde588de900.vk is ok
2019-12-07T17:09:46.210+0800	INFO	build	build/paramfetch.go:122	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-7e98e29a3b6fd661ce53507e168a8194bc7c8a29aa069b5c057d95462a8fcf9f.vk is ok
2019-12-07T17:09:46.210+0800	INFO	build	build/paramfetch.go:122	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-6c7cbfe7eed40b6c0b23a213a70648770aed65d9ca03ae85451573c18532304b.vk is ok
2019-12-07T17:09:46.211+0800	INFO	build	build/paramfetch.go:122	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-e71093863cadc71de61f38311ee45816633973bbf34849316b147f8d2e66f199.vk is ok
2019-12-07T17:09:46.211+0800	INFO	build	build/paramfetch.go:122	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-117839dacd1ef31e5968a6fd13bcd6fa86638d85c40c9241a1d07c2a954eb89b.vk is ok
2019-12-07T17:09:46.211+0800	INFO	build	build/paramfetch.go:122	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-e99a585174b6a45b254ba4780d72c89ad808c305c6d11711009ade4f39dba8e9.vk is ok
2019-12-07T17:09:46.211+0800	INFO	build	build/paramfetch.go:122	Parameter file /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-4a2342062706429612fac099694f77294e355c6c9265b80feaff12a0268b0a92.vk is ok
2019-12-07T17:09:46.210+0800	INFO	build	build/paramfetch.go:139	Fetching /var/tmp/filecoin-proof-parameters/v20-proof-of-spacetime-election-6c7cbfe7eed40b6c0b23a213a70648770aed65d9ca03ae85451573c18532304b.params from https://ipfs.greyh.at/ipfs/
2019-12-07T17:09:46.211+0800	INFO	build	build/paramfetch.go:122	Parameter file /var/tmp/filecoin-proof-parameters/v20-stacked-proof-of-replication-f571ee2386f4c65a68e802747f2d78691006fc81a67971c4d9641403fffece16.vk is ok
2019-12-07T17:09:46.211+0800	INFO	build	build/paramfetch.go:157	GET https://ipfs.greyh.at/ipfs/QmX2Tfu49qnSUbz42s9jPf7WTVjmAPNAXFzqroAAWXN4ms
 4.36 MiB / 734.39 MiB [=>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]   0.59% 437.01 KiB/s 28m30s
# lotus-storage-miner init --actor=t01360 --owner=t3s4fbnai3odvasi5wn2xsvylnvisowqyduwyjqyamk5gcbfpfkek72zvbtvam3dkjqsj7djcgu5mip7xjccda

INFO	main	lotus-storage-miner/init.go:206	Storage miner successfully created, you can now start it with 'lotus-storage-miner run'
  • State: error报错,关闭全局代理
# lotus sync wait
Worker 2: Target: [bafy2bzaceakbeqtsxzcb6qdmdtz72zvu6ezyq4tucieagigv65dihgmhxfmkk bafy2bzaceboxn56ftzso4kpmwkryldbw243cz2u5vhtlv4pjub7s5dyq5tdwy]	State: error	Height: 66
  • lotus-storage-miner run 提示矿工创建成功
lotus-storage-miner/init.go:108	Checking full node sync status
repo/fsrepo.go:97	Initializing repo at '/root/.lotusstorage'
lotus-storage-miner/init.go:424	Created new storage miner
lotus-storage-miner/init.go:218	Storage miner successfully created, you can now start it with 'lotus-storage-miner run'
  • 运行矿工
lotus-storage-miner run >> /var/log/miner.log 2>&1 &
333.44 MiB / 5.29 GiB [===========>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------]   6.16% 2.89 MiB/s 29m13s
505.05 MiB / 5.29 GiB [================>---------------------------------------------------------------------------------------------------------------------------------------------------------------------]   9.32% 2.88 MiB/s 28m19s
676.35 MiB / 5.29 GiB [======================>---------------------------------------------------------------------------------------------------------------------------------------------------------------]  12.49% 2.88 MiB/s 27m25s
./lotus
./lotus-storage-miner init ...
./lotus-storage-miner run
./lotus-seal-worker run
lotus-storage-miner run --api "/ip4/[LAN ADDRESS]/tcp/2345"
---
make lotus-seal-worker
ssh user@remote 'mkdir .lotusstorage'
scp ~/.lotusstorage/api ~/.lotusstorage/token user@remote:.lotusstorage
scp lotus-seal-worker user@remote:
scp /var/tmp/filecoin-proof-parameters/v20* user@remote:/var/tmp/filecoin-proof-parameters
ssh user@remote
 ./lotus-seal-worker run
 
Miner: t0101
Sector Size: 16.0 MiB
Power: 16.0 MiB / 16.0 MiB (100.0000%)
Worker use:
        Local: 0 / 0 (+1 reserved)
        Remote: 1 / 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< here
PoSt Submissions:
        Previous: Epoch 148 (1 block(s), ~0m 30s ago)
        Fallback: Epoch 178 (in 31 blocks, ~15m 30s)
        Deadline: Epoch 348 (in 201 blocks, ~100m 30s)
Sectors:  map[Committing:5 Proving:1 Total:6]
  • 查看矿工状态
# lotus-storage-miner info
  • 存储数据
# cat hello.txt
2019年 12月 12日 星期四 02:49:08 CST


参考:

  1. LOTUS文档0.4
  2. linux go 安装

你可能感兴趣的:(#,lotus)