2

I'm constructing a customized miner, and I'd like to check if the 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?

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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