filecoin space race

1,克隆源码

git clone https://github.com/filecoin-project/lotus.git

1.1,v0.5.1

# git show
commit d789ca9299be0b1a9ceaf1f8594f0839922013df (HEAD -> master, origin/master, origin/HEAD)
Merge: 56d419e9 aacfcba4
Author: Łukasz Magiera <[email protected]>
Date:   Tue Aug 25 01:08:02 2020 +0200

    Merge pull request #3274 from filecoin-project/fix/check-message-valid

    Check ValidForBlockInclusion in mpool
git fetch origin
# git tag
v0.5.0
v0.5.1
# git show v0.5.1
tag v0.5.1
Tagger: Travis Person <[email protected]>
Date:   Mon Aug 24 19:52:23 2020 +0000

Spacerace genesis

commit 3736d1ce4527664169a4a686452b1ea6b8beebcc (tag: v0.5.1)
Author: Travis Person <[email protected]>
Date:   Mon Aug 24 19:51:48 2020 +0000

    Testnet spacerace genesis

diff --git a/build/genesis/devnet.car b/build/genesis/devnet.car
new file mode 100644
index 00000000..f1b3f342
Binary files /dev/null and b/build/genesis/devnet.car differ
# git reset --hard v0.5.1
HEAD 现在位于 3736d1ce Testnet spacerace genesis

1.2,v0.5.3

  • 升级
git pull
# git show
commit 4c71182c6b73c9783444226a8a3c36556395e50f (HEAD -> master, tag: v0.5.3, origin/master, origin/HEAD)
Merge: a085b3b5 7e810818
Author: vyzo <[email protected]>
Date:   Tue Aug 25 09:04:11 2020 +0300

    Merge pull request #3280 from filecoin-project/fix/mpool-init-crash

    initialize mpool ts _before_ loading local messages

1.3,v0.5.4

# git pull
# git show
commit d4fef1b5f82b3602a1ff45979ad035e67280e334 (HEAD -> master, tag: v0.5.4, origin/master, origin/HEAD)
Merge: 0009f7c8 d5c4b66e
Author: Whyrusleeping <[email protected]>
Date:   Tue Aug 25 17:55:15 2020 -0700

    Merge pull request #3301 from filecoin-project/feat/release-0.5.4

    Lotus release v0.5.4

1.4,v0.5.6

git pull origin master
git checkout v0.5.6
# lotus --version
lotus version 0.5.6+git.606a58bc

1.5,v0.5.8

git pull origin master
git fetch
git tag
git checkout v0.5.8
# lotus --version
lotus version 0.5.8+git.5426ef0b

1.6,v0.5.10

# lotus --version
lotus version 0.5.10+git.38cb2601

2,源码编译

2.1,依赖

apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl
# go version
go version go1.14.7 linux/amd64
# rustc --version
rustc 1.44.1 (c7087fe00 2020-06-17)

2.2,AMD

env RUSTFLAGS="-C target-cpu=native -g" FFI_BUILD_FROM_SOURCE=1 make clean all lotus-bench
  • 或者
env RUSTFLAGS="-C target-cpu=native -g" FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1 FIL_PROOFS_USE_GPU_TREE_BUILDER=1 FFI_BUILD_FROM_SOURCE=1 make clean all lotus-bench
make install

2.3,intel

make clean && make all
make install
# lotus --version
lotus version 0.4.6+git.3736d1ce
  • 升级
# lotus --version
lotus version 0.5.2+git.4c71182c
  • v0.5.4
# lotus version
Daemon:  0.5.4+git.d4fef1b5+api0.12.0
Local: lotus version 0.5.4+git.d4fef1b5

3,设置环境变量

3.1,bash环境变量

# cat .bashrc
# lotus
export LOTUS_PATH=/cephfs/lotuswork/lotus
export LOTUS_STORAGE_PATH=/cephfs/lotuswork/lotusstorage
export WORKER_PATH=/cephfs/lotuswork/lotusworker
export TMPDIR=/cephfs/lotuswork/tmpdir

# FIL_PROOFS_PARAMETER
export FIL_PROOFS_PARAMETER_CACHE=/cephfs/filecoin-proof-parameters-v28
# IPFS_GATEWAY
export IPFS_GATEWAY=https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/
# FIL_PROOFS_PARENT_CACHE
export FIL_PROOFS_PARENT_CACHE=/cephfs/lotuswork/filecoin-parents

 日志
export RUST_BACKTRACE=full
export RUST_LOG=debug

# GPU计算PreCommit2
export FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1
export FIL_PROOFS_USE_GPU_TREE_BUILDER=1

export FIL_PROOFS_MAXIMIZE_CACHING=1

3.2,创建服务

# cat /etc/systemd/system/lotus-daemon.service
[Unit]
Description=Lotus Daemon
After=network-online.target
Requires=network-online.target

[Service]
Environment=GOLOG_FILE="/cephfs/daemon.log"
Environment=GOLOG_LOG_FMT="json"
ExecStart=/usr/local/bin/lotus daemon
Restart=always
RestartSec=10

