Skip to content

Commit 5207657

Browse files
committed
added testnet4 and some missing methods for signet
1 parent 684b618 commit 5207657

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

bitcoinutils/constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,39 @@
1313
"mainnet": 8332,
1414
"signet": 38332,
1515
"testnet": 18332,
16+
"testnet4": 48332,
1617
"regtest": 18443,
1718
}
1819

1920
NETWORK_WIF_PREFIXES = {
2021
"mainnet": b"\x80",
2122
"signet": b"\xef",
2223
"testnet": b"\xef",
24+
"testnet4": b"\xef",
2325
"regtest": b"\xef",
2426
}
2527

2628
NETWORK_P2PKH_PREFIXES = {
2729
"mainnet": b"\x00",
2830
"signet": b"\x6f",
2931
"testnet": b"\x6f",
32+
"testnet4": b"\x6f",
3033
"regtest": b"\x6f",
3134
}
3235

3336
NETWORK_P2SH_PREFIXES = {
3437
"mainnet": b"\x05",
3538
"signet": b"\xc4",
3639
"testnet": b"\xc4",
40+
"testnet4": b"\xc4",
3741
"regtest": b"\xc4",
3842
}
3943

4044
NETWORK_SEGWIT_PREFIXES = {
4145
"mainnet": "bc",
4246
"signet": "tb",
4347
"testnet": "tb",
48+
"testnet4": "tb",
4449
"regtest": "bcrt",
4550
}
4651

@@ -99,6 +104,7 @@
99104
BLOCK_MAGIC_NUMBER = {
100105
"f9beb4d9": "mainnet",
101106
"0b110907": "testnet",
107+
"1c163f28": "testnet4",
102108
"fabfb5da": "regtest",
103109
"0a03cf40": "signet",
104110
}

bitcoinutils/setup.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
NETWORK = "testnet"
1313

14-
networks = {"mainnet", "testnet", "regtest"}
14+
networks = {"mainnet", "testnet", "testnet4", "signet", "regtest"}
1515

1616

1717
def setup(network: str = "testnet") -> str:
@@ -41,6 +41,22 @@ def is_testnet() -> bool:
4141
return False
4242

4343

44+
def is_testnet4() -> bool:
45+
global NETWORK
46+
if NETWORK == "testnet4":
47+
return True
48+
else:
49+
return False
50+
51+
52+
def is_signet() -> bool:
53+
global NETWORK
54+
if NETWORK == "signet":
55+
return True
56+
else:
57+
return False
58+
59+
4460
def is_regtest() -> bool:
4561
global NETWORK
4662
if NETWORK == "regtest":

0 commit comments

Comments
 (0)