启动本地Devnet测试
本地环境为mac
在调试模式下构建Lotus二进制程序,这可以使用2048个字节的扇区大小来启动本地网络。
make 2k
执行结果如下
rm -f lotus
go build -ldflags="-X=github.com/filecoin-project/lotus/build.CurrentCommit=+git.c4de2373.dirty" -tags=2k -o lotus ./cmd/lotus
go run github.com/GeertJohan/go.rice/rice append --exec lotus -i ./build
rm -f lotus-storage-miner
go build -ldflags="-X=github.com/filecoin-project/lotus/build.CurrentCommit=+git.c4de2373.dirty" -tags=2k -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 -ldflags="-X=github.com/filecoin-project/lotus/build.CurrentCommit=+git.c4de2373.dirty" -tags=2k -o lotus-seal-worker ./cmd/lotus-seal-worker
go run github.com/GeertJohan/go.rice/rice append --exec lotus-seal-worker -i ./build
rm -f lotus-seed
go build -ldflags="-X=github.com/filecoin-project/lotus/build.CurrentCommit=+git.c4de2373.dirty" -tags=2k -o lotus-seed ./cmd/lotus-seed
go run github.com/GeertJohan/go.rice/rice append --exec lotus-seed -i ./build
下载2048字节参数,零知识证明文件,这一步需要下载1G大小,下载非常慢,需要耐心等待,这卡了好长时间。
// 加速下载
export IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
./lotus fetch-params 2048
预密封一些扇区:
./lotus-seed pre-seal --sector-size 2KiB --num-sectors 2
sector-id: {1000 0}, piece info: {2048 bafk4chza23g6ylx5ripxmu6hqbd3rrbyfziaeinbq3p44elblfb3mbqlai5q}
2020-07-19T10:39:09.772+0800 WARN preseal seed/seed.go:178 PreCommitOutput: {1000 0} bafk4ehzar2sgndxhb2ker7m5fszjq5qmnlmntj7wow3grwlsqqzvl7fmwfma bafk4chza23g6ylx5ripxmu6hqbd3rrbyfziaeinbq3p44elblfb3mbqlai5q
sector-id: {1000 1}, piece info: {2048 bafk4chzameyyobst4y2wozct3qz2xvkuan3qyffrhrt5l5ydzqqgjrcdbiga}
2020-07-19T10:39:09.808+0800 WARN preseal seed/seed.go:178 PreCommitOutput: {1000 1} bafk4ehzaw3nxe2aq4vkwwa6h6qrrlhlcrcr2ea3b47bqaj3d7yxmhkbjym7a bafk4chzameyyobst4y2wozct3qz2xvkuan3qyffrhrt5l5ydzqqgjrcdbiga
2020-07-19T10:39:09.809+0800 WARN preseal seed/seed.go:104 PeerID not specified, generating dummy
2020-07-19T10:39:09.812+0800 INFO preseal seed/seed.go:232 Writing preseal manifest to /Users/tietou/.genesis-sectors/pre-seal-t01000.json
主要做了些扇区的预提交,初始化了p2p key和创始配置。
创建创世块并启动第一个节点:
./lotus-seed genesis new localnet.json
./lotus-seed genesis add-miner localnet.json ~/.genesis-sectors/pre-seal-t01000.json
./lotus daemon --lotus-make-genesis=dev.gen --genesis-template=localnet.json --bootstrap=false
// 第二的code的打印
2020-07-19T21:41:11.220+0800 INFO lotus-seed lotus-seed/genesis.go:107 Adding miner t01000 to genesis template
2020-07-19T21:41:11.221+0800 INFO lotus-seed lotus-seed/genesis.go:124 Giving t3siuwdzithlehbitt22vb4hyqyphcftyraem36eiemm3qwogqkzyqdb6to5hzdrhr6ugi6wuthibou76vxzta some initial balance
// code 3 打印
2020-07-19T21:44:11.434+0800 INFO main lotus/daemon.go:166 lotus repo: /Users/tietou/.lotus
2020-07-19T21:44:11.434+0800 INFO repo repo/fsrepo.go:102 Initializing repo at '/Users/tietou/.lotus'
2020-07-19T21:44:11.536+0800 INFO build go-paramfetch@v0.0.2-0.20200701152213-3e0f0afdc261/paramfetch.go:138 Parameter file /var/tmp/filecoin-proof-parameters/v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-2627e4006b67f99cef990c0a47d5426cb7ab0a0ad58fc1061547bf2d28b09def.vk is ok
2020-07-19T21:44:11.537+0800 INFO build go-paramfetch@v0.0.2-0.20200701152213-3e0f0afdc261/paramfetch.go:162 parameter and key-fetching complete
2020-07-19T21:44:11.616+0800 INFO badger v2@v2.0.3/levels.go:185 All 0 tables opened in 0s
2020-07-19T21:44:11.686+0800 INFO badger v2@v2.0.3/levels.go:185 All 0 tables opened in 0s
2020-07-19T21:44:11.715+0800 INFO badger v2@v2.0.3/levels.go:185 All 0 tables opened in 0s
2020-07-19T21:44:11.723+0800 WARN chainstore store/store.go:146 no previous chain state found
2020-07-19T21:44:11.723+0800 WARN genesis testing/genesis.go:57 Generating new random genesis block, note that this SHOULD NOT happen unless you are setting up new network
init set t3siuwdzithlehbitt22vb4hyqyphcftyraem36eiemm3qwogqkzyqdb6to5hzdrhr6ugi6wuthibou76vxzta t0100
publishing 2 storage deals on miner t01000 with worker t3siuwdzithlehbitt22vb4hyqyphcftyraem36eiemm3qwogqkzyqdb6to5hzdrhr6ugi6wuthibou76vxzta
Added weight to claim: 2048 20481
Added weight to claim: 4096 40961
2020-07-19T21:44:11.739+0800 INFO genesis genesis/genesis.go:331 Empty Genesis root: bafy2bzaceaa43et73tgxsoh2xizd4mxhbrcfig4kqp25zfa5scdgkzppllyuu
GENESIS MINER ADDRESS: t01000
2020-07-19T21:44:11.742+0800 WARN genesis testing/genesis.go:97 WRITING GENESIS FILE AT dev.gen
2020-07-19T21:44:11.742+0800 WARN chainstore store/store.go:371 no heaviest tipset found, using [bafy2bzacedkjt76sttvrgef3imyyn23yz45jxalyinapycwhhjhtlnxjtlrhm]
2020-07-19T21:44:11.742+0800 INFO chainstore store/store.go:376 New heaviest tipset! [bafy2bzacedkjt76sttvrgef3imyyn23yz45jxalyinapycwhhjhtlnxjtlrhm] (height=0)
2020-07-19T21:44:11.752+0800 INFO p2pnode lp2p/addrs.go:114 Swarm listening at: [/ip4/127.0.0.1/tcp/52046 /ip4/192.168.0.103/tcp/52046 /ip6/::1/tcp/52047]
2020-07-19T21:44:12.945+0800 WARN hello hello/hello.go:50 running without pee