<p><code>generatetoaddress</code> doesn't actually have a restriction on which networks it operates on. You can use it on mainnet, it will just not find any blocks. The way that it is implemented is that it just tries the nonce range for a single block, and if none of those block proposals are valid, then it exits. So if the difficulty is low enough that it is possible to find a block with just the nonce range (rather than needing to change block templates or increment an extra nonce), then <code>generatetoaddress</code> will find blocks.</p>

CC BY-SA 4.0
2021-07-01T07:13:58.257Z
Hello Andrew. So signet blocks are not strictly committed to the challenge script? At this point, I don't know how it works.
JonSnow
CC BY-SA 4.0
2021-07-01T16:39:58.403Z
Signet blocks need to be mined using a separate utility so that the challenge script is valid. Instructions for mining signet blocks can be found at https://github.com/bitcoin/bitcoin/blob/master/contrib/signet/README.md#miner
Ava Chow
CC BY-SA 4.0
2021-07-01T19:04:45.857Z
Thanks again for your answer. I have already checked the signet documentation on how to mine blocks (unluckily the current miner on master is broken, using the 0.21.1, but this is another story). 
What I don't get is why the generatetoaddress API is still used to produce blocks in a custom signet, I expected to see it fail due to lack of signature.
JonSnow
CC BY-SA 4.0
2021-07-07T12:58:39.583Z
It would only fail if you have set up the mining utility to require a block signer and not provided a valid block signature. By default a custom signet doesn't require a block signature, you have to set that up if you want that.
Michael Folkson
CC BY-SA 4.0
2021-06-30T17:45:34.040Z
2021-06-30T17:45:34.040Z
Ava Chow
<p>I have set up my custom signet, with my own challenge.</p>
<p>I expected to fail to generate blocks using the 'generatetoaddress' API before importing the private key related to the challenge script in the node wallet, but using bitcoincore 0.21.1 the blocks generation works with just the PoW.</p>
<p>Why?</p>

<bitcoin-core><signet>
Why i can still use the 'generatetoaddress' RPC with custom signet?
JonSnow
# Why i can still use the 'generatetoaddress' RPC with custom signet?

(Asked by: username_0 on 2021-06-30)

I have set up my custom signet, with my own challenge.

I expected to fail to generate blocks using the 'generatetoaddress' API before importing the private key related to the challenge script in the node wallet, but using bitcoincore 0.21.1 the blocks generation works with just the PoW.

Why?

**Tags:** bitcoin-core, signet


---

## 1 answers

### Answer by username_1 on 2021-06-30. Score: 1

`generatetoaddress` doesn't actually have a restriction on which networks it operates on. You can use it on mainnet, it will just not find any blocks. The way that it is implemented is that it just tries the nonce range for a single block, and if none of those block proposals are valid, then it exits. So if the difficulty is low enough that it is possible to find a block with just the nonce range (rather than needing to change block templates or increment an extra nonce), then `generatetoaddress` will find blocks.

> **Comments:**
> **username_0**: Hello Andrew. So signet blocks are not strictly committed to the challenge script? At this point, I don't know how it works.  
> **username_1**: Signet blocks need to be mined using a separate utility so that the challenge script is valid. Instructions for mining signet blocks can be found at https://github.com/bitcoin/bitcoin/blob/master/contrib/signet/README.md#miner  
> **username_0**: Thanks again for your answer. I have already checked the signet documentation on how to mine blocks (unluckily the current miner on master is broken, using the 0.21.1, but this is another story).  What I don't get is why the generatetoaddress API is still used to produce blocks in a custom signet, I expected to see it fail due to lack of signature.  
> **username_2**: It would only fail if you have set up the mining utility to require a block signer and not provided a valid block signature. By default a custom signet doesn't require a block signature, you have to set that up if you want that.  

---

