1、创世块
genesis.json
{
"config": {
"chainId": 18,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x2",
"extraData" : "",
"gasLimit" : "0xffffffff",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}
2、初始化
geth init --datadir ./data genesis.json
3、删除本地数据
geth removedb
4、启动私链
geth --datadir ./data --networkid 18 --http.addr 0.0.0.0 --http.vhosts “" --http.api “db,net,eth,web3,personal” --http.corsdomain "” --snapshot=false --mine --miner.threads 1 --miner.etherbase “0xa4d8e9cae4d04b093aac82e6cd355b6b963fb7ff” --allow-insecure-unlock
5、使用本地数据启动控制台
geth --datadir./data console