一、下载geth
下载链接:https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.19-23bee162.tar.gz
二、本地私链配置
- 将上述下载的文件进行解压,目录文件如下
- geth(可对该执行文件建立软连接:ln -s path/to/geth /usr/local/bin/)
- COPYING
- 进入该目录创建genesis.json文件
- 文件内容为私链配置,如指定当前链id为8434,具体内容如下:
{
"config": {
"chainId": 8434,
"homesteadBlock": 1,
"eip150Block": 1,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 1,
"eip158Block": 1,
"byzantiumBlock": 1,
"constantinopleBlock": 1,
"alien": {
"period": 2,
"epoch": 300,
"maxSignersCount": 5,
"minVoterBalance": 100000000000000000000,
"genesisTimestamp": 1536136198,
"signers": [
"0x393faea80893ba357db03c03ee73ad3e31257469",
"0x30d342865deef24ac6b3ec2f3f8dba5109351571",
"0xd410f95ede1d2da66b1870ac671cc18b66a97778"
]
}
},
"nonce": "0x0",
"timestamp": "0x5b8f92c2",
"extraData": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x47b760",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
- 通过上述配置文件对私链进行初始化
geth --datadir path/to/custom/data/folder init genesis.json
三、启动私链
启动该链,其中networkid 是配置文件中设置的链ID
geth --datadir path/to/custom/data/folder --networkid 15
常用命令
后续添加