标签:port -- limit lap png OLE 不同 over 挖矿
以太坊节点之间能够互相链接需要满足:
(1)相同的协议版本
(2)相同的networkid,所以搭建私有网络最方便的方法就是通过geth命令中的--networkid选项,设置一个与主网不同的networkid(主网的networkid为1)。这也是官方推荐的方法。
建立创世纪区块文件,是一个json格式的文件:
1 { 2 "config": { 3 "chainId": 1024, 4 "homesteadBlock": 0, 5 "eip155Block": 0, 6 "eip158Block": 0 7 }, 8 "alloc" : {}, 9 "coinbase" : "0x0000000000000000000000000000000000000000", 10 "difficulty" : "0x40000", 11 "extraData" : "", 12 "gasLimit" : "0xffffffff", 13 "nonce" : "0x0000000000000042", 14 "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", 15 "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", 16 "timestamp" : "0x00" 17 18 }
创世json文件字段解释:
初始化创世纪节点,并设置data目录:
geth --datadir data --networkid 1024 --nodiscover --port 8193 init genesis.json
启动节点,加上console 表示启动后,启用命令行:
geth --datadir data --networkid 1024 --nodiscover --port 8193 console 2>>geth.log
2>>geth.log 将一些不必要日志输出写入一个文件,防止污染显示端
接下来则进入了console界面:
可以查看、建立账户:
接着,开始挖矿:
miner.start(1),设置线程数来挖矿,这个过程启动比较久,需要不断等
INFO [11-17|10:35:22.693] Generating DAG in progress epoch=1 percentage=95 elapsed=8m25.094s
当开始出现下面指令,说明就开始挖矿了
INFO [11-17|10:49:24.476] Commit new mining work number=1 sealhash=d1f5f3…68c92c uncles=0 txs=0 gas=0 fees=0 elapsed=24.946ms INFO [11-17|10:50:13.732] Successfully sealed new block number=1 sealhash=d1f5f3…68c92c hash=da6360…3ec150 elapsed=49.255s INFO [11-17|10:50:13.732] ?? mined potential block number=1 hash=da6360…3ec150 INFO [11-17|10:50:13.747] Commit new mining work number=2 sealhash=be77e7…a128e6 uncles=0 txs=0 gas=0 fees=0 elapsed=10.133ms INFO [11-17|10:50:21.214] Successfully sealed new block number=2 sealhash=be77e7…a128e6 hash=1eea69…82c8f9 elapsed=7.466s INFO [11-17|10:50:21.214] ?? mined potential block number=2 hash=1eea69…82c8f9 INFO [11-17|10:50:21.214] Commit new mining work number=3 sealhash=9a5089…89b01e uncles=0 txs=0 gas=0 fees=0 elapsed=176.4μs INFO [11-17|10:50:25.452] Successfully sealed new block number=3 sealhash=9a5089…89b01e hash=bd0a24…916ff2 elapsed=4.237s
停止挖矿: miner.stop()
查看挖矿的高度:
最后,查看挖矿地址的eth数量:
45个,因为每挖出一个矿就会奖励 5 eth,以后会变少
标签:port -- limit lap png OLE 不同 over 挖矿
原文地址:https://www.cnblogs.com/linguoguo/p/9973268.html