Mining Pools – Proof-of-Work (PoW) result calculation issues
I’m trying to calculate a Proof-of-Work (PoW) result through the following actual communication between a miner and a pool:
MINER: b'"id":1,"method":"mining.subscribe","params":("NiceHash/1.0.0")\n'
POOL: b'"error":null,"id":1,"result":((("mining.notify","00005b451"),("mining.set_difficulty","00005b452")),"00005b45",8)\n'
MINER: b'"id":2,"method":"mining.authorize","params":("andrei.worker","")\n'
POOL: b'"error":null,"id":2,"result":true\n"id":null,"method":"mining.set_difficulty","params":(524288)\n'
POOL: b'"id":null,"method":"mining.notify","params":("202898","4ea8f400356422a1a193c0ab9bd5b5f998f2e7560002026b0000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff5603e5870c194d696e656420627920416e74506f6f6c20ce015d02ac8f5571fabe6d6dc332e1cdef2292450aba974620c3df12d14af5f79c12628376e38bf47a3272dd1000000000000000","ffffffff045e7d36340000000017a9144b09d828dfc8baaba5d04ee77397e04b1050cc73870000000000000000266a24aa21a9ede1c04d8fcc3154a2ca7afba52cddd1c4305fb0ee357e69bf543ae0ef94a8056c00000000000000002f6a2d434f524501a37cf4faa0758b26dca666f3e36d42fa15cc01065997be5a09d05bb9bac27ec60419d0b373f32b2000000000000000002b6a2952534b424c4f434b3a1c59c66bebd4b2bb725fbd30dc9385e42c496e44fc597216cbeed124005a09dd00000000",("a9820dd91e103c45f251b185badaccabd27afd527362492305bf222761871a64","2aa15df2796085fe280a7c8b4320d6c987c7601961dcd3cd273da8ac3ff72f70","1bcfc4e48c4f2afc824cd3802f09943cf9188bd33bf10ef3625ea18386cb8917","254bf735031a47e650b0a870ce613f95258fbe76006e591cc217f706a61da2b1","10b6c1aa6e5f1d5c4050d9f4d2b1766745a93fa1b637016fdf8f54f74c3aa006","779079c6f49dd65f1fc54975700d3f1c0bbb74ef946cd5695595c7a7960a3fab","b967fee5300b254e89f7a4a4add33e8c7b70fefe3bed4a028c42cac82bf8689d","923e5a0bee85aeb146462a0f403338cd5796faabb80dd2e912388a5a6188d2b8","9b36c027eae29d4abbf4ee10b5cf347d7ff4d5f1147392fa3ff646ab43e45588","6bbedd77ef275962a558cdde02c137b4b889ac2ef19b68ff4f2fcb1a15578901","1290d6c11d8e1191dcec5fc6653e76232a518973572b0bb65c8273e7af20cecf","3e3d23813f2b4ecf383e0fd14115524ff2c7d34c32e7b55504c452cc9747faa0"),"20000000","17042e95","657b9148",false)\n'
MINER: b'"id":3,"method":"mining.submit","params":("andrei.worker","202898","fc1f62c8cd3ae900","657b9148","9ffad771")\n'
POOL: b'"error":null,"id":3,"result":true\n'
I’m struggling to get correct PoW results for shared submissions.
Here’s what I’ve done so far:
- Coinbase Transaction Calculation:Concatenate coinb1, extra_nonce1, extra_nonce2 and coinb2:
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff5603e5870c194d696e656420627920416e74506f6f6c20ce015d02ac8f5571fabe6d6dc332e1cdef2292450aba974620c3df12d14af5f79c12628376e38bf47a3272dd1000000000000000
+ 00005b45
+ fc1f62c8cd3ae900
+ ffffffff045e7d36340000000017a9144b09d828dfc8baaba5d04ee77397e04b1050cc73870000000000000000266a24aa21a9ede1c04d8fcc3154a2ca7afba52cddd1c4305fb0ee357e69bf543ae0ef94a8056c00000000000000002f6a2d434f524501a37cf4faa0758b26dca666f3e36d42fa15cc01065997be5a09d05bb9bac27ec60419d0b373f32b2000000000000000002b6a2952534b424c4f434b3a1c59c66bebd4b2bb725fbd30dc9385e42c496e44fc597216cbeed124005a09dd00000000
Coinbase ID calculation (sha256d):
3ac2f875ead34134a9a5d5310e6fa0cf24698f346a23e5a0f3756c4247bd975a
Building a Merkle path:
Using Coinbase Transactions and sha256d with Merkle Branch:36f8d17aaf51a19d72f75ea2e96c4895f063ecf87bb34afa019dbc49746e022c
Configuration header:
Concatenate version, prev_hash, merkle_root, ntime, nbits and nonce:
00000020
+4ea8f400356422a1a193c0ab9bd5b5f998f2e7560002026b0000000000000000
+36f8d17aaf51a19d72f75ea2e96c4895f063ecf87bb34afa019dbc49746e022c
+48917b65
+952e0417
+71d7fa9f
Final SHA-256d in header:
93b1d19253e332538fc73b62f06f480ab45e5fb85e4a5481b531895f00b5b643
The expected result should be a hash with leading zeros, but we don’t know that.
Can someone help me identify where I am going wrong in my calculations?