搭建0号节点
参照:https://blog.csdn.net/yinanmo5569/article/details/80339031
搭建1号节点
创建步骤与之前是一样的,要保证两个节点在同一个区块链上工作的话首先要保证genesis创世区块链是一样的,所以注意使用同样的genesis.json文件来创建.
geth --datadir "data/chain1" init genesis.json
启动0号,1号节点
为了使两个节点同时启动,注意使用不同的port和rpc port.
启动0号节点:
geth --networkid 14 --nodiscover --datadir "data/chain0" --rpc --rpcapi net,eth,web3,personal --rpcaddr localhost console 2>>geth0.log
启动1号节点:
geth --networkid 14 --nodiscover --datadir "data/chain0" --port 55554 --rpc --rpcapi net,eth,web3,personal --rpcport 8101 --rpcaddr localhost console 2>>geth1.log
参数解释:
--nodiscover 关闭p2p网络的自动发现,需要手动添加节点,这样有利于我