192.162.0.2主机
root@i-colbyo7v:/home/ubuntu# mkdir node2
root@i-colbyo7v:/home/ubuntu# cd node2
root@i-colbyo7v:/home/ubuntu/node1# vim genesis.json
{
“config”: {
“chainId”: 12345,
“homesteadBlock”: 0,
“eip155Block”: 0,
“eip158Block”: 0
},
“coinbase” : “0x0000000000000000000000000000000000000000”,
“difficulty” : “0x400”,
“extraData” : “0x123456”,
“gasLimit” : “0xffffffff”,
“nonce” : “0x0000000000000042”,
“mixhash” : “0x0000000000000000000000000000000000000000000000000000000000000000”,
“parentHash” : “0x0000000000000000000000000000000000000000000000000000000000000000”,
“timestamp” : “0x00”,
“alloc”: { }
}
root@i-colbyo7v:/home/ubuntu/node1# geth –datadir ./data/01 init genesis.json
root@i-colbyo7v:/home/ubuntu/node1# vim start.sh
geth –identity “haha” –rpc –rpccorsdomain “*” –datadir ./data/01 –networkid 1993 –rpcapi “db,eth,net,web3” –port 8888 –rpcport 8988 console
root@i-colbyo7v:/home/ubuntu/node1# sh start.sh
eth.accounts
[]
personal.newAccount()
Passphrase:
Repeat passphrase:
“0x949ab203e37054ed0a28df237d7e715de941a262”
INFO [07-12|10:14:40] New wallet appeared url=keystore:///home/ubuntu/node1/d鈥[32mstatus=Lockedminer.start()
miner.stop()
192.162.0.2主机
root@i-colbyo7v:/home/ubuntu# mkdir node1
root@i-colbyo7v:/home/ubuntu# cd node1
root@i-colbyo7v:/home/ubuntu/node1# vim genesis.jsonge
{
“config”: {
“chainId”: 12345,
“homesteadBlock”: 0,
“eip155Block”: 0,
“eip158Block”: 0
},
“coinbase” : “0x0000000000000000000000000000000000000000”,
“difficulty” : “0x400”,
“extraData” : “0x123456”,
“gasLimit” : “0xffffffff”,
“nonce” : “0x0000000000000042”,
“mixhash” : “0x0000000000000000000000000000000000000000000000000000000000000000”,
“parentHash” : “0x0000000000000000000000000000000000000000000000000000000000000000”,
“timestamp” : “0x00”,
“alloc”: { }
}
root@i-colbyo7v:/home/ubuntu/node1# vim start.sh
geth –identity “haha” –rpc –rpccorsdomain “*” –datadir ./data/00 –networkid 1993 –rpcapi “db,eth,net,web3” –port 0417 –rpcport 8989 console
root@i-colbyo7v:/home/ubuntu/node1# sh start.sh
eth.accounts
[]
personal.newAccount()
Passphrase:
Repeat passphrase:
“0x949ab203e37054ed0a28df237d7e715de941a262”
INFO [07-12|10:14:40] New wallet appeared url=keystore:///home/ubuntu/node1/d鈥[32mstatus=Lockedminer.start()
miner.stop()admin.nodeInfo
{
enode: “enode://6f521b5865e67852765f71e175b45d732a9901f737da60d290c019bfffd9e8c7fdf5244f9d9152561b8be276badfe0941e24e2499b17c6eaf7edc4cd5a446a07@[::]:271”,
id: “6f521b5865e67852765f71e175b45d732a9901f737da60d290c019bfffd9e8c7fdf5244f9d9152561b8be276badfe0941e24e2499b17c6eaf7edc4cd5a446a07”,
ip: “::”,
listenAddr: “[::]:271”,
name: “Geth/haha/v1.6.6-stable-10a45cb5/linux-amd64/go1.8.1”,
ports: {
discovery: 271,
listener: 271
},
protocols: {
eth: {
difficulty: 2105856,
genesis: “0x29a42341a89cace1a303a40ca106b875f0ea4113a6e0a39dbbc663e9dfb8fb3f”,
head: “0x0ee3746fb2788a6572d5be2dc1acd8a70b05fa16028bc20735650ee818c6836b”,
network: 1993
}
}
}
admin.addPeer(“enode://6f521b5865e67852765f71e175b45d732a9901f737da60d290c019bfffd9e8c7fdf5244f9d9152561b8be276badfe0941e24e2499b17c6eaf7edc4cd5a446a07@192.168.0.2:271”)
在第二个节点查看
admin.peers
[{
caps: [“eth/62”, “eth/63”],
id: “01784e00b12ace0a296184425122255947f75107f48d23002512bf9f0c019302d580958a3f89ff0d70a859841fe7abba7221961648f36232da62500e886b0482”,
name: “Geth/ensNode/v1.6.5-stable-cf87713d/linux-amd64/go1.8.1”,
network: {
localAddress: “192.168.0.4:46662”,
remoteAddress: “13.92.143.154:30303”
},
protocols: {
eth: “handshake”
}
}]
admin.peers
[{
caps: [“eth/62”, “eth/63”],
id: “03fa8b460254debabd8cad7db32adc2a4caa2e1544536b4ae1882c49bcbf976bef5b84aba82d27cc40140b9a4472487a4e585f51fa331e465fcb17694b7e1e44”,
name: “Gsoil/v1.6.6-MMF-6d29146c/linux-amd64/go1.8.3”,
network: {
localAddress: “192.168.0.4:57864”,
remoteAddress: “104.200.67.105:30403”
},
protocols: {
eth: “handshake”
}
}, {
caps: [“eth/63”],
id: “0fed5c758000540ec357339af14a030df1be6ac4172fab8078e61d75821caa2daf8df5865af1706902bb59dd15afe668ff1b9319dba9b5270a9bad2777b50173”,
name: “Geth/v1.4.10-stable-6aaf5f33/windows/go1.6.2”,
network: {
localAddress: “192.168.0.4:49512”,
remoteAddress: “200.127.188.193:30303”
},
protocols: {
eth: “handshake”
}
}, {
caps: [“eth/62”, “eth/63”],
id: “81f0eda60138c7c31eeb122affba8e4b5e67ef8031612b02199c1b5178525b52cabf97397a876b4b3f56416a95745a13621bdba480c2cac209e092a4ecb742ff”,
name: “GMC/v1.4.18-stable-ea9900a3/linux/go1.6.2/music-main”,
network: {
localAddress: “192.168.0.4:51958”,
remoteAddress: “94.130.11.10:30305”
},
protocols: {
eth: “handshake”
}
}]
admin.nodeInfo
{
enode: “enode://c4a8cf55fa0ac736f5474ea7a5647bdb940da044246b82e6ba8d8181838b3e91ad6e7a8ec4d09c9a5b133b3e612832fea67165b0f50d8c8d1f4ebdbb02309e29@[::]:8888”,
id: “c4a8cf55fa0ac736f5474ea7a5647bdb940da044246b82e6ba8d8181838b3e91ad6e7a8ec4d09c9a5b133b3e612832fea67165b0f50d8c8d1f4ebdbb02309e29”,
ip: “::”,
listenAddr: “[::]:8888”,
name: “Geth/haha/v1.6.6-stable-10a45cb5/linux-amd64/go1.8.1”,
ports: {
discovery: 8888,
listener: 8888
},
protocols: {
eth: {
difficulty: 3028736,
genesis: “0x29a42341a89cace1a303a40ca106b875f0ea4113a6e0a39dbbc663e9dfb8fb3f”,
head: “0x5027b3c73f6f8fae553545832ab08e38dfa44ffc4e021c44210de133b278f7b0”,
network: 1993
}
}
}
在第一个节点查看
[]
admin.peers
[{
caps: [“eth/62”, “eth/63”],
id: “b10e41e0782dc66e3272398dbf30bed2d82c33b7c5036fc676d5f73b896d9ca4e1b49ebfc834f45dc2ed9674a8a7da73917ff00b8eea7ee7f457fc629bec15a4”,
name: “Geth/v1.6.6-stable-10a45cb5/darwin-amd64/go1.8.3”,
network: {
localAddress: “192.168.0.2:47270”,
remoteAddress: “173.68.207.125:30303”
},
protocols: {
eth: “handshake”
}
}]
admin.peers
[]
admin.peers
[]
admin.peers
[]
admin.peers
[]
admin.peers
[]
admin.peers
[]
admin.peers
[]
admin.peers
[]
admin.peers
[]
admin.peers
[]
admin.peers
[]
admin.peers
[{
caps: [“eth/62”, “eth/63”],
id: “c143a5b3e95a9e523a0d52c423585a841bd0df551a1ca4f013b7855ead94da1eb12f58408d9c1af47c68fe53849d9c4364a7ed1609105a96c27bfacc643af7f3”,
name: “Gubiq/v1.5.12-flux-43a56777/linux/go1.8.1”,
network: {
localAddress: “192.168.0.2:49418”,
remoteAddress: “94.176.234.214:30388”
},
protocols: {
eth: “handshake”
}
}]
admin.peers
[]
admin.peers
[]
admin.peers
[]
admin.peers
[{
caps: [“eth/62”, “eth/63”, “les/1”],
id: “78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d”,
name: “Geth/v1.6.5-stable-cf87713d/linux-amd64/go1.7”,
network: {
localAddress: “192.168.0.2:42090”,
remoteAddress: “191.235.84.50:30303”
},
protocols: {
eth: “handshake”
}
}]
admin.peers
[]
admin.peers
[{
caps: [“eth/62”, “eth/63”, “par/1”, “par/2”],
id: “56e67a5668c80bca33abefb24a08d211b4f8ffd720ab3c9a6fe1033c62ad2f6913cefec3beb76571f1dc3af4b1033c03c0e5aa536e53876b42a355ed74118494”,
name: “Parity/v1.6.3-beta-ccc5732-20170314/x86_64-linux-gnu/rustc1.15.1”,
network: {
localAddress: “192.168.0.2:38260”,
remoteAddress: “139.59.157.171:30303”
},
protocols: {
eth: “handshake”
}
}]
192.162.0.2主机
{
“config”: {
“chainId”: 1115,
“homesteadBlock”: 0,
“eip155Block”: 0,
“eip158Block”: 0
},
“coinbase” : “0x0000000000000000000000000000000000000000”,
“difficulty” : “0x40000”,
“extraData” : “0X2233”,
“gasLimit” : “0xffffffff”,
“nonce” : “0x0000000000000042”,
“mixhash” : “0x0000000000000000000000000000000000000000000000000000000000000000”,
“parentHash” : “0x0000000000000000000000000000000000000000000000000000000000000000”,
“timestamp” : “0x00”,
“alloc”: { }
}
geth –identity “newEth” –rpc –rpccorsdomain “*” –datadir “./cdata1” –port 30303 –rpcapi “personal,db,eth,net,web3” –networkid 1115 –rpcport 8080 console