最近,一直在研究以太坊,今天发现了一个很有意思的工具,分享给大家。
puppeth 是创建新以太坊网络的向导工具。我们可以用这个工具来生成创世区块配置文件。
话不多说,直接看执行生成过程 :
➜ geth_net 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)
> gethtest
Sweet, you can set this via --network=gethtest next time!
INFO [03-23|17:08:42] Administering Ethereum network name=gethtest
WARN [03-23|17:08:42] No previous configurations found path=/Users/chenbing/.puppeth/gethtest
What would you like to do? (default = stats)
1. Show network stats
2. Configure new genesis
3. Track new remote server
4. Deploy network components
> 2
// 设置共识算法
Which consensus engine to use? (default = clique)
1. Ethash - proof-of-work
2. Clique - proof-of-authority
> 2
// 设置出块时间,以秒为单位
How many seconds should blocks take? (default = 15)
> 5
// 设置有签名权限的用户
Which accounts are allowed to seal? (mandatory at least one)
> 0x799a8f7796d1d20b8198a587caaf545cdde5de13
> 0x1458eac314d8fc922029095fae20483f55726017
> 0x
// 设置有预留余额的账户
Which accounts should be pre-funded? (advisable at least one)
> 0x799a8f7796d1d20b8198a587caaf545cdde5de13
> 0x1458eac314d8fc922029095fae20483f55726017
> 0x
// 设置区块链网络ID
Specify your chain/network ID if you want an explicit one (default = random)
> 123
INFO [03-23|17:13:51] Configured new genesis block
What would you like to do? (default = stats)
1. Show network stats
2. Manage existing genesis
3. Track new remote server
4. Deploy network components
> 2
1. Modify existing fork rules
2. Export genesis configuration
3. Remove genesis configuration
> 2
Which file to save the genesis into? (default = gethtest.json)
> genesis.json
INFO [03-23|17:15:57] Exported existing genesis block
生成genesis.json文件内容太长,就不展示了,大家自己生成吧。