<blockquote>
<p>Which of the following rpc methods is used to mine bitcoin and receive its reward?</p>
</blockquote>
<p>None, really.</p>
<p>The primary way of interfacing with Bitcoin Core for mining is through the <code>getblocktemplate</code> (GBT) RPC, which provides all information mining software needs about the current best block to build upon, and what transactions to include. The rest is up to the user.</p>
<p>Bitcoin Core is not involved in &quot;receiving&quot; a reward for a block; rather, the miner constructs a block that pays themselves. If that block is valid and gets accepted by the network, then they get paid; if it doesn't, they don't.</p>
<p>This is important: Bitcoin mining rewards aren't decided <em>after</em> mining by submitting it somewhere; they're decided ahead of time, before mining is attempted. A miner (or its software stack, or pool) will call GBT, build a candidate block that uses the GBT result's transactions + a coinbase transaction that pays the miner/pool, and <em>then</em> hand it to the mining hardware to solve. Changing the payout after finding a block would invalidate it.</p>
<blockquote>
<ol>
<li>generateblock</li>
</ol>
</blockquote>
<p>This is a test-only RPC, which does actually mine a block, but with a user-specified set of transactions to include. It also uses mining logic in Bitcoin Core itself, which is slow and unoptimized, and cannot use ASICs or other specialized mining hardware. For anything but test networks, it is unusably slow.</p>
<blockquote>
<ol start="2">
<li>submitblock</li>
</ol>
</blockquote>
<p>This RPC can be used to provide a block out of band to Bitcoin Core. It is used when mining hardware has found a block, to get it to propagate across the network.</p>
<p>As noted above however, it is not involved in getting a payout from mining; the block itself already contains its payout information, and can be submitted anywhere on the network.</p>
<blockquote>
<ol start="3">
<li>submitheader</li>
</ol>
</blockquote>
<p>This is to inform Bitcoin Core about a block header out of band. It's unrelated to mining.</p>

CC BY-SA 4.0
2023-03-11T14:56:48.730Z
Pieter Wuille, Thanks for your answer, Suppose I use a cpu and c++ language for mining, and by chance I have been able to extract a block whose hash value is less than the nBits, now if I use the submitblock method to send the block to the network, and Other nodes confirm the authenticity of this block, will I receive the mining reward?
Ali
CC BY-SA 4.0
2023-03-11T14:59:06.407Z
@Ali Yes, if you produce a valid block, you can submit it to the network by invoking `submitblock` on any number of Bitcoin nodes, which will then propagate the block through the network. If the block gets accepted, then whatever the block does will take effect - including paying out the reward, if that's what it does. Of course, with just a CPU you will never ever find a mainnet block.
Pieter Wuille
CC BY-SA 4.0
2023-03-10T18:26:28.293Z
2023-03-10T18:26:28.293Z
Pieter Wuille
<p>Which of the following RPC methods is used to mine bitcoin and receive its reward?</p>
<ol>
<li>generateblock</li>
<li>submitblock</li>
<li>submitheader</li>
</ol>
<p>What is the difference between these methods?</p>

<json-rpc><mining-reward><bitcoin-cli><daemon>
Which RPC method is used to mine bitcoin?
Ali
# Which RPC method is used to mine bitcoin?

(Asked by: username_0 on 2023-03-10)

Which of the following RPC methods is used to mine bitcoin and receive its reward?

1. generateblock
2. submitblock
3. submitheader

What is the difference between these methods?

**Tags:** json-rpc, mining-reward, bitcoin-cli, daemon


---

## 1 answers

### Answer by username_1 on 2023-03-10. Score: 6 | Accepted answer

> Which of the following rpc methods is used to mine bitcoin and receive its reward?

None, really.

The primary way of interfacing with Bitcoin Core for mining is through the `getblocktemplate` (GBT) RPC, which provides all information mining software needs about the current best block to build upon, and what transactions to include. The rest is up to the user.

Bitcoin Core is not involved in "receiving" a reward for a block; rather, the miner constructs a block that pays themselves. If that block is valid and gets accepted by the network, then they get paid; if it doesn't, they don't.

This is important: Bitcoin mining rewards aren't decided *after* mining by submitting it somewhere; they're decided ahead of time, before mining is attempted. A miner (or its software stack, or pool) will call GBT, build a candidate block that uses the GBT result's transactions + a coinbase transaction that pays the miner/pool, and *then* hand it to the mining hardware to solve. Changing the payout after finding a block would invalidate it.

> 1. generateblock

This is a test-only RPC, which does actually mine a block, but with a user-specified set of transactions to include. It also uses mining logic in Bitcoin Core itself, which is slow and unoptimized, and cannot use ASICs or other specialized mining hardware. For anything but test networks, it is unusably slow.

> 2. submitblock

This RPC can be used to provide a block out of band to Bitcoin Core. It is used when mining hardware has found a block, to get it to propagate across the network.

As noted above however, it is not involved in getting a payout from mining; the block itself already contains its payout information, and can be submitted anywhere on the network.

> 3. submitheader

This is to inform Bitcoin Core about a block header out of band. It's unrelated to mining.

> **Comments:**
> **username_0**: username_1 username_1, Thanks for your answer, Suppose I use a cpu and c++ language for mining, and by chance I have been able to extract a block whose hash value is less than the nBits, now if I use the submitblock method to send the block to the network, and Other nodes confirm the authenticity of this block, will I receive the mining reward?  
> **username_1**: @username_0 Yes, if you produce a valid block, you can submit it to the network by invoking `submitblock` on any number of Bitcoin nodes, which will then propagate the block through the network. If the block gets accepted, then whatever the block does will take effect - including paying out the reward, if that's what it does. Of course, with just a CPU you will never ever find a mainnet block.  

---

