<p><code>regtest</code> is the test network best suited for this kind of testing. While it does still have a PoW requirement, the work required is basically negligible. It also does not do retargeting so the difficulty does not change. This allows you to create blocks at will. So you can use the <code>regtest</code> network option in order to test that your code is creating blocks correctly.</p>
<blockquote>
<p>Should I try to remine the genesis block, or should I try to create my own blocktemplate to be mined? And how could I do this?</p>
</blockquote>
<p>As all of the alternate networks available have genesis blocks, there is no need (nor way) to remine the genesis block. You should be creating new blocks that build on top of the existing chain. Since <code>regtest</code> is a local private network, all it has is the genesis block and you can add blocks on top.</p>
<p>You can either create your own blocks from scratch, or use the <code>getblocktemplate</code> RPC to get block templates that you can use. This will still work on regtest. The only caveat is that you need to generate at least 1 block after you start the regtest node in order for <code>getblocktemplate</code> to work. There is a <code>generatetoaddress</code> RPC built into bitcoind so that you can do that. This RPC will mine a new regtest block with the coins from the coinbase going to an address of your choice.</p>

CC BY-SA 4.0
2021-04-26T16:57:40.590Z
2021-04-26T16:57:40.590Z
Ava Chow
<p>I'm constructing a customized miner, and I'd like to check if the <a href="https://bitcoincore.org/en/doc/0.21.0/rpc/mining/submitblock/" rel="nofollow noreferrer">submitblock</a> method would work properly when connected to <code>mainnet</code>. What would be the easiest way of doing that using RPC calls and <code>bitcoind</code>?</p>
<p>Which alternate network (<code>testnet</code>, <code>regtest</code>, <code>signet</code>) would suit better for this kind of test? (I'd like to use something with a very low difficulty)</p>
<p>Should I try to remine the genesis block, or should I try to create my own blocktemplate to be mined? And how could I do this?</p>

<bitcoin-core><transactions><blockchain><bitcoind><genesis-block>
What would be the easiest way to test the submitblock method?
GarouDan
# What would be the easiest way to test the submitblock method?

(Asked by: username_0 on 2021-04-26)

I'm constructing a customized miner, and I'd like to check if the [submitblock](https://bitcoincore.org/en/doc/0.21.0/rpc/mining/submitblock/) method would work properly when connected to `mainnet`. What would be the easiest way of doing that using RPC calls and `bitcoind`?

Which alternate network (`testnet`, `regtest`, `signet`) would suit better for this kind of test? (I'd like to use something with a very low difficulty)

Should I try to remine the genesis block, or should I try to create my own blocktemplate to be mined? And how could I do this?

**Tags:** bitcoin-core, transactions, blockchain, bitcoind, genesis-block


---

## 1 answers

### Answer by username_1 on 2021-04-26. Score: 3

`regtest` is the test network best suited for this kind of testing. While it does still have a PoW requirement, the work required is basically negligible. It also does not do retargeting so the difficulty does not change. This allows you to create blocks at will. So you can use the `regtest` network option in order to test that your code is creating blocks correctly.

> Should I try to remine the genesis block, or should I try to create my own blocktemplate to be mined? And how could I do this?

As all of the alternate networks available have genesis blocks, there is no need (nor way) to remine the genesis block. You should be creating new blocks that build on top of the existing chain. Since `regtest` is a local private network, all it has is the genesis block and you can add blocks on top.

You can either create your own blocks from scratch, or use the `getblocktemplate` RPC to get block templates that you can use. This will still work on regtest. The only caveat is that you need to generate at least 1 block after you start the regtest node in order for `getblocktemplate` to work. There is a `generatetoaddress` RPC built into bitcoind so that you can do that. This RPC will mine a new regtest block with the coins from the coinbase going to an address of your choice.


---

