We assume that trying to mine a block as of 2018 is like digging for gold with a plastic spoon. There are chances but remote if any, of success.

That being said, if someone can get the info from Getblocktemplate and decides to mine a block for luck and happen to mine a successful block that meets the target requirements.

Is it enough to submitblock with the appropriate info like this:

bitcoin-cli submitblock 000000205badedd2461eabc2c47aeac53a784fa7fc3b79f2566f27000000000000000000b3433d3f19fb599c34704bd2dede4aeab7d9f1e2658de3b30e6004d44b985411d1637c5af8e961173a3a8db3 1 being the first argument the message and the second a dummy that is being ignored by the network.

1. Should there be any response?

2. Should there be any quotes?

3. Why it always return

error code: -22
error message:
Block decode failed

4. Is there a way to send the block to a relay node that will spread it fast?

Any help would be appreciated and please do not mention again that it is impossible to mine a block alone, it is already known.

  • Welcome to Bitcoin.SE! It is better to limit to one question per ask as this assists answerers to stay on topic and keeps the focus. See How to ask? for further assistance with asking.
    – Willtech
    Feb 11 '18 at 4:35
  • Somehow I discovered that what is missing in my string is the rawtransaction hash after the message I just posted and then it returns the duplicate thingy... as it was supposed to happen.
    – abellido
    Feb 17 '18 at 17:33
  • You can post as an answer and mark as accepted to prevent the question remaining as "unanswered". It is better if you include details of how you solved the problem so that the next person can learn also.
    – Willtech
    Feb 17 '18 at 21:43

If you run:

>bitcoin-cli help submitblock

It provides some information and says in part:

See https://en.bitcoin.it/wiki/BIP_0022 for full specification.

Which states for submitblock:

This method MUST return either null (when a share is accepted), a String describing briefly the reason the share was rejected, or an Object of these with a key for each merged-mining chain the share was submitted to.

Please see this question (findable via a search for 'submitblock') for further information.

It looks like there should be quotes.

When a block is successfully submitted it should be broadcast automatically but, it should build on the tip otherwise it is irrelevant.

  • Thanks for the answer. This is clear for me, but the fact is that even if you submit a duplicated block the response should be that it is duplicated, but instead the same code -22 is displayed once and again so I was wondering if there is a problem with the structure of the message that needs to be sent with the submitblock command or that error -22 is just stating that the block is not relevant at all, it is duplicated etc. Thanks again.
    – abellido
    Feb 11 '18 at 9:02
  • Following through the linked document, it definitely looks like this is supposed to be used with getblocktemplate. I will make some enquiries and see if I can come up with something more specific for error code: -22 but for the moment it looks from your post like that means 'Block decode failed' which means an error with the input not decoding to something valid.
    – Willtech
    Feb 11 '18 at 10:44
  • 1
    @abellido a side note, each block to be submitted must include the hash of the block it is building on, the previous tip, and is therefore only valid for ~10 minutes. Also, each block to be submitted must include sufficient PoW.
    – Willtech
    Feb 11 '18 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.