本文阐述在一台windows电脑上,搭建基于PoA共识算法的以太坊私链(3个挖矿节点),步骤如下:
(1)生成3个矿工账号
假设3个节点的数据目录分别是:
节点1 e:\work\test\1_poa_data
节点2 e:\work\test\2_poa_data
节点3 e:\work\test\3_poa_data\
分别运行下面的生成账号命令为3个节点生成3个矿工账号:
geth --datadir e:\work\test\1_poa_data\ account new
geth --datadir e:\work\test\2_poa_data\ account new
geth --datadir e:\work\test\3_poa_data\ account new
假设生成的3个矿工账号分别是:
0xe4697cBB8955526C703A4441f219cf0A04447a9B
0x815261DC4186502eC0D8CCFEf163785e1617b5A8
0x2E6C69224AC3F618b77c0c170dC26979be84b1dB
(2)使用puppeth工具生成创世块文件
E:\work\test>puppeth
+-----------------------------------------------------------+
| Welcome to puppeth, your Ethereum private network manager |
| |
| This tool lets you create a new Ethereum network down to |
| the genesis block, bootnodes, miners and ethstats servers |
| without the hassle that it would normally entail. |
| |
| Puppeth uses SSH to dial in to remote servers, and builds |
| its network components out of Docker containers using the |
| docker-compose toolset. |
+-----------------------------------------------------------+
Please specify a network name to administer (no spaces or hyphens, please)
> 123
Sweet, you can set this via --network=123 next time!
[32mINFO [0m[07-03|16:09:55] Administering Ethereum network [32mname[0m=123
[33mWARN [0m[07-03|16:09:55] No previous configurations found