MemoryAccounting=true
MemoryHigh=8G
MemoryMax=10G
LimitNOFILE=8192:10240

[Install]
WantedBy=multi-user.target
# cat /etc/systemd/system/lotus-daemon.service.d/override.conf
[Service]
Environment="FIL_PROOFS_PARAMETER_CACHE=/cephfs/filecoin-proof-parameters-v28"

Environment="LOTUS_PATH=/cephfs/lotuswork/lotus"
Environment="LOTUS_STORAGE_PATH=/cephfs/lotuswork/lotusstorage"
Environment="WORKER_PATH=/cephfs/lotuswork/lotusworker"
Environment="TMPDIR=/cephfs/lotuswork/tmpdir"
Environment="FIL_PROOFS_PARENT_CACHE=/cephfs/lotuswork/filecoin-parents"

Environment="IPFS_GATEWAY=https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"

Environment="FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1"
Environment="FIL_PROOFS_USE_GPU_TREE_BUILDER=1"

Environment="FIL_PROOFS_MAXIMIZE_CACHING=1"

Environment="RUST_BACKTRACE=full"
Environment="RUST_LOG=debug"
# cat /etc/systemd/system/lotus-miner.service
[Unit]
Description=Lotus Miner
After=network.target
After=lotus-daemon.service
Requires=lotus-daemon.service

[Service]
ExecStart=/usr/local/bin/lotus-miner run
Environment=GOLOG_FILE="/cephfs/miner.log"
Environment=GOLOG_LOG_FMT="json"

[Install]
WantedBy=multi-user.target
# cat /etc/systemd/system/lotus-miner.service.d/override.conf
[Service]
Environment="FIL_PROOFS_PARAMETER_CACHE=/cephfs/filecoin-proof-parameters-v28"

Environment="LOTUS_PATH=/cephfs/lotuswork/lotus"
Environment="LOTUS_STORAGE_PATH=/cephfs/lotuswork/lotusstorage"
Environment="WORKER_PATH=/cephfs/lotuswork/lotusworker"
Environment="TMPDIR=/cephfs/lotuswork/tmpdir"
Environment="FIL_PROOFS_PARENT_CACHE=/cephfs/lotuswork/filecoin-parents"

Environment="IPFS_GATEWAY=https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"

Environment="FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1"
Environment="FIL_PROOFS_USE_GPU_TREE_BUILDER=1"

Environment="FIL_PROOFS_MAXIMIZE_CACHING=1"

Environment=RUST_BACKTRACE="full"
Environment=RUST_LOG="debug"

4,运行服务

nohup lotus daemon >> /storage/daemon.log 2>&1 &
  • 或者
systemctl start lotus-daemon.service
lotus sync wait
lotus wallet list
  • 创建钱包
lotus wallet new bls

5,获取测试币

# lotus wallet balance
100 FIL

6,创建矿工

lotus-miner init --owner=<bls-addr> --sector-size=32GiB

7,运行矿工

nohup lotus-miner run >> /cephfs/miner.log 2>&1 &

8,设置公网IP端口映射接收bot订单

lotus-miner net id
lotus-miner net listen
# vim /cephfs/lotuswork/lotusstorage/config.toml
[Libp2p]
#  ListenAddresses = ["/ip4/0.0.0.0/tcp/0", "/ip6/::/tcp/0"]
   ListenAddresses = ["/ip4/0.0.0.0/tcp/自定义端口"]
#  AnnounceAddresses = []
   AnnounceAddresses = ["/ip4/公网Ip/tcp/自定义端口"]

重启lotus-miner run

# lotus-miner net listen
# lotus-miner net peers
lotus-miner actor set-addrs /ip4/公网IP/tcp/自定义端口
# cd /cephfs/master/lotus/build/bootstrap/
# for id in $(cat ./bootstrappers.pi); do lotus-miner net connect $id; done
connect 12D3KooWJTUBUjtzWJGWU1XSiY21CwmHaCNLNYn2E7jqHEHyZaP7: success
connect 12D3KooW9yeKXha4hdrJKq74zEo99T8DhriQdWNoojWnnQbsgB3v: success
connect 12D3KooWCrx8yVG9U9Kf7w8KLN3Edkj5ZKDhgCaeMqQbcQUoB6CT: success
connect 12D3KooWPkL9LrKRQgHtq7kn9ecNhGU9QaziG8R5tX8v9v7t3h34: success
connect 12D3KooWKYSsbpgZ3HAjax5M1BXCwXLa6gVkUARciz7uN3FNtr7T: success
connect 12D3KooWQYzqnLASJAabyMpPb1GcWZvNSe7JDcRuhdRqonFoiK9W: success
# lotus-miner net peers | wc -l
129
lotus-miner sectors pledge

9,升级扇区

8: Proving   sSet: YES active: YES tktH: 49276 seedH: 51147 deals: [0]
lotus-miner sectors mark-for-upgrade 扇区ID

参考

  1. install-lotus-ubuntu
  2. install-systemd-services
  3. 改善连接性

猜你喜欢

转载自blog.csdn.net/u010953692/article/details/108213206