I recently took on the challenge of building a working BTC miner on solo.ckpool.org. Yes, I know that the probability of finding a nonce is close to 0 (especially given that the process is ongoing and not just the nonce). However, we only focused on iteration through nonce search. A space for simplicity.
Now I want to test whether block mining actually works. But there is a caveat: How do I find blocks with known nonces that I can test against my miners?
In a perfect world, you would use the same format that the pool provides (JSON) so that you can test the entire process.
"result":((("mining.notify","716b514d")),"b3b4c76e",8),"id":1,"error":null
...
"params":("64851638000e64a0","ea9b003e15e90810e28b429926aab824428f263d00007e570000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff3503dfcf0c000435db1f6604880b42150c","0a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff03749ff72a000000001976a914c987a18977a2139835193b3df2eea097f834966888ac6a7be0000000000016001451ed61d2f6aa260cc72cdf743e4e436a82c010270000000000000000266a24aa21a9ed9e5037be4e44df5dc4e8ba01b1ce40d5b234a6cf219951d9ad0e7ff6d839369300000000",("f0a795e17eb9c4ab7e6106c46fd35d254a032749fcbe536b3035376fdd3869ab","84265449c5b8f1ec096432562e0386f2ca159ba22a092bbad363c5599c3512a6","d91e4922831da4ef4f4151bbc66c7f4087ae34578f579ae771a343d0ffbeafd3","fc1fb85d56bcde6c01f856f083407d54af4569c1cdc4c3d790a85457a6170b22","30ed434482df77cd1292ad4f15b3233846e9e455f1bb463bb8e128b28e22449f","0205f58e1715b8e9f87df5c7f3a2006394f92be064110c20e78df8562560e3d8","e3ff80576d069cd29392bc1e9220d16f5ab6d9783c3f71cdc112ec661f7150ec","c6857a7c5f1c5d979f94b8d6c0d0d099e92a9dc9dd093fa94840807584855e5c","7d98a0da3a3566ce9add97aaa193dc6e94a6f29367bb4af38e175b991deae66f","99dadd674098d37eba4f3464e3b32d7894269598f8ec9f874b9e06cdef357f19","b1e11113d0575f1253cef2e84d291cc1668bbd268930faf45760bea295c37dd7","3bafb324838086a13c0b2baa3ffa9f582fd279e1d490d26ad98ab45cd422638c"),"20000000","17034219","661fdb35",true),"id":null,"method":"mining.notify"
Is there a way to find these payloads with a known nonce that I can test run and verify that the miner is actually working properly?
Here is the miner’s dump. nonce=0
:
(POOL) "result":((("mining.notify","716b5c6a")),"22bdc76e",8),"id":1,"error":null
(POOL) "params":(10000),"id":null,"method":"mining.set_difficulty"
(MINER) "params": ("xxxxxxxxxxxxxxxxxxxx", "password"), "id": 2, "method": "mining.authorize"
(POOL) "params":("64851638000e64ac","ea9b003e15e90810e28b429926aab824428f263d00007e570000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff3503dfcf0c00049ddc1f660458ebb6080c","0a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff03b759b02b000000001976a914c987a18977a2139835193b3df2eea097f834966888ac8640e4000000000016001451ed61d2f6aa260cc72cdf743e4e436a82c010270000000000000000266a24aa21a9ed347f806a639a87c0b171ef36e1ab4e81564665e5353c1a5caf9c1c8a0c03298300000000",("7fca930a2e370625f4cb24b9763e6f0667828e7c233a2d37b7c54285fa49f119","418bc7ce7fbdcf1f742cefcc9aadaef8e31f132d0f28bdc0ea4ecb76dbef0ad6","5df7439f79bca1057879d7506c6bf1fe9042f988cdc2ae2009b34d955fb477e1","2916da24579bc401a53e9f4ffb1b2322976ef000baa7f99552cf676162f54a8a","59116d60b2001be857f1a161db5ef9a6b0db5303341e4cf8748278ec81580420","c088f467340da81128cb4b58f13686a0875774ff3f9781739f08011b3b7403af","e79477f040fcf6848972b8db88c9a7fbf975f3262d68d595e41793f9f0918fb4","b6625d7ccc2691629c079d1a10a389e28c2da23ceb78cc0ed4787474caee8aa3","aa230a07d0ba76d04bf91f2b1d6cc039c5067802c842fcb5480833b3c16a081a","7ccca8ab15fe2cfd694ef733568b76b7cdac1998acebee4e2686e95c370aeac9","d3723ac7cbeed566592b092f5dd1580c7afd5cf0906aa3b15d907e8c3bc35b50","82d763f68423528437110c57220c19881edc5e619dc06c369fb0e0cd8d9c9831"),"20000000","17034219","661fdc9d",true),"id":null,"method":"mining.notify"
Nonce: 0
Nbits: 17034219
Version: 20000000
extranonce2_size: 8
extranonce2: 0000000061eb2c75
Previous hash: ea9b003e15e90810e28b429926aab824428f263d00007e570000000000000000
Target Hex: 0000000000000000000342190000000000000000000000000000000000000000
coinb1: 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff3503dfcf0c00049ddc1f660458ebb6080c
srtExtraNonce1: 22bdc76e
coinb2: 0a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff03b759b02b000000001976a914c987a18977a2139835193b3df2eea097f834966888ac8640e4000000000016001451ed61d2f6aa260cc72cdf743e4e436a82c010270000000000000000266a24aa21a9ed347f806a639a87c0b171ef36e1ab4e81564665e5353c1a5caf9c1c8a0c03298300000000
coinbase: 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff3503dfcf0c00049ddc1f660458ebb6080c22bdc76e0000000061eb2c750a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff03b759b02b000000001976a914c987a18977a2139835193b3df2eea097f834966888ac8640e4000000000016001451ed61d2f6aa260cc72cdf743e4e436a82c010270000000000000000266a24aa21a9ed347f806a639a87c0b171ef36e1ab4e81564665e5353c1a5caf9c1c8a0c03298300000000
coinbase_hash_bin: d6dfba1b68836c207e1ff9ea8f5d274e0d51cea60b646a45b0170cde58ef1f40
merkle_root_little_endian: 1c6165f085721f982acae5d2a52ba9b5040ba323b90205e846e80a8cb10031f9
blockHeader: 20000000ea9b003e15e90810e28b429926aab824428f263d00007e5700000000000000001c6165f085721f982acae5d2a52ba9b5040ba323b90205e846e80a8cb10031f917034219661fdc9d00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000
blockheaderhash: b9b7da2b691d2f1fcf38e135963eea36610d3ebfc3f8ebf4d81fe4e7ed7a8b20
Thank you in advance for your feedback on this.