<p>If you run:</p>

<pre><code>&gt;bitcoin-cli help submitblock
</code></pre>

<p>It provides some information and says in part:</p>

<blockquote>
  <p>See <a href="https://en.bitcoin.it/wiki/BIP_0022" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/BIP_0022</a> for full specification.</p>
</blockquote>

<p>Which states for submitblock:</p>

<blockquote>
  <p>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. </p>
</blockquote>

<p>Please see this <a href="https://bitcoin.stackexchange.com/questions/43105/how-to-use-bitcoin-cores-submitblock-method">question</a> (findable via a search for 'submitblock') for further information.</p>

<p>It looks like there should be quotes.</p>

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

CC BY-SA 3.0
2018-02-11T09:02:36.757Z
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
CC BY-SA 3.0
2018-02-11T10:44:24.453Z
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
CC BY-SA 3.0
2018-02-11T10:51:10.843Z
@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
CC BY-SA 3.0
2018-02-11T04:41:12.220Z
2018-02-11T04:59:40.387Z
2018-02-11T04:59:40.387Z
Willtech
<p>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.</p>

<p>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.</p>

<p>Is it enough to <code>submitblock</code> with the appropriate info like this:</p>

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

<p><strong>1. Should there be any response?</strong></p>

<p><strong>2. Should there be any quotes?</strong></p>

<p><strong>3. Why it always return</strong> </p>

<pre><code>error code: -22
error message:
Block decode failed
</code></pre>

<p><strong>4. Is there a way to send the block to a relay node</strong> that will spread it fast?</p>

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

CC BY-SA 3.0
2018-02-11T04:35:22.260Z
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?](https://bitcoin.stackexchange.com/help/how-to-ask) for further assistance with asking.
Willtech
CC BY-SA 3.0
2018-02-17T17:33:00.497Z
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
CC BY-SA 3.0
2018-02-17T21:43:26.130Z
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
<bitcoind><block>
Submitting a block
abellido
# Submitting a block

(Asked by: username_0 on 2018-02-08)

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.*

**Tags:** bitcoind, block

> **Comments:**
> **username_1**: 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?](https://bitcoin.stackexchange.com/help/how-to-ask) for further assistance with asking.  
> **username_0**: 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.  
> **username_1**: 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.  

---

## 1 answers

### Answer by username_1 on 2018-02-11. Score: 2

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](https://bitcoin.stackexchange.com/questions/43105/how-to-use-bitcoin-cores-submitblock-method) (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.

> **Comments:**
> **username_0**: 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.  
> **username_1**: 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.  
> **username_1**: @username_0 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.  

---

