submit Block issue #2415
Replies: 19 comments
-
3)用测试节点测试submit block时报header(pow(invalidnonce))
|
Beta Was this translation helpful? Give feedback.
-
用的哪个版本? v0.32.0-rc1 在使用 testnet spec 的清空下用了新的算法,和现在的算法是不兼容的。最新的 develop 分支上也是一样。 |
Beta Was this translation helpful? Give feedback.
-
HeaderTo ease PoW computation, the header is split into
The header must meet the last inequality in the following snippet:
Functions used in the pseudocode:
The block is usually referenced by the header hash, for example, in
Notice that Header and RawHeader are all fixed size structure. The serialization of them are just the simple binary concatenation of the fields in order. |
Beta Was this translation helpful? Give feedback.
-
比较容易错的地方有两个
|
Beta Was this translation helpful? Give feedback.
-
我用的版本是V0.31.1版本,所以这个版本上协议sumbit应该不是下列的方式吧 struct Header { 另外一个问题是,在最新版本v.32.0.rc-1上只有testnet采用plit into raw and nonce的方式, mainnet是还是沿用之前的结构。nonce包含在header里面,我的理解是只有在测试网的有变化? |
Beta Was this translation helpful? Give feedback.
-
0.32.0 testnet 改动是其它的,多加了一轮 blake2b。上面发的是相通的。
分成 raw 和 nonce 是序列化层面的,RPC 里是摊平的。
|
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
RPC 里是摊平的 |
Beta Was this translation helpful? Give feedback.
-
我测试了你发的这个 request,PoW 验证是通过的。建议本地使用 v0.31.1 启动 dev chain 测试
|
Beta Was this translation helpful? Give feedback.
-
Sorry, dev chain 默认是用的 dummy,我等下把调试信息贴出来 使用 dev 测试的话,需要修改 specs/dev.toml,把最后一行改成
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
已经修改specs/dev.toml, run dev chain始终会报下面的错误 stack backtrace: |
Beta Was this translation helpful? Give feedback.
-
需要修改 ckb.toml 填入矿工地址
args 改成 secp256k1 pubkey 的 blake2b hash |
Beta Was this translation helpful? Give feedback.
-
修改ckb.toml和dev.toml后dev ./ckb run还是一样的错误。 另外请帮忙在提交一下下面的rpc request看下校验结果是不是通过的,powhash<block target. 如果用这个提交校验还是能通过,我再找下问题可能的地方: rpc params = ["0xc",{"header":{"version":"0x0","compact_target":"0x1cab7a47","timestamp":"0x1720734f4fb","number":"0x326d8","epoch":"0x2370059000117","transactions_root":"0x287e60627c9e285c6def13c16195ad52dce87c3e2c317cd47a1f6f57f7c95f06","proposals_hash":"0x0000000000000000000000000000000000000000000000000000000000000000","uncles_hash":"0x0000000000000000000000000000000000000000000000000000000000000000","parent_hash":"0xee1437bfb4718b5231d00e949bc6b34216a57d3c09cf526b1c9d01e7e4131bda","dao":"0x2e4798157a2f9c2fc7ed3f82f4b4230091c6b3afcfcc330000e0b536e04e0707","nonce":"0xca7721790000000000001f9d689da"},"uncles":[],"transactions":[{"cell_deps":[],"header_deps":[],"inputs":[{"previous_output":{"index":"0xffffffff","tx_hash":"0x0000000000000000000000000000000000000000000000000000000000000000"},"since":"0x326d8"}],"outputs":[{"capacity":"0x5278f14e47","lock":{"args":"0xda648442dbb7347e467d1d09da13e5cd3a0ef0e1","code_hash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hash_type":"type"},"type":null}],"outputs_data":["0x"],"version":"0x0","witnesses":["0x590000000c00000055000000490000001000000030000000310000009bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce80114000000321f602d0725f3103774cf877be83c91ed1027b000000000"]}],"proposals":[]}] submit_block rpc result: error= { code: -3, message: 'Header(Pow(InvalidNonce))' } , result = undefined |
Beta Was this translation helpful? Give feedback.
-
还是错的,你有比对中间结果吗?看日志 pow hash 是错的 |
Beta Was this translation helpful? Give feedback.
-
可以用 https://github.com/doitian/ckb-sdk-python 对比测试一下
There's also an example method to convert from block template to a block https://github.com/doitian/ckb-sdk-python/blob/master/ckb/block.py#L45
|
Beta Was this translation helpful? Give feedback.
-
谢谢 doitian, 我之前的理解是错误的,之前eaglesonghash(headerHashWithNonce)< blocktarget,我就去做submit_block, 正确的方法应该是eaglesonghash(ckb.header.pow_hash(block['header'])+nonce)<blocktarget 再做submit |
Beta Was this translation helpful? Give feedback.
-
dotian帮我确认一下我上述表述是不是正确的,现在我这样处理后测试矿机report上来的nonce值去校验全部>blocktarget..... (V0.31.1版本node的testnet) |
Beta Was this translation helpful? Give feedback.
-
搞定了,再次感谢dotian |
Beta Was this translation helpful? Give feedback.
-
1)校验算法:https://github.com/leifjacky/ckb-gominer-demo/tree/master/eaglesong/src
2) 用这个demo里面的headerhash+nonce1+nonce2 测试过校验算法没问题:https://github.com/leifjacky/ckb-gominer-demo
Beta Was this translation helpful? Give feedback.
All reactions