-
Notifications
You must be signed in to change notification settings - Fork 1
/
poa-clique.txt
106 lines (90 loc) · 6.1 KB
/
poa-clique.txt
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
https://medium.com/taipei-ethereum-meetup/%E4%BD%BF%E7%94%A8-go-ethereum-1-6-clique-poa-consensus-%E5%BB%BA%E7%AB%8B-private-chain-1-4d359f28feff
https://hackernoon.com/setup-your-own-private-proof-of-authority-ethereum-network-with-geth-9a0a3750cda8
# Create genesis file
puppeth
# POA signers
clique.propose(addr,true)
clique.getSigners()
WARN [04-29|20:41:10.966] Header broke chain ancestry peer=e49e9bd138c9699f number=32555 hash=8706a1…6051c8
WARN [04-29|20:41:12.861] Synchronisation failed, dropping peer peer=e49e9bd138c9699f err="retrieved hash chain is invalid"
WARN [04-29|20:41:20.967] Header broke chain ancestry peer=e49e9bd138c9699f number=32555 hash=8706a1…6051c8
WARN [04-29|20:41:22.723] Synchronisation failed, dropping peer peer=e49e9bd138c9699f err="retrieved hash chain is invalid"
https://github.com/ethereum/go-ethereum/issues/17849
遇到上述问题是由于原来的三个signers在一个局域网内,其中一个移动到另外一个局域网内时出现的问题,跨网的问题尚未解决,临时解决办法:
1. 复制signer的keystore文件
2. 在局域网内生成一个新的节点: geth --datadir node3 init gensys.json
3. 把signer的keystore复制到新节点下
4. 如果新节点(node3)与已同步的节点(node2)在同一机器(出现错误的为node1),可以用copydb复制chaindata: geth --datadir node3 copydb node2
working nodes:
192.168.0.94:8502
192.168.0.94:8503
192.168.0.173:8502
可能有问题的节点
192.168.0.94:8501
node1 (8501) recover after miner.stop()
WARN [04-30|11:35:48.911] Synchronisation failed, dropping peer peer=e7c58aea1667e660 err="retrieved hash chain is invalid"
WARN [04-30|11:36:28.937] Synchronisation failed, dropping peer peer=e7c58aea1667e660 err="retrieved hash chain is invalid"
INFO [04-30|11:37:02.046] Imported new chain segment blocks=31 txs=0 mgas=0.000 elapsed=3.066s mgasps=0.000 number=103807 hash=929ec0…bca8eb age=1m18s cache=0.00B
WARN [04-30|11:37:02.317] Synchronisation failed, retrying err="block body download canceled (requested)"
INFO [04-30|11:37:02.777] Upgrading chain index type=cht percentage=72
INFO [04-30|11:37:02.812] Upgrading chain index type=bloombits percentage=72
INFO [04-30|11:37:05.411] Finished upgrading chain index type=bloombits
INFO [04-30|11:37:05.815] Storing CHT section=2 head=efd030505ce07d6e6c53f394a735ea38099041df085806de8cb928fc3c4b49cd root=60e787adfbe580ba51eba3365ea51789e6721f80ab5ed2899f943ad146f1c8e8
INFO [04-30|11:37:06.344] Finished upgrading chain index type=cht
INFO [04-30|11:39:19.709] Imported new chain segment blocks=10 txs=0 mgas=0.000 elapsed=31.103ms mgasps=0.000 number=103817 hash=1e1c18…924e43 cache=0.00B ignored=1
INFO [04-30|11:40:20.065] Imported new chain segment blocks=2 txs=0 mgas=0.000 elapsed=5.875ms mgasps=0.000 number=103819 hash=94191c…96faeb cache=0.00B ignored=1
2018-04-30 node2 broken because of dapp development use it as a node but keystore file is not on node2
04-30 晚到05-01下午 停止同步,原因是node2受应用的影响无法正常工作,解决是重新创建新的可以签名的节点(复制签名节点的keystore),
经验教训是签名节点的工作要单纯,不能用于支持dapp的节点也不要为light节点提供服务lightserv=0;Dapp只需挂在light无签名权力的节点上即可。
WARN [05-01|14:56:44.991] Failed transaction send attempt from=0x2dc18eE946dB25663aE25160b632B290d2499c17 to=0x093A0Ed738B65ed34f2A37a2D44c5e3Cd0D0DD45 value=4985118219999974925 err="could not decrypt key with given passphrase"
WARN [05-01|14:56:45.009] Failed transaction send attempt from=0xE64b3A41601F3731B223be1d1235559c823A27fb to=0x093A0Ed738B65ed34f2A37a2D44c5e3Cd0D0DD45 value=1038382975791001548534 err="could not decrypt key with given passphrase"
how to fix:
stop node2 and create a new node4 with the signer of node2
1. geth --datadir node4 account new
2. geth --datadir node4 init devnet.json
3. copy node2/keystore/* node4/keystore
4. copy node2.sh to node4.sh and change node2 to node4
5. start and sync
Experience:
1. Signer should not provide RPC for dapp access
2. Signer should not provide a lightserv
Finnally got nodes sync cross diefferent LANs as fast as light, the key is to make sure no error on any signer node . 05-01-02
Tested use metamask to transfer ETH and FAX .
#not generate empty block
#solution 1
https://ethereum.stackexchange.com/questions/63686/poa-private-net-keeps-mining-blocks-at-high-rate-with-no-transactions?rq=1
et BlockTime to 0. With that, mining will be done only when needed. For example :
"clique": {
"period": 0,
"epoch": 30000
}
https://github.com/ethereum/go-ethereum/pull/15323
For 0-period clique miners, commit new mining work whenever a transaction arrives
This allows each transaction to be instantly included (this may need tuning though).
// For 0-period chains, refuse to seal empty blocks (no reward but would spin sealing)
if c.config.Period == 0 && len(block.Transactions()) == 0 {
log.Info("Sealing paused, waiting for transactions")
return nil
}
https://github.com/ethereum/go-ethereum/blob/master/consensus/clique/clique.go#L600
#solution 2
https://ethereum.stackexchange.com/questions/45067/geth-clique-consensus-skip-empty-blocks
https://ethereum.stackexchange.com/questions/3151/how-to-make-miner-to-mine-only-when-there-are-pending-transactions/3152#3152
need use console, daemon will not work
if you run geth in the background, you must geth attach node1/geth.ipc and execute
loadScript('skipempty.js')
var mining_threads = 1
function checkWork() {
if (eth.getBlock("pending").transactions.length > 0) {
if (eth.mining) return;
console.log("== Pending transactions! Mining...");
miner.start(mining_threads);
} else {
if (!eth.mining) return;
miner.stop();
console.log("== No transactions! Mining stopped.");
}
}
eth.filter("latest", function(err, block) { checkWork(); });
eth.filter("pending", function(err, block) { checkWork(); });
checkWork();