block decode failed (-22) error solo mining while submitting block

0

Hi I have developed hardware/software to mine bitcoin it's working and getting me the results (getting nonce since the design takes only .2sec to complete the task)i am trying to submit in my local bitcoin wallet its error message is

Traceback (most recent call last):
  File "./submit_b.py", line 282, in <module>
    rpc_submitblock(rpc_con(),block_miner(rpc_getblocktemplate(rpc_con()),binascii.b2a_hex('Bitmatriz'.encode()).decode(), "19DvxDw7zfiBDcvZCyhboNjJ2VW6d2mD2P"))
  File "./submit_b.py", line 124, in rpc_submitblock
    message = rpc_con.submitblock(param)
  File "/home/bitmatriz/.local/lib/python3.6/site-packages/bitcoinrpc/authproxy.py", line 141, in __call__
    raise JSONRPCException(response['error'])
bitcoinrpc.authproxy.JSONRPCException: -22: Block decode failed

Below is the data generated from the script

000000200b19cbe6b745a8ecc66bdd8e23cc84159701fdfd7dae5300000000000000000014e87cb06ddef0a2c7d74c1c3af82bcde4da560624fb4d3462e093a92b68c329bbb9965adc975d170fd01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff110364cd074269746d617472697a43f740c0ffffffff014b46df011976a9145a3308e6ef31335c46c807a23134dc2142bd4dd288ac000000000200000001cd796d7718307fd1107dac22d847e256e3f5573244fdb407e1828395c541cff5010000006b483045022100a11cdfcc5b93e79dc20a8cc94aef3f0176642fba8ba1aa8b610711ef2d233ff602205d9ab01f4461b7244fa4516ed8e4a71dd169ad0c8d61a74ef689638a9fa9770c012102f07c0940fcb4487c83cb4c2712c65d50d43778dfc2aa2e41afe1ad2fc8284aeaffffffff020051e90b000000001976a9143da76c020f5010b668e1831abc41b74b6759a48b88ac1163d11a000000001976a91432eb719e44987559d33e324edc03922c9f45ff9388ac0000000002000000013a916bdec8b9825e8244ac9be4589f561e98e9091914e0e2514c4dd8579cfddd010000006b483045022100e763bf000a6d463b2efdd974e66cad650e2cf0099beb4c363be8fe04b151cd5602201d36992639ead345ab17ccf5a8017b6d5b0291d424f6559a65edf77f7ea2193f012103409891d09a784928c14c94798b8b772705a1555cee27a312878ed0f3de7b177dffffffff022080df11000000001976a9143da76c020f5010b668e1831abc41b74b6759a48b88acc9a72507000000001976a914df1451dc57e93b6effd78426d8bbe624fc8e2c9788ac00000000020000000278a17fb798fb15efd6fdba6a8c368618598a9e90a2841e13b02d42a8ace45b79000000006a4730440220693536f3f1778a5bfd753e65e3400ede2c89db95454643517329436f46873ce602207b55054a899e34dc974055bb9f036ae68d0cf9ceab09757d3a54e0851292e663012103112149665e33e8615678ef32ac70a31f6e21e5d63f102ef612eaa291b7c8ea3ffeffffff2a3e97ee64583bd8309ca3f036b5ef449471052b20127b9736528f5218ddbc6f5e0000006a47304402205ee2d6638b8ca5351ce3f4dcf85ceab1e908874d8b0e96f03a2e6203e5f3c973022004a9959d502c75e4edb80902f6ad5c94d6cd294d99a42bedaf317859b2b7de38012103d79f0989e26b0fd05b0c26890c68eb8462fa64143ac5461cf9cf826e87a499d9feffffff02a3d90b00000000001976a914a6517ba1358cd2c8bd9efeea034666cff705ffb588ac232620000000000017a91429fe11644440db7358be3797e8e646aba4854fea8761cd07000200000003ecd72647b39d7e6501042c03331d52621f2baf290f0fcbae28e129605258a5a5530100006a47304402204f94267ff3d32027eebed4970fe6a3ad0777deb42901ef3c2ad561daefd88c8e022027168797fb959036ca795a66e27fbb6cebbac8f00a5ac9dbc6d6b70f4c4b6350012103f16891bc25b64d37ce1a3f0a226025224e74de16c74d585cb6862cad2a2b3891feffffff38638063f840f8ddb625c48af30ccbe5b4c0be57a7f18158c849b9628690c8607b0100006b4830450221008ed743837a4f64b68e2a6892b813990c40c7ffa9c35e5c434812d66a48189eb302207861fc3bf3369ceb9d290223cce89997a2fd66792a3c492f390fe1bba233ba34012103408e1981ee02bff847768056d5f2ff3d641074a26561fb1a82f60d0a50d1f36efeffffff3f1e7f5b0f6cbf3ac58d0b2cfb2927d15517af78e690c65a631f122fba205bdb010000006a473044022056c44992ef795ef6dfe8fbb635a25581b646e8c9a0718f4e51f5c49b81fab6af0220511f7159c352c553c4694e7bb9e9653f0148221bf9832e95a231d3cff602c16f0121023f053b81f7c056db9d3cfa1e43b63067c72b757903b745fca4d1944f998a65b7feffffff02c0af1c00000000001976a914825558a5137ad409de081d1bab50d2c81aa114a488accf790a00000000001976a914d7476512c5cce597952dab791507e985cbbeaee888ac61cd0700020000000326ff1010699c89dfd699d9ff902d143fe8a787c023ff2af04865d226e47fc1e5550000006b483045022100c527eeb2c90170093e93dd8f20c64337dfd0daa939f5d648db872f6ec064627702206f35bd8fb109cb3a1836853acc3f9632b79905828e882c1361710358a79fdd250121024f37e81077a802bc809ce265648ac286572ed1d5fd252af2fc63ffe73c87431efeffffff637bcb526b59974c8665922a3597a743792781686d0358f493a25e99c4d4a9fc010000006a4730440220469d67f1f0b55cdd33ea2a150b0ff1c565a2d7751e905f3c020577abd6c15768022033d89aa192ae4f084284f4900a15f03c830762d5b44c91b38b60846f116b74a3012103781c5037b192928351b09b5e1bb4ab5fc0852089913069bbab1c86e271a9e82ffeffffffae035761ad9e625ae4a48d877f56d667febb16e2833119f2c30db7f7be3208a9380000006a473044022022397103c17ba4699bdd6bb8dac2358d604bd8aa7f0674a0460388009d3b6a00022048b8100c7a41e897e37d6a7d1127be318d74392a47654408b9fa42b50856d2c901210342971a8d79776e84673b1b6602670fda7f90a6f89fa1742a376060f120dadff4feffffff02c6780a00000000001976a914f53526f0a5cf575fccb7246efb4eda006fcae7aa88ac5c3b2d20000000001976a9142ea84977ee79a11c425e7acb4252e7aba48be9a488ac61cd07000200000002ac33eb581f2cb876d19dba0378a91b09db45d8bb2bab9146039b816b4509f339390000006a47304402207404eafa0392b466558bcf7e4d3014c13c5b54dbf343cb627bbd06e846c395c4022036bd8121f4dc7d220e7450120ababa99b3fbe0c764365207fd82f7799dc6e18a0121025df903b4a47675330267a1fca1488ade240d3068002d0e1ad96b508c69ae2b57feffffff5f377e25b750102242b6f202a1543d74d259282514fd5b6031f58c3e879f4658110000006b483045022100d517a1301bbadd8f6565bb089ddddfacff8bc5a7ab6e16a57a117192836dfc0602203dc0773f380a1f4b8e701bd418b3fdad36dd715291baa0595de2cf2f532b41740121031cc432fb07d5844e0c8f7d5d41fc61a20912cea6722ed9435be7b1ea0fea53b2feffffff0224a60f00000000001976a914584ab36305080d7949e1c09ec7a8786d0728193e88ac20d50b00000000001976a9147a623d6db1e73a2417c6b2c46ab8da023161426388ac61cd0700020000000238638063f840f8ddb625c48af30ccbe5b4c0be57a7f18158c849b9628690c860b50000006b48304502210090925ad8c919efa945bbf3f7a43bcff97aba6a51b428660e50b06bc28dcac54c0220589b20a6c5c05d262e26b8e02b9cf0e164ff4ce8a2b6a1c34ce0d46950dab21d012103a2e1fc8239500ea0fe10adff2e28a526e8c7aa4dd0b93d25ad71ff3f513cf066feffffff965eaa5a0709f4e24253dce250fe35b1089e65f98638c5711f1f783bc0eb8368010000006b483045022100b8d39ec9e47c3f9cba1c4713e57d0ea65c229252d5e441f1dc9febdb9489767902207750f4ee26e1ae4f50cc0596e59aae0dbc7973504d63a0179fea1b970d4d961601210361693c29640428069fd93fcac5e81defc8c49238e9a16ebd26e84ed66ea2beb4feffffff0221db0b00000000001976a914fe64ac29365b7e3278603aa133102d2957d274b288ac90ab1e00000000001976a9148eb23a0151482cdccde9577d6dad727b0148077e88ac62cd070001000000019668f4943ba630c233632d22513e8cacd065dca41f38d6815da06b70c118e915000000006a4730440220505b58dc693411127b43bf9d0d575e292d8714f8a61d0873be4da01059c7d4da02203fe8811a37e81570e7f2a9ed9f3a0ef78f4edda38327103281702a3a2d89a40401210289cd7d41dd230abf51e7e7f94d1a3dc7e08eb25a0e11a5f4d032d2620ec01e7effffffff029d580600000000001976a914d9f950ac7ea4853df9ff3c8598f5de5b615fb24f88ace8123c00000000001976a914db7459757a54efff1f749162ae5a955e1d3821e588ac000000

