首先在第一台机器168.192.0.5
mkdir private-geth && private-geth
vim genesis.json
{
"config": {
"chainId": 3434,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x400",
"extraData" : "0x123456",
"gasLimit" : "0xffffffff",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00",
"alloc": { }
}
初始化创始块
geth --datadir ./data/00 init genesis.json
进入geth平台
geth --identity "newEth" --rpc --rpccorsdomain "*" --rpcapi "personal,db,eth,net,web3" --datadir ./data/00 --networkid 3434 --ipcdisable --port 33333 --rpcport 4444 console
admin.nodeInfo 得到 enode: "enode://ef572405a99d655f41ec645a780e23b8dc243c1297c2f7b9da416ffbe79dc15298d2e31a78d903b3cb611d417287e17f5307971213b748d16929ff476bb8ea6c@[::]:33333"
在这里制作成镜像haha1
第二个节点 由haha1镜像创建主机成为192.168.0.6
cd private-geth
geth --datadir ./data/01 init ./genesis.json
连接第一个节点并进入geth平台
geth --identity "newEth" --rpc --rpccorsdomain "*" --rpcapi "personal,db,eth,net,web3" --datadir ./data/01 --networkid