使用geth搭建私有链,搭建完后通过miner.start()挖矿获得以太币。
问题: 1.但重启私有链后,账户还存在但账户内余额为0。 2.重启私有链后,保存区块数据的data文件夹变小
启动私有链命令为:geth --datadir ./data --networkid 17173 --port 30303 --rpc --rpcport 8545 --rpcapi 'db,net,eth,web3,personal' --rpccorsdomain '*' --gasprice 0 --allow-insecure-unlock console 2> 1.log
创世区块配置为:
{
"config": {
"chainId": 666,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"ethash": {}
},
"nonce": "0x0",
"timestamp": "0x5ddf8f3e",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x47b760",
"difficulty": "0x00002",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": { },
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
下面给出命令执行截图: 1.开启私链后进行挖矿及挖矿结果截图: 2.重启私链后查询账户余额截图: 可以看到两次查询中控制台显示的at block都是0且时间是一样的,不知道是不是因为这个原因导致的