-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootnode
66 lines (59 loc) · 4.27 KB
/
bootnode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
enode://156590cbd47139cdf5c8c99a93d8046fed590357cb5d66e13061bef707e192f08e38e11772d36a50e1c2858c1b3c3e9f90c61ea1f29420f2193f74527ba7ade6@127.0.0.1:0?discport=30301
1. Install ethereum on centos
1.1 go
yum install golang
#OR
[root@localhost blockchain]# wget https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz
modify ~/.bash_profile add go/bin to PATH
1.2
[root@localhost blockchain]#git clone https://github.com/ethereum/go-ethereum.git
make install
modify ~/.bash_profile add go-ethereum/build/bin to PATH
2. Generate key for bootnode
[root@localhost ethereum]# bootnode --genkey=boot.key
[root@localhost ethereum]# ls
boot.key go-ethereum
[root@localhost ethereum]# cat boot.key
a4e0893846323c331e8b3f9e7edf526e08a12a2719a7cb341b60c9b8b1751997
3. run bootnode
[root@localhost ethereum]# bootnode -nodekey boot.key -verbosity 7
enode://156590cbd47139cdf5c8c99a93d8046fed590357cb5d66e13061bef707e192f08e38e11772d36a50e1c2858c1b3c3e9f90c61ea1f29420f2193f74527ba7ade6@127.0.0.1:0?discport=30301
Note: you're using cmd/bootnode, a developer tool.
We recommend using a regular node as bootstrap node for production deployments.
INFO [04-02|15:51:35.191] New local node record seq=1 id=d8ac619a4775efb0 ip=<nil> udp=0 tcp=0
TRACE[04-02|15:56:16.219] << PING/v4 id=36f6cf523bff24ea addr=192.168.0.173:30303 err=nil
4. how geth use bootnode
4.1 latest build full nodes
go-ethereum/build/bin/geth --networkid 2018 --rpc --rpcapi db,eth,net,web3,ens,personal,shh --cache=1024 --rpcport 8545 --rpcaddr 0.0.0.0 --rpccorsdomain "*" --datadir /home/liwei/data/ethereum/.datadir --shh --port 30403 --ws --wsport 8546 --wsorigins "*" --wsaddr 0.0.0.0 --rpcvhosts=* --bootnodes enode://995dd2c4cba1b6a05f67b7f9093a8d10b598b1edb5ae124106fc8d98095545ba747d200b61b37b26052755f10a9de93c9216d99f0dcd6f5e814738b2dec41133@47.252.16.104:30303,enode://7fd268ad023165f5ef4072d4079f32c25e96bb950693748ce213aabdeff016fd6a880d976c816bb8938fa7d2c65693519870ed3f640ad90295347446ddc8a583@192.168.0.1:30303
4.2 connect to just bootnodes
geth --datadir ./.datadir --networkid 2018 --bootnodes enode://156590cbd47139cdf5c8c99a93d8046fed590357cb5d66e13061bef707e192f08e38e11772d36a50e1c2858c1b3c3e9f90c61ea1f29420f2193f74527ba7ade6@[ip1]:0?discport=30301,enode://e0853f854d49cc78dcd21f77b0e45f24015302f6afbe665414d4fd06de10046617e2b3cb779c0b46d8028027be7e1af573732740e71a5c32076ade0fad4f73fa@[IP2]:0?discport=30301 --rpc --rpcapi db,eth,net,web3,personal,shh,miner --cache=1024 --rpcport 8545 --rpcaddr 0.0.0.0 --rpccorsdomain "*" --rpcvhosts=* --shh console
7913d878d929bb4ee99424eb35fa4ded6af3574a8fa43939ecf0afb6045d336fac8c09ffde5713b75dd01f2b4d097130d37c9a922e7fdaec99f70173afaed2c6
remember to replace [ip1] and [IP2] with the actual IP of your bootnode
more bootnode
"enode://7fd268ad023165f5ef4072d4079f32c25e96bb950693748ce213aabdeff016fd6a880d976c816bb8938fa7d2c65693519870ed3f640ad90295347446ddc8a583@192.168.0.1:30303"
"enode://7fd268ad023165f5ef4072d4079f32c25e96bb950693748ce213aabdeff016fd6a880d976c816bb8938fa7d2c65693519870ed3f640ad90295347446ddc8a583@58.246.137.226:30303"
"enode://995dd2c4cba1b6a05f67b7f9093a8d10b598b1edb5ae124106fc8d98095545ba747d200b61b37b26052755f10a9de93c9216d99f0dcd6f5e814738b2dec41133@47.252.16.104:30303"
"enode://399c40c76434dbab54647d3310789e27bde00bb0ecff77c7d90efd76a862f99d6b2465c828d3eea59b7020329b765df7be480910e4e94fe0321e990aa6153eaa@118.190.79.30:30301"
5. prepare geth
geth --datadir .datadir init init.jso
init.json
{
"config": {
"chainId": 2018,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x400",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}
https://www.jianshu.com/p/1568a8097d7e
bootnode简化了Ethereum客户端实现,它只参与网络节点发现协议,但不运行任何高级应用程序协议。它可以用作轻量级的引导节点,以帮助在私有网络中找到对等点。
总而言之,就是一个用于节点发现或者说节点引导的轻量节点,方便联盟链的搭建~