File tree Expand file tree Collapse file tree 2 files changed +60
-0
lines changed Expand file tree Collapse file tree 2 files changed +60
-0
lines changed File renamed without changes.
Original file line number Diff line number Diff line change
1
+ ## 启动说明
2
+
3
+ ### 1. 编译二进制文件
4
+ ``` buildoutcfg
5
+ make all
6
+ ```
7
+
8
+ 在` ./build/bin ` 目录下可以看到下列二进制文件
9
+ ``` buildoutcfg
10
+ abidump
11
+ abigen
12
+ bootnode
13
+ checkpoint-admin
14
+ clef
15
+ devp2p
16
+ ethkey
17
+ evm
18
+ faucet
19
+ geth
20
+ p2psim
21
+ puppeth
22
+ rlpdump
23
+
24
+ ```
25
+
26
+ ### 2.环境准备
27
+ 以本地启动四个节点为例
28
+ ```
29
+ node1
30
+ node2
31
+ ```
32
+ 将geth 拷贝到每个文件夹下,执行:
33
+ ``` buildoutcfg
34
+ ./geth --datadir ./data/ init bihs_genesis.json
35
+ ```
36
+
37
+ 该命令初始化` genesis ` 为` bihs ` 共识,并生成` p2p nodekey ` 在` data/geth ` 目录下,需要手动计算私钥的地址,并填入到https://github.com/zhiqiangxu/go-ethereum/blob/web3q_bihs/consensus/bihs/gov/gov.go#L20 ,该模块内部以round robin方式确定每一轮的leader,仅用于demo。
38
+
39
+ ### 3. 启动节点
40
+ 假定二个节点的p2p端口为2000 ~ 2001,我们暂时只开放node1的http端口,默认为8545
41
+ 首先通过下面的命令打印各个节点的公钥
42
+ ``` buildoutcfg
43
+ bootnode -nodekey ./data/geth/nodekey -writeaddress
44
+ ```
45
+ 将节点列表放入<datadir >/geth/static-nodes.json文件中,让节点主动连接和重连:https://geth.ethereum.org/docs/interface/peer-to-peer
46
+
47
+ ``` buildoutcfg
48
+ [
49
+ "enode://7b9a62ee9350e0d3a86dc29f97875542a3b0a7765c177218bcbcaa2bbb0da945feb87a137f510d6ac0c976456e0d9a624d2534298ed45e07fa455b55ebfa1832@127.0.0.1:2000",
50
+ "enode://d64121d4de07d8acf82e65a8ac7e2e331d4ff77e29496433366570cb0f632f8a60e7e64dfc0853a9f6bb3880b0436df77c9108fbd9fe762980d17d7f1ec92289@127.0.0.1:2001"
51
+ ]
52
+ ```
53
+
54
+ 启动命令
55
+ ``` buildoutcfg
56
+ ./geth --datadir ./data --networkid 121 --port 2000 --http --http.addr 0.0.0.0 --http.port 8545 --miner.gasprice 0 --mine --miner.etherbase=0x49666faD0530f3A50A48Ed473104647ca2af777D --syncmode full --nodiscover --verbosity 5
57
+
58
+ ./geth --datadir ./data --networkid 121 --port 2001 --miner.gasprice 0 --mine --miner.etherbase=0x49666faD0530f3A50A48Ed473104647ca2af777D --syncmode full --nodiscover --verbosity 5
59
+ ```
60
+ 其中` miner.etherbase ` 需要跟p2p私钥` geth/nodekey ` 对应。
You can’t perform that action at this time.
0 commit comments