Skip to content

Bitcoin Custom Signet

enaples edited this page May 11, 2023 · 1 revision

Bitcoin signet, defined in BIP325, is a bitcoin testnet that behaves like mainnet without the drawbacks of common test networks such as regtest (creating blocks costs almost nothing) or testnet (any player can control the test network).

How build a custom signet

First of all, a challenge is required. That is any scriptPubKey (any common bitcoin locking script) such as P2PK (Pay-To-PublicKey), P2PKH (Pay-To-PubKey-Hash), P2SH (Pay-To-Script-Hash), P2WPKH (Pay-To-Witness-Public-Key-Hash), P2WSH (Pay-To-Witness-Script-Hash), or more advanced script such as P2WPKH nested in BIP16 P2SH and P2WSH nested in BIP16 P2SH.

How to get any of them? The hard way is to manually build the script following the BIPs specification. The easy way is to leverage the bitcoin wallet's descriptors which, by default, are:

  1. pkh({tprv}/44'/1'/0'/0/*) (BIP44)
  2. sh(wpkh({tprv}/49'/1'/0'/0/*)) (BIP49)
  3. tr({tprv}/86'/1'/0'/0/*) (BIP86)
  4. wpkh({tprv}/84'/1'/0'/0/*) (BIP84)

So, once bitcoind started, a wallet must be created and a new address to be obtained. Next, using the RPC command getaddressinfo to finally get the scriptPubKey related to the address. By default, the bitcoin core wallet uses 86-type derivation path to provide new addresses and since the 86-type derivation path is related to the Pay-To-TapRoot script ((BIP341)) the signetchallenge results in an hex string starting with 0014.

If the second argument is specified (the first is the so-called lable) to getaddressinfo, it will return respectively:

  • "legacy" -> address derived from pkh-like descriptor
  • "p2sh-segwit" -> address derived from sh-like descriptor
  • "bech32" -> address derived from tr-like descriptor
  • "bech32m" -> address derived from wpkh-like descriptor

Now, the signetchallenge can be added to the bitcoin.conf file and bitcoind can be rebooted.

NOTE: Starting bitcoind for the first time (no signetchallenge paramenter in the bitcoin.conf file) causes the download of the test chain. For this reason, the descriptors of the created walled must be dumped and, after deleting the signet folder, they must be imported in a new descriptor wallet using importdescriptors command.

Finally, after deleting of signet folder, adding of signetchallenge to bitcoin.conf, and importing descriptors, the miner utility can be run to actually mine the custom signet blockchain and get some test bitcoin.

Clone this wiki locally