Austin Dominic

Posted 2018-02-28T02:29:21.147

Reputation: 1

Can you please copy and paste the output as text, instead of a screenshot image? It will be much easier for people to look at. If you indent it four spaces, it will show up as "code".Nate Eldredge 2018-02-28T04:53:54.447

Answers

0

The first problem is that the output of your script has an odd number of characters which means it is not valid hex. I'm guessing that you forgot a 0 when you copy and pasted it. So adding a 0 to the front of the data, there's still several things wrong with it.

If this is meant to be a Bitcoin block, then you are missing one of these fields in the block header: time, bits, or nonce (I can't tell which because all three are 4 bytes).

Then after that, you have serialized incorrectly the compact size unsigned integer for the number of transactions. Firstly, it looks like you are missing a byte for it; you have 0xfd which indicates that the number should be two bytes. However the number you have put is only 1 byte. Secondly, that integer is in the wrong order. The serialization itself should have 0xfd first, and then the number that follows in little endian.

Next in your coinbase transaction, it looks like you have missed the segwit marker byte.

These are the things I see wrong with the beginning of your block; something else may be wrong further in the block.


Of course I could be completely wrong if the format of your block is not the same as Bitcoin's.

Andrew Chow

Posted 2018-02-28T02:29:21.147

Reputation: 40 910

Thank you! I built the complete structure using https://raw.githubusercontent.com/vsergeev/ntgbtminer/master/ntgbtminer.py Let me know if anything is wrong in this

Austin Dominic 2018-03-01T06:45:18.927