关闭旧网络
ps -ef | grep geth
kill -9
/opt/gopath/src/github.com/go-ethereum/build/bin/geth removedb
rm -rf /root/Ethereumdata
重新启动:
/opt/gopath/src/github.com/go-ethereum/build/bin/geth --datadir "/root/Ethereumdata" init /opt/gopath/src/github.com/genesis.json
nohup /opt/gopath/src/github.com/go-ethereum/build/bin/geth --identity "myethereum" --http --http.addr "0.0.0.0" --http.corsdomain "*" --http.api "eth,net,web3,personal,admin,shh,txpool,debug,miner" --port 30303 --http.port "7545" --nodiscover --maxpeers '5' --networkid '123456' --datadir '/root/Ethereumdata' --txpool.accountslots '16' --txpool.globalslots '5120' --txpool.accountqueue '64' --txpool.globalqueue '1024' --miner.gaslimit '30000000' --miner.gasprice '10' --miner.recommit '13s' --log.json --trace --vmdebug --allow-insecure-unlock >> geth.log 2>&1 &
/opt/gopath/src/github.com/go-ethereum/build/bin/geth attach geth.ipc
personal.newAccount('yhj123')
personal.unlockAccount(eth.accounts[0],'yhj123',0)
miner.setEtherbase(eth.accounts[0])
设置钱包账户为miner账户
miner.setEtherbase('0xA98D40001cf6f3859dE29fbFDFE13eBa2C940601')
balanse=web3.fromWei(eth.getBalance(eth.accounts[0]),'ether')
miner.start()
miner.stop()
genesis 配置文件
```handlebars
{
"config": {
"chainId": 10086,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"berlinBlock": 0,
"londonBlock": 0
},
"alloc": {},
"coinbase": "0x0000000000000000000000000000000000000000",
"difficulty": "0x20000",
"extraData": "",
"gasLimit": "0x1c9c380",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x00"
}