<blockquote>
<p>Q1. Is the command <strong><code>bitcoin-cli submitheader</code></strong> or <strong><code>bitcoin-cli submitblock</code></strong> ?</p>
</blockquote>
<p>Blocks are more than just a header, they contain transactions too. <code>submitheader</code> just takes a header, not the transactions. So it is not sufficient to just submit the header in order to relay a block to the network. Thus the correct RPC is <code>submitblock</code>.</p>
<p>As far as I can tell, <code>submitheader</code> does not actualy send the header to any peers either, while <code>submitblock</code> will.</p>
<blockquote>
<p>Q2. Whatever the answer is in <strong>Q1</strong>, is the data to be passed to be formated within <strong><code>&quot; &quot; (double quotes)</code></strong> or can it be passed without the need of <strong><code>&quot; &quot; (double quotes)</code></strong>.</p>
</blockquote>
<p>If you are using a typical shell, it does not matter. If you are doing it programatically, then do not use double quotes.</p>
<p>bitcoind expects the argument to either RPC to be a string, although it is not receiving the string directly from your shell but rather via HTTP from bitcoin-cli. bitcoin-cli will take the string as provided by the shell and format it for use in the JSON-RPC protocol bitcoind uses. If you are writing a program, you need to follow the JSON-RPC protocol for how to format data.</p>
<p>But when using bitcoin-cli, it takes strings as provided by the shell. As the argument to both <code>submitblock</code> and <code>submitheader</code> is a hexadecimal string, there is no need to use any form of quotes (either single <code>'</code> or double <code>&quot;</code>) as there are no special characters in hex strings that shells would need to escape or otherwise be informed to not interpret. However, single or double quoting the string is completely harmless because shells will interpret those quotes and remove them before providing the string to bitcoin-cli.</p>

CC BY-SA 4.0
2021-12-10T05:16:22.017Z
Thanks for this explanation.... Helps a great deal
AncientTides
CC BY-SA 4.0
2021-12-10T05:23:50.467Z
The simplicity of your explanation is gratifying and very clear... Would you mind dropping your btc address for a `Thank You` token once I make a profit? It doesn't have to be now though, I could comment here when i'm all set.
AncientTides
CC BY-SA 4.0
2021-12-10T02:31:16.610Z
2021-12-10T02:31:16.610Z
Ava Chow
<p>Basically I am trying to know which command is to be used when attempting to submit a block to the network (amongst other things).</p>
<p>Q1. Is the command <strong><code>bitcoin-cli submitheader</code></strong> or <strong><code>bitcoin-cli submitblock</code></strong> ?</p>
<p>Q2. Whatever the answer is in <strong>Q1</strong>, is the data to be passed to be formated within <strong><code>&quot; &quot; (double quotes)</code></strong> or can it be passed without the need of <strong><code>&quot; &quot; (double quotes)</code></strong>.</p>
<p>I personally lean towards Q1 being <strong><code>bitcoin-cli submitblock</code></strong>  but then again I am to send the block header combination that generates a successful hash to the network for verification   (<strong><code>0000002fa7931a0f87d08733874323.............</code></strong>) so I start thinking if <strong><code>bitcoin-cli submitheader</code></strong> is the right API call.</p>
<p>This is very Important. I wouldn't want to successfully mine a block and be unable to submit it... That would be just hilariously sad o_o</p>
<p>Thanks in advance.</p>

<bitcoind><client>
Which rpc command is used when solo mining to submit successful hash <= target?
AncientTides
# Which rpc command is used when solo mining to submit successful hash <= target?

(Asked by: username_0 on 2021-12-10)

Basically I am trying to know which command is to be used when attempting to submit a block to the network (amongst other things).

Q1. Is the command **`bitcoin-cli submitheader`** or **`bitcoin-cli submitblock`** ?

Q2. Whatever the answer is in **Q1**, is the data to be passed to be formated within **`" " (double quotes)`** or can it be passed without the need of **`" " (double quotes)`**.

I personally lean towards Q1 being **`bitcoin-cli submitblock`** but then again I am to send the block header combination that generates a successful hash to the network for verification (**`0000002fa7931a0f87d08733874323.............`**) so I start thinking if **`bitcoin-cli submitheader`** is the right API call.

This is very Important. I wouldn't want to successfully mine a block and be unable to submit it... That would be just hilariously sad o\_o

Thanks in advance.

**Tags:** bitcoind, client


---

## 1 answers

### Answer by username_1 on 2021-12-10. Score: 1 | Accepted answer

> Q1. Is the command **`bitcoin-cli submitheader`** or **`bitcoin-cli submitblock`** ?

Blocks are more than just a header, they contain transactions too. `submitheader` just takes a header, not the transactions. So it is not sufficient to just submit the header in order to relay a block to the network. Thus the correct RPC is `submitblock`.

As far as I can tell, `submitheader` does not actualy send the header to any peers either, while `submitblock` will.

> Q2. Whatever the answer is in **Q1**, is the data to be passed to be formated within **`" " (double quotes)`** or can it be passed without the need of **`" " (double quotes)`**.

If you are using a typical shell, it does not matter. If you are doing it programatically, then do not use double quotes.

bitcoind expects the argument to either RPC to be a string, although it is not receiving the string directly from your shell but rather via HTTP from bitcoin-cli. bitcoin-cli will take the string as provided by the shell and format it for use in the JSON-RPC protocol bitcoind uses. If you are writing a program, you need to follow the JSON-RPC protocol for how to format data.

But when using bitcoin-cli, it takes strings as provided by the shell. As the argument to both `submitblock` and `submitheader` is a hexadecimal string, there is no need to use any form of quotes (either single `'` or double `"`) as there are no special characters in hex strings that shells would need to escape or otherwise be informed to not interpret. However, single or double quoting the string is completely harmless because shells will interpret those quotes and remove them before providing the string to bitcoin-cli.

> **Comments:**
> **username_0**: Thanks for this explanation.... Helps a great deal  
> **username_0**: The simplicity of your explanation is gratifying and very clear... Would you mind dropping your btc address for a `Thank You` token once I make a profit? It doesn't have to be now though, I could comment here when i'm all set.  

---

