Skip to content

Commit

Permalink
Merge pull request #438 from 1200wd/signet-support
Browse files Browse the repository at this point in the history
Signet support
  • Loading branch information
mccwdev authored Feb 7, 2025
2 parents bd2711f + 27afc87 commit ca869a2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
33 changes: 33 additions & 0 deletions bitcoinlib/data/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "SBTC",
"currency_code": "sBTC",
"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",
Expand Down
4 changes: 2 additions & 2 deletions bitcoinlib/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ class DbTransactionInput(Base):
"An cryptocurrency address is a hash of the public key or a redeemscript")
witnesses = Column(LargeBinary, doc="Witnesses (signatures) used in Segwit transaction inputs")
witness_type = Column(String(20), default='segwit',
doc="Type of transaction, can be legacy, segwit or p2sh-segwit. Default is segwit")
doc="Type of transaction, can be legacy, segwit, p2sh-segwit or taproot. Default is segwit")
prev_txid = Column(LargeBinary(33),
doc="Transaction hash of previous transaction. Previous unspent outputs (UTXO) is spent "
"in this input")
Expand All @@ -463,7 +463,7 @@ class DbTransactionInput(Base):
double_spend = Column(Boolean, default=False,
doc="Indicates if a service provider tagged this transaction as double spend")

__table_args__ = (CheckConstraint(witness_type.in_(['legacy', 'segwit', 'p2sh-segwit']),
__table_args__ = (CheckConstraint(witness_type.in_(['legacy', 'segwit', 'p2sh-segwit', 'taproot']),
name='transactioninput_constraint_allowed_types'),
UniqueConstraint('transaction_id', 'index_n', name='constraint_transaction_input_unique'))

Expand Down
3 changes: 2 additions & 1 deletion docs/_static/manuals.faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Does Bitcoinlib support 'x'-coin
--------------------------------

Bitcoinlib main focus is on Bitcoin. But besides Bitcoin it supports Litecoin and Dogecoin. For testing
it supports Bitcoin testnet3, Bitcoin regtest, Litecoin testnet and Dogecoin testnet.
it supports the Bitcoin testing networks: testnet3, testnet4, regtest and signet. For other coins the Litecoin testnet
and Dogecoin testnet is supported.

Support for Dash, Bitcoin Cash and Bitcoin SV has been dropped.

Expand Down
2 changes: 1 addition & 1 deletion tests/test_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_networks_prefix_wif_network_by_value(self):
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'])
Expand Down

0 comments on commit ca869a2

Please sign in to comment.