Repository: 1200wd/bitcoinlib

Issue:
Add Signet support
Having out-of-the-box Signet support would be nice.

I imagine it is mostly adding the chain definition info.

Relevant part in Bitcoin Core:
class `SigNetParams` https://github.com/bitcoin/bitcoin/blob/master/src/kernel/chainparams.cpp#L409
added with commit  https://github.com/bitcoin/bitcoin/commit/e8990f121405af8cd539b904ef082439261e6c93

Hints from issue comments:
@optout21: Note: A workaround exists: the `networks.json` file, deployed at `$HOME/.bitcoinlib/networks.json` can be overwritten with the extended file from PR #436 :
https://raw.githubusercontent.com/optout21/bitcoinlib/refs/heads/signet/bitcoinlib/data/networks.json


Solution patch:
diff --git a/bitcoinlib/data/networks.json b/bitcoinlib/data/networks.json
index 59ff7305..4a6a7a5c 100644
--- a/bitcoinlib/data/networks.json
+++ b/bitcoinlib/data/networks.json
@@ -131,6 +131,39 @@
     "fee_max": 2000000,
     "priority": 8
   },
+  "signet":
+  {
+    "description": "Bitcoin Signet Network",
+    "currency_name": "signet-bitcoin",
+    "currency_name_plural": "signet-bitcoins",
+    "currency_symbol": "TBTC",
+    "currency_code": "tBTC",
+    "prefix_address": "6F",
+    "prefix_address_p2sh": "C4",
+    "prefix_bech32": "tb",
+    "prefix_wif": "EF",
+    "prefixes_wif": [
+      ["043587CF", "tpub", "public",  false, "legacy",      "p2pkh"],
+      ["043587CF", "tpub", "public",  true,  "legacy",      "p2sh"],
+      ["04358394", "tprv", "private", false, "legacy",      "p2pkh"],
+      ["04358394", "tprv", "private", true,  "legacy",      "p2sh"],
+      ["044A5262", "upub", "public",  false, "p2sh-segwit", "p2sh_p2wpkh"],
+      ["024289EF", "Upub", "public",  true,  "p2sh-segwit", "p2sh_p2wsh"],
+      ["044A4E28", "uprv", "private", false, "p2sh-segwit", "p2sh_p2wpkh"],
+      ["024285B5", "Uprv", "private", true,  "p2sh-segwit", "p2sh_p2wsh"],
+      ["045F1CF6", "vpub", "public",  false, "segwit",      "p2wpkh"],
+      ["02575483", "Vpub", "public",  true,  "segwit",      "p2wsh"],
+      ["045F18BC", "vprv", "private", false, "segwit",      "p2wpkh"],
+      ["02575048", "Vprv", "private", true,  "segwit",      "p2wsh"]
+    ],
+    "bip44_cointype": 1,
+    "denominator": 0.00000001,
+    "dust_amount": 1000,
+    "fee_default": 10000,
+    "fee_min": 1000,
+    "fee_max": 2000000,
+    "priority": 8
+  },
   "regtest":
   {
     "description": "Bitcoin regtest",


Test patch:
diff --git a/tests/test_networks.py b/tests/test_networks.py
index 2665fae6..0bd7e2d0 100644
--- a/tests/test_networks.py
+++ b/tests/test_networks.py
@@ -16,7 +16,7 @@ class TestNetworks(unittest.TestCase):
         self.assertEqual(network_by_value('prefix_wif', '10'), [])
 
     def test_networks_prefix_bech32_network_by_value(self):
-        self.assertEqual(network_by_value('prefix_bech32', 'tb'), ['testnet', 'testnet4'])
+        self.assertEqual(network_by_value('prefix_bech32', 'tb'), ['testnet', 'testnet4', 'signet'])
 
     def test_networks_prefix_bech32_network_by_value_sorted(self):
         self.assertEqual(network_by_value('prefix_bech32', 'ltc'), ['litecoin', 'litecoin_legacy'])