genesis.json文件
{
"config":{
"chainId":13,
"homesteadBlock":0,
"eip155Block":0,
"eip158Block":0
},
"nonce":"0x0000000000000033",
"mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x0300",
"alloc": {},
"coinbase":"0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "",
"gasLimit":"0xffffffff"
}
据此创建创世块,并开始挖矿miner.start(1) ,再停止挖矿后,eth.coinbase主账户中就有了ether,这次得到以太的挖矿到底打包了什么交易?
参考https://www.cnblogs.com/sumingk/articles/9030469.html的配置新节点出现错误提示
配置如下命令
geth --identity "TestNode2" --datadir "data1" --rpc --rpcapi "db,eth,net,web3" --rpcaddr "127.0.0.1" --ipcpath "data1\geth\geth.ipc" --rpcport "8487" --port "30305" --networkid "29382" console
UDP listener up self=enode://c00f076d0bee45cbfbc5d301ce90c31f1cc55bbbfe5b85619e46804570013ddd18937d08550a322e087469439dc3cff39c1ce139de6535bf7cd1c16542eb32e2@[::]:30303
Fatal: Error starting protocol stack: listen tcp :30303: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
每允许使用一个socket地址。
然鹅,使用参考链接给出的命令就可以成功启动节点,dont know why...
geth --identity "TestNode2" --datadir "data1" --rpc --rpcapi "db,eth,net,web3" --rpcaddr "127.0.0.1" --ipcpath "data1\geth\geth.ipc" --rpcport "8487" --port "30305" --networkid "29382" console
JS控制台已经启动
instance: Geth/TestNode2/v1.8.11-stable-dea1ce05/windows-amd64/go1.10.2
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0
在主节点上添加新节点失败
> admin.addpeer("enode://5de4cb1aa4aaa9f2e1feb40c0a6745e1ec729313497489466509e7ed2058550c76292e630ed0e2a283a992ff7bed4b9f1f30b06e952b30e973909cdd5df7ea7d@[::]:30305")
TypeError: 'addpeer' is not a function
at <anonymous>:1:1
> web3.admin.addpeer("enode://5de4cb1aa4aaa9f2e1feb40c0a6745e1ec729313497489466509e7ed2058550c76292e630ed0e2a283a992ff7b
ed4b9f1f30b06e952b30e973909cdd5df7ea7d@[::]:30305")
TypeError: 'addpeer' is not a function
at <anonymous>:1:1
这个是因为admin.addpeer应该是admin.addPeer
与参考链接不同的地方在于主节点,重新启动一个主节点