class SVMainnet(object): ADDRTYPE_P2PKH = 0 ADDRTYPE_P2SH = 5 CASHADDR_PREFIX = "bitcoincash" DEFAULT_PORTS = {'t': '50001', 's': '50002'} DEFAULT_SERVERS = read_json_dict('servers.json') GENESIS = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" NAME = 'mainnet' URI_PREFIX = "bitcoin" WIF_PREFIX = 0x80 # Bitcoin Cash fork block specification BITCOIN_CASH_FORK_BLOCK_HEIGHT = 478559 BITCOIN_CASH_FORK_BLOCK_HASH = ( "000000000000000000651ef99cb9fcbe0dadde1d424bd9f15ff20136191a5eec" ) COIN = Bitcoin # A post-split SV checkpoint. CHECKPOINT = CheckPoint(bytes.fromhex( '000000203b0bc2a72e7313ac216e3c63314b8aec4be35374d66d2e0200000000000000009d14e99d' '7799f2d8b62b3c745aa94514da4c831193bd057a916e1f45183600b5d001f95b11fd02180d32952e' ), height=557957, prev_work=0xd54c44dbdc491c25d097bf) # Inegrate this into BitcoinX? VERIFICATION_BLOCK_MERKLE_ROOT = ( "2eb4a1d21caa056385dbedd7743878e481d26052092aba97b319a6459ff6fa1b" ) BIP44_COIN_TYPE = 0 BLOCK_EXPLORERS = { 'bchsvexplorer.com': ( 'https://bchsvexplorer.com', {'tx': 'tx', 'addr': 'address'}, ), 'svblox.com': ( 'https://svblox.com', {'tx': 'tx', 'addr': 'address'}, ), 'whatsonchain.com': ( 'https://whatsonchain.com', {'tx': 'tx', 'addr': 'address'}, ), 'btc.com': ( 'https://bsv.btc.com', {'tx': '', 'addr': ''}, ), 'satoshi.io': ( 'https://satoshi.io', {'tx': 'tx', 'addr': 'address'}, ), } FAUCET_URL = "https://faucet.satoshisvision.network" KEEPKEY_DISPLAY_COIN_NAME = 'Bitcoin' TREZOR_COIN_NAME = 'Bcash' # Really we want to put the difficulty logic in this file TWENTY_MINUTE_RULE = False
class SVTestnet(object): ADDRTYPE_P2PKH = 111 ADDRTYPE_P2SH = 196 CASHADDR_PREFIX = "bchtest" DEFAULT_PORTS = {'t': '51001', 's': '51002'} DEFAULT_SERVERS = read_json_dict('servers_testnet.json') GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" NAME = 'testnet' BITCOIN_URI_PREFIX = "bitcoin" PAY_URI_PREFIX = "pay" WIF_PREFIX = 0xef BIP276_VERSION = 2 # Bitcoin Cash fork block specification BITCOIN_CASH_FORK_BLOCK_HEIGHT = 1155876 BITCOIN_CASH_FORK_BLOCK_HASH = ( "00000000000e38fef93ed9582a7df43815d5c2ba9fd37ef70c9a0ea4a285b8f5e" ) COIN = BitcoinTestnet # A post-split SV checkpoint. CHECKPOINT = CheckPoint(bytes.fromhex( '00000020b9ea0b497adc73aff2e3d2c3663db12bdf4f8d612d3317e76700000000000000b1e1eda1' '767dc2e6fdb63e82d570461da2daa2f4fd9fe375ebce93f5b180a6f5ae7e285faef5021a7f406d4d' ), height=1377549, prev_work=0xade538ee77b27b019d) VERIFICATION_BLOCK_MERKLE_ROOT = ( 'c2ca8aef7a20779fc9b7cc00af6b9b65f7ff99ae68fe22132c448d15de0d5943' ) BIP44_COIN_TYPE = 1 BLOCK_EXPLORERS = { 'bitcoincloud.net': ( 'https://testnet.bitcoincloud.net', {'tx': 'tx', 'addr': 'address'}, ), 'whatsonchain.com': ( 'http://test.whatsonchain.com', {'tx': 'tx', 'addr': 'address', 'script': 'script'}, ), 'satoshi.io': ( 'https://testnet.satoshi.io', {'tx': 'tx', 'addr': 'address', 'script': 'script'}, ), 'system default': ( 'blockchain:', {'tx': 'tx', 'addr': 'address'}, ), } FAUCET_URL = "https://testnet.satoshisvision.network" KEEPKEY_DISPLAY_COIN_NAME = 'Testnet' # Note: testnet allegedly supported only by unofficial firmware TREZOR_COIN_NAME = 'Bcash Testnet' # Really we want to put the difficulty logic in this file TWENTY_MINUTE_RULE = True
class SVTestnet(object): ADDRTYPE_P2PKH = 111 ADDRTYPE_P2SH = 196 CASHADDR_PREFIX = "bchtest" DEFAULT_PORTS = {'t': '51001', 's': '51002'} DEFAULT_SERVERS = read_json_dict('servers_testnet.json') GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" NAME = 'testnet' URI_PREFIX = "bitcoin" WIF_PREFIX = 0xef BIP276_VERSION = 2 # Bitcoin Cash fork block specification BITCOIN_CASH_FORK_BLOCK_HEIGHT = 1155876 BITCOIN_CASH_FORK_BLOCK_HASH = ( "00000000000e38fef93ed9582a7df43815d5c2ba9fd37ef70c9a0ea4a285b8f5e" ) COIN = BitcoinTestnet # A post-split SV checkpoint. CHECKPOINT = CheckPoint(bytes.fromhex( '0000002029f1e3df7fda466242b9b56076792ffdb9e5d7ea51610307bc010000000000007ac1fa84' 'ef5f0998232fb01cd6fea2c0199e34218df2fb33e4e80e79d22b6a746994435d41c4021a208bae0a' ), height=1314717, prev_work=0x62ba4d708756160950) VERIFICATION_BLOCK_MERKLE_ROOT = ( '93414acafdef2dad790c456a424a6a261b66771a3426117125d8c13a1c93f10e' ) BIP44_COIN_TYPE = 1 BLOCK_EXPLORERS = { 'bitcoincloud.net': ( 'https://testnet.bitcoincloud.net', {'tx': 'tx', 'addr': 'address'}, ), 'whatsonchain.com': ( 'http://test.whatsonchain.com', {'tx': 'tx', 'addr': 'address'}, ), 'satoshi.io': ( 'https://testnet.satoshi.io', {'tx': 'tx', 'addr': 'address'}, ), 'system default': ( 'blockchain:', {'tx': 'tx', 'addr': 'address'}, ), } FAUCET_URL = "https://testnet.satoshisvision.network" KEEPKEY_DISPLAY_COIN_NAME = 'Testnet' # Note: testnet allegedly supported only by unofficial firmware TREZOR_COIN_NAME = 'Bcash Testnet' # Really we want to put the difficulty logic in this file TWENTY_MINUTE_RULE = True
class SVRegTestnet(object): """The checkpoint cannot be made until the bitcoin node has at least generated 146 blocks (to calculate the DAA). Blocks are therefore generated until there are at least 200. A new checkpoint at height = 200 is then calculated before allowing anything further to proceed. Note: RegTest overflows the max nBits field, presumably due to a very short time interval between generated blocks. To modify this field would be to change the hash of the header so as a workaround, bitcoinx is monkeypatched to skip the checking of the difficulty target (see HeadersRegtestMod).""" # hardcoded # - WIF private_key: cT3G2vJGRNbpmoCVXYPYv2JbngzwtznLvioPPJXu39jfQeLpDuX5 # - Pubkey hash: mfs8Y8gAwC2vJHCeSXkHs6LF5nu5PA7nxc REGTEST_FUNDS_PRIVATE_KEY: PrivateKey = PrivateKey(bytes.fromhex( 'a2d9803c912ab380c1491d3bd1aaab34ca06742d7885a224ec8d386182d26ed2'), coin=BitcoinRegtest) REGTEST_FUNDS_PRIVATE_KEY_WIF = REGTEST_FUNDS_PRIVATE_KEY.to_WIF() REGTEST_FUNDS_PUBLIC_KEY: PublicKey = REGTEST_FUNDS_PRIVATE_KEY.public_key REGTEST_P2PKH_ADDRESS: P2PKH_Address = REGTEST_FUNDS_PUBLIC_KEY.to_address( ).to_string() # For CI/CD use (restapi will by default reset everything back to empty wallet with this seed) # First receive address: mwv1WZTsrtKf3S9mRQABEeMaNefLbQbKpg REGTEST_DEFAULT_ACCOUNT_SEED = 'tprv8ZgxMBicQKsPd4wsdaJ11eH84eq4hHLX1K6Mx8EQQhJzq8jr25WH1m8hg' \ 'GkCqnksJDCZPZbDoMbQ6QtroyCyn5ZckCmsLeiHDb1MAxhNUHN' MIN_CHECKPOINT_HEIGHT = 0 ADDRTYPE_P2PKH = 111 ADDRTYPE_P2SH = 196 CASHADDR_PREFIX = "bchtest" DEFAULT_PORTS = {'t': '51001', 's': '51002'} DEFAULT_SERVERS = read_json_dict('servers_regtest.json') GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" NAME = 'regtest' BITCOIN_URI_PREFIX = "bitcoin" PAY_URI_PREFIX = "pay" WIF_PREFIX = 0xef BIP276_VERSION = 2 COIN = BitcoinRegtest # Use the following for a chain reset. CHECKPOINT = CheckPoint(bytes.fromhex( '0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd' '7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff001d1aa4ae18' ), height=0, prev_work=0) VERIFICATION_BLOCK_MERKLE_ROOT = None BIP44_COIN_TYPE = 1 BLOCK_EXPLORERS: Dict[str, Tuple[str, Dict[str, str]]] = {} FAUCET_URL = "" KEEPKEY_DISPLAY_COIN_NAME = 'Testnet' # Note: testnet allegedly supported only by unofficial firmware TREZOR_COIN_NAME = 'Bcash Testnet' TWENTY_MINUTE_RULE = True
class SVRegTestnet(object): """The checkpoint cannot be made until the bitcoin node has at least generated 146 blocks (to calculate the DAA). Blocks are therefore generated until there are at least 200. A new checkpoint at height = 200 is then calculated before allowing anything further to proceed. Note: RegTest overflows the max nBits field, presumably due to a very short time interval between generated blocks. To modify this field would be to change the hash of the header so as a workaround, bitcoinx is monkeypatched to skip the checking of the difficulty target (see HeadersRegtestMod).""" # hardcoded # - WIF private_key: cT3G2vJGRNbpmoCVXYPYv2JbngzwtznLvioPPJXu39jfQeLpDuX5 # - Pubkey hash: mfs8Y8gAwC2vJHCeSXkHs6LF5nu5PA7nxc REGTEST_FUNDS_PRIVATE_KEY: PrivateKey = PrivateKey(bytes.fromhex( 'a2d9803c912ab380c1491d3bd1aaab34ca06742d7885a224ec8d386182d26ed2'), coin=BitcoinRegtest) REGTEST_FUNDS_PRIVATE_KEY_WIF = REGTEST_FUNDS_PRIVATE_KEY.to_WIF() REGTEST_FUNDS_PUBLIC_KEY: PublicKey = REGTEST_FUNDS_PRIVATE_KEY.public_key REGTEST_P2PKH_ADDRESS: P2PKH_Address = REGTEST_FUNDS_PUBLIC_KEY.to_address( ).to_string() # For CI/CD use (restapi will by default reset everything back to empty wallet with this seed) REGTEST_DEFAULT_ACCOUNT_SEED = 'tprv8ZgxMBicQKsPd4wsdaJ11eH84eq4hHLX1K6Mx8EQQhJzq8jr25WH1m8hg' \ 'GkCqnksJDCZPZbDoMbQ6QtroyCyn5ZckCmsLeiHDb1MAxhNUHN' MIN_CHECKPOINT_HEIGHT = 200 ADDRTYPE_P2PKH = 111 ADDRTYPE_P2SH = 196 CASHADDR_PREFIX = "bchtest" DEFAULT_PORTS = {'t': '51001', 's': '51002'} DEFAULT_SERVERS = read_json_dict('servers_regtest.json') GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" NAME = 'regtest' URI_PREFIX = "bitcoin" WIF_PREFIX = 0xef BIP276_VERSION = 2 COIN = BitcoinRegtest CHECKPOINT = CheckPoint(bytes.fromhex( '0000002029f1e3df7fda466242b9b56076792ffdb9e5d7ea51610307bc010000000000007ac1fa84' 'ef5f0998232fb01cd6fea2c0199e34218df2fb33e4e80e79d22b6a746994435d41c4021a208bae0a' ), height=123, prev_work=123) VERIFICATION_BLOCK_MERKLE_ROOT = ( '93414acafdef2dad790c456a424a6a261b66771a3426117125d8c13a1c93f10e') BIP44_COIN_TYPE = 1 BLOCK_EXPLORERS: Dict[str, Tuple[str, Dict[str, str]]] = {} FAUCET_URL = "" KEEPKEY_DISPLAY_COIN_NAME = 'Testnet' # Note: testnet allegedly supported only by unofficial firmware TREZOR_COIN_NAME = 'Bcash Testnet' TWENTY_MINUTE_RULE = True
class SVTestnet(object): ADDRTYPE_P2PKH = 111 ADDRTYPE_P2SH = 196 CASHADDR_PREFIX = "bchtest" DEFAULT_PORTS = {'t': '51001', 's': '51002'} DEFAULT_SERVERS = read_json_dict('servers_testnet.json') GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" NAME = 'testnet' URI_PREFIX = "bitcoin" WIF_PREFIX = 0xef # Bitcoin Cash fork block specification BITCOIN_CASH_FORK_BLOCK_HEIGHT = 1155876 BITCOIN_CASH_FORK_BLOCK_HASH = ( "00000000000e38fef93ed9582a7df43815d5c2ba9fd37ef70c9a0ea4a285b8f5e" ) COIN = BitcoinTestnet # A post-split SV checkpoint. CHECKPOINT = CheckPoint(bytes.fromhex( '000000201d64d2c7c34486e209c246a24f8c28328ba296441fa6d2b22ea67d0300000000ec7b863e' 'fc96f7a7183ef0e0c6b65dd0dc3626c3cded68ccc7dfd06e53dbb6180c74065c2442111cda61b4ef' ), height=1273000, prev_work=0x3f53f8e19733a00946) VERIFICATION_BLOCK_MERKLE_ROOT = ( "2fde3bf6de5266bd7a2c65b6e6971f8aa5e7b839ee18523994309ab42a18a70c" ) BIP44_COIN_TYPE = 1 BLOCK_EXPLORERS = { 'bitcoincloud.net': ( 'https://testnet.bitcoincloud.net', {'tx': 'tx', 'addr': 'address'}, ), 'whatsonchain.com': ( 'http://test.whatsonchain.com', {'tx': 'tx', 'addr': 'address'}, ), 'satoshi.io': ( 'https://test.satoshi.io', {'tx': 'tx', 'addr': 'address'}, ), 'system default': ( 'blockchain:', {'tx': 'tx', 'addr': 'address'}, ), } FAUCET_URL = "https://testnet.satoshisvision.network" KEEPKEY_DISPLAY_COIN_NAME = 'Testnet' # Note: testnet allegedly supported only by unofficial firmware TREZOR_COIN_NAME = 'Bcash Testnet' # Really we want to put the difficulty logic in this file TWENTY_MINUTE_RULE = True
class SVMainnet(object): ADDRTYPE_P2PKH = 0 ADDRTYPE_P2SH = 5 CASHADDR_PREFIX = "bitcoincash" DEFAULT_PORTS = {'t': '50001', 's': '50002'} DEFAULT_SERVERS = read_json_dict('servers.json') GENESIS = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" NAME = 'mainnet' BITCOIN_URI_PREFIX = "bitcoin" PAY_URI_PREFIX = "pay" WIF_PREFIX = 0x80 BIP276_VERSION = 1 # Bitcoin Cash fork block specification BITCOIN_CASH_FORK_BLOCK_HEIGHT = 478559 BITCOIN_CASH_FORK_BLOCK_HASH = ( "000000000000000000651ef99cb9fcbe0dadde1d424bd9f15ff20136191a5eec" ) COIN = Bitcoin # A post-split SV checkpoint. CHECKPOINT = CheckPoint(bytes.fromhex( '00004020001c43664879f5c89384f39f0c71a48197b2f1bfdbbe83010000000000000000e3d8f953' 'f133959c98fadfced5b83f388b8aaee167772dc850425edcb5ac916e7862285fdf6203181438585e' ), height=646575, prev_work=0x1149bb71861599709fe849c) VERIFICATION_BLOCK_MERKLE_ROOT = ( '3fccaf735987c5a6bcf5ee24022a989d311b18e0fa20f67c4565137fb888317b' ) BIP44_COIN_TYPE = 0 BLOCK_EXPLORERS = { 'hugeblock.info': ( 'https://hugeblock.info', {'tx': 'tx', 'addr': 'address'}, ), 'whatsonchain.com': ( 'https://whatsonchain.com', {'tx': 'tx', 'addr': 'address', 'script': 'script'}, ), 'blockchair.com' : ( 'https://blockchair.com/bitcoin-sv', {'tx': 'transaction', 'addr': 'address'}, ), 'satoshi.io': ( 'https://satoshi.io', {'tx': 'tx', 'addr': 'address', 'script': 'script'}, ), } FAUCET_URL = "https://faucet.satoshisvision.network" KEEPKEY_DISPLAY_COIN_NAME = 'Bitcoin' TREZOR_COIN_NAME = 'Bcash' # Really we want to put the difficulty logic in this file TWENTY_MINUTE_RULE = False
class SVMainnet(object): ADDRTYPE_P2PKH = 0 ADDRTYPE_P2SH = 5 CASHADDR_PREFIX = "bitcoincash" DEFAULT_PORTS = {'t': '50001', 's': '50002'} DEFAULT_SERVERS = read_json_dict('servers.json') GENESIS = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" NAME = 'mainnet' URI_PREFIX = "bitcoin" WIF_PREFIX = 0x80 BIP276_VERSION = 1 # Bitcoin Cash fork block specification BITCOIN_CASH_FORK_BLOCK_HEIGHT = 478559 BITCOIN_CASH_FORK_BLOCK_HASH = ( "000000000000000000651ef99cb9fcbe0dadde1d424bd9f15ff20136191a5eec" ) COIN = Bitcoin # A post-split SV checkpoint. CHECKPOINT = CheckPoint(bytes.fromhex( '000000201ff55a51c860352808114e52a9b09ae65dd9156a24e75e01000000000000000033320991' '190dcb5a86159e56b9ba2da6bca4e515d9dcbab6878471f8fcdf4039cd98425d7dee0518c5322529' ), height=593660, prev_work=0xe5eef982b80af19dbeb052) VERIFICATION_BLOCK_MERKLE_ROOT = ( '6acb9cf11127bd497bbebc61fca7d522d985b43be813f8710dca95351e89953e' ) BIP44_COIN_TYPE = 0 BLOCK_EXPLORERS = { 'hugeblock.info': ( 'https://hugeblock.info', {'tx': 'tx', 'addr': 'address'}, ), 'whatsonchain.com': ( 'https://whatsonchain.com', {'tx': 'tx', 'addr': 'address'}, ), 'blockchair.com' : ( 'https://blockchair.com/bitcoin-sv', {'tx': 'transaction', 'addr': 'address'}, ), 'satoshi.io': ( 'https://satoshi.io', {'tx': 'tx', 'addr': 'address'}, ), } FAUCET_URL = "https://faucet.satoshisvision.network" KEEPKEY_DISPLAY_COIN_NAME = 'Bitcoin' TREZOR_COIN_NAME = 'Bcash' # Really we want to put the difficulty logic in this file TWENTY_MINUTE_RULE = False
class SVScalingTestnet(object): ADDRTYPE_P2PKH = 111 ADDRTYPE_P2SH = 196 CASHADDR_PREFIX = "bchtest" DEFAULT_PORTS = {'t': '51001', 's': '51002'} DEFAULT_SERVERS = read_json_dict('servers_scalingtestnet.json') GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" NAME = 'scalingtestnet' URI_PREFIX = "bitcoin" WIF_PREFIX = 0xef # Bitcoin Cash fork block specification # BITCOIN_CASH_FORK_BLOCK_HEIGHT = 1155876 # BITCOIN_CASH_FORK_BLOCK_HASH = ( # "00000000000e38fef93ed9582a7df43815d5c2ba9fd37ef70c9a0ea4a285b8f5e" # ) COIN = BitcoinScalingTestnet # A post-split SV checkpoint. CHECKPOINT = CheckPoint(bytes.fromhex( '0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd' '7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff001d1aa4ae18', ), height=0, prev_work=0) VERIFICATION_BLOCK_MERKLE_ROOT = None BIP44_COIN_TYPE = 1 BLOCK_EXPLORERS = { 'bitcoinscaling.io': ( 'https://bigblocks.bitcoinscaling.io', { 'tx': 'transaction', 'addr': 'address' }, ), 'system default': ( 'blockchain:', { 'tx': 'tx', 'addr': 'address' }, ), } FAUCET_URL = "https://faucet.bitcoinscaling.io/" KEEPKEY_DISPLAY_COIN_NAME = 'Testnet' # Note: testnet allegedly supported only by unofficial firmware TREZOR_COIN_NAME = 'Bcash Testnet' # Really we want to put the difficulty logic in this file TWENTY_MINUTE_RULE = True
def setup_headers(tmpdir, headers_file): with open(os.path.join(data_dir, headers_file), 'rb') as f: raw_headers = f.read() last_height, = unpack_le_uint32(raw_headers[-84:-80]) last_raw = raw_headers[-80:] checkpoint = CheckPoint(last_raw, last_height, 0) headers = create_headers(tmpdir, checkpoint) for offset in range(0, len(raw_headers), 84): height, = unpack_le_uint32(raw_headers[offset:offset + 4]) raw_header = raw_headers[offset + 4:offset + 84] headers.set_one(height, raw_header) return headers
def setup_gzipped_headers(tmpdir, headers_file, network): import gzip with gzip.open(os.path.join(data_dir, headers_file), 'rb') as f: first_height = unpack_le_uint32(f.read(4))[0] header_count = unpack_le_uint32(f.read(4))[0] raw_header = bytearray(80) raw_header[0] = 1 checkpoint = CheckPoint(raw_header, first_height + header_count - 1, 0) headers = create_headers(tmpdir, checkpoint, network=network) for height in range(first_height, header_count): headers.set_one(height, f.read(80)) return headers
def setup_compressed_headers(tmpdir, headers_file, ts_offset, network): with open(os.path.join(data_dir, headers_file), 'rb') as f: raw_data = f.read() all_times = array.array('I') all_bits = array.array('I') read = io.BytesIO(raw_data).read first_height, = unpack_le_uint32(read(4)) header_count, = unpack_le_uint32(read(4)) # Timestamps first_time, = unpack_le_uint32(read(4)) all_times.append(first_time) for n in range(1, header_count): diff, = unpack_le_uint16(read(2)) all_times.append(all_times[-1] + diff - ts_offset) # Bits while True: raw = read(4) if not raw: break bits, = unpack_le_uint32(raw) if bits < 2016 * 2: count = bits bits, = unpack_le_uint32(read(4)) all_bits.extend(array.array('I', [bits]) * count) else: all_bits.append(bits) assert len(all_times) == header_count assert len(all_bits) == header_count raw_header = bytearray(80) raw_header[0] = 1 checkpoint = CheckPoint(raw_header, first_height + header_count - 1, 0) headers = create_headers(tmpdir, checkpoint, network=network) for height, (bits, timestamp) in enumerate(zip(all_bits, all_times), start=first_height): raw_header[68:72] = pack_le_uint32(timestamp) raw_header[72:76] = pack_le_uint32(bits) headers.set_one(height, raw_header) return headers
def calculate_regtest_checkpoint(height): logging.getLogger("urllib3").setLevel(logging.WARNING) # suppress excessive logging try: hash_ = get_blockhash_by_height(height) checkpoint_raw_header = get_raw_block_header_by_hash(hash_) # RegTest nBits overflow the max allowable value so cap the nBits at max prev_work = sum((bits_to_work(MAX_BITS) for i in range(Net.MIN_CHECKPOINT_HEIGHT - 1))) checkpoint = CheckPoint(raw_header=checkpoint_raw_header, height=Net.MIN_CHECKPOINT_HEIGHT, prev_work=prev_work) verification_block_merkle_root = checkpoint_raw_header[36:68] return checkpoint, verification_block_merkle_root except requests.HTTPError as e: if e.response.json().get('error').get('code') == BLOCK_HEIGHT_OUT_OF_RANGE_ERROR: regtest_generate_nblocks(200, address=Net.REGTEST_P2PKH_ADDRESS) # retry with more blocks return calculate_regtest_checkpoint(height)
class SVScalingTestnet(object): ADDRTYPE_P2PKH = 111 ADDRTYPE_P2SH = 196 CASHADDR_PREFIX = "bchtest" DEFAULT_PORTS = {'t': '51001', 's': '51002'} DEFAULT_SERVERS = read_json_dict('servers_scalingtestnet.json') GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" NAME = 'scalingtestnet' URI_PREFIX = "bitcoin" WIF_PREFIX = 0xef BIP276_VERSION = 3 # Bitcoin Cash fork block specification # BITCOIN_CASH_FORK_BLOCK_HEIGHT = 1155876 # BITCOIN_CASH_FORK_BLOCK_HASH = ( # "00000000000e38fef93ed9582a7df43815d5c2ba9fd37ef70c9a0ea4a285b8f5e" # ) COIN = BitcoinScalingTestnet CHECKPOINT = CheckPoint(bytes.fromhex( '00000020e00cb24913995b9db004e06a016e99128c862b6ad075ec259164219e00000000432acae3' '6979a88471935a3fb891bf462a017204e834e7eef034c10540e70db47abab45dffff001d117e9185' ), height=2500, prev_work=0x6f4cd3b9b05b4) VERIFICATION_BLOCK_MERKLE_ROOT = ( '2a9310d4af21e92d20e6f2aaeabc54d8c0b5d5e74a1278ffcd4c9ba47cffe422') # Use the following for a chain reset. # CHECKPOINT = CheckPoint(bytes.fromhex( # '0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd' # '7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff001d1aa4ae18' # ), height=0, prev_work=0) # VERIFICATION_BLOCK_MERKLE_ROOT = None BIP44_COIN_TYPE = 1 BLOCK_EXPLORERS = { 'bitcoinscaling.io': ( 'https://bigblocks.bitcoinscaling.io', { 'tx': 'transaction', 'addr': 'address' }, ), 'whatsonchain.com': ( 'http://stn.whatsonchain.com', { 'tx': 'tx', 'addr': 'address' }, ), 'satoshi.io': ( 'https://stn.satoshi.io', { 'tx': 'tx', 'addr': 'address' }, ), 'system default': ( 'blockchain:', { 'tx': 'tx', 'addr': 'address' }, ), } FAUCET_URL = "https://faucet.bitcoinscaling.io" KEEPKEY_DISPLAY_COIN_NAME = 'Testnet' # Note: testnet allegedly supported only by unofficial firmware TREZOR_COIN_NAME = 'Bcash Testnet' # Really we want to put the difficulty logic in this file TWENTY_MINUTE_RULE = True
class SVScalingTestnet(object): ADDRTYPE_P2PKH = 111 ADDRTYPE_P2SH = 196 CASHADDR_PREFIX = "bchtest" DEFAULT_PORTS = {'t': '51001', 's': '51002'} DEFAULT_SERVERS = read_json_dict('servers_scalingtestnet.json') GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" NAME = 'scalingtestnet' BITCOIN_URI_PREFIX = "bitcoin" PAY_URI_PREFIX = "pay" WIF_PREFIX = 0xef BIP276_VERSION = 3 # Bitcoin Cash fork block specification # BITCOIN_CASH_FORK_BLOCK_HEIGHT = 1155876 # BITCOIN_CASH_FORK_BLOCK_HASH = ( # "00000000000e38fef93ed9582a7df43815d5c2ba9fd37ef70c9a0ea4a285b8f5e" # ) COIN = BitcoinScalingTestnet # Replace after sufficient time has passed after a chain reset. CHECKPOINT = CheckPoint(bytes.fromhex( '0000002050c936fce8c10522b399a9feee9c48fba7c409561d0553369fd6dc0a00000000735d99a4' '0a4ff9d2499db4524ca1663b82736211390885bd5d813ef2d4612c798e7e285f99d91d1cb33ad085' ), height=15789, prev_work=0x12c8202e00871) VERIFICATION_BLOCK_MERKLE_ROOT = ( '3c6449749d6376dd341f4e1b2192ec658b68c241beaaf665e5615ae01c35b853') # Use the following for a chain reset. # CHECKPOINT = CheckPoint(bytes.fromhex( # '0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd' # '7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff001d1aa4ae18' # ), height=0, prev_work=0) # VERIFICATION_BLOCK_MERKLE_ROOT = None BIP44_COIN_TYPE = 1 BLOCK_EXPLORERS = { 'bitcoinscaling.io': ( 'https://bigblocks.bitcoinscaling.io', { 'tx': 'transaction', 'addr': 'address' }, ), 'whatsonchain.com': ( 'http://stn.whatsonchain.com', { 'tx': 'tx', 'addr': 'address' }, ), 'satoshi.io': ( 'https://stn.satoshi.io', { 'tx': 'tx', 'addr': 'address' }, ), 'system default': ( 'blockchain:', { 'tx': 'tx', 'addr': 'address' }, ), } FAUCET_URL = "https://faucet.bitcoinscaling.io" KEEPKEY_DISPLAY_COIN_NAME = 'Testnet' # Note: testnet allegedly supported only by unofficial firmware TREZOR_COIN_NAME = 'Bcash Testnet' # Really we want to put the difficulty logic in this file TWENTY_MINUTE_RULE = True
class SVScalingTestnet(object): ADDRTYPE_P2PKH = 111 ADDRTYPE_P2SH = 196 CASHADDR_PREFIX = "bchtest" DEFAULT_PORTS = {'t': '51001', 's': '51002'} DEFAULT_SERVERS = read_json_dict('servers_scalingtestnet.json') GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" NAME = 'scalingtestnet' URI_PREFIX = "bitcoin" WIF_PREFIX = 0xef # Bitcoin Cash fork block specification # BITCOIN_CASH_FORK_BLOCK_HEIGHT = 1155876 # BITCOIN_CASH_FORK_BLOCK_HASH = ( # "00000000000e38fef93ed9582a7df43815d5c2ba9fd37ef70c9a0ea4a285b8f5e" # ) COIN = BitcoinScalingTestnet # A post-split SV checkpoint. CHECKPOINT = CheckPoint(bytes.fromhex( '010000201b60800462c28335ae5d2a3552614ab72afbdc23f37301a06d0a03920000000079d5a7a2' 'a50d0b7f7da3e6ff4ceccd1591cfc2fcc1410b69bde0fac43e0409010090435d3d014f1c5af053d3' ), height=23267, prev_work=0x6eb0931d6fbf0) VERIFICATION_BLOCK_MERKLE_ROOT = ( 'a66bfe7bdf9f88cccf59f27f03a38f1c339a00ca4351fc77f78a1fb1dfda6696') BIP44_COIN_TYPE = 1 BLOCK_EXPLORERS = { 'bitcoinscaling.io': ( 'https://bigblocks.bitcoinscaling.io', { 'tx': 'transaction', 'addr': 'address' }, ), 'whatsonchain.com': ( 'http://stn.whatsonchain.com', { 'tx': 'tx', 'addr': 'address' }, ), 'satoshi.io': ( 'https://stn.satoshi.io', { 'tx': 'tx', 'addr': 'address' }, ), 'system default': ( 'blockchain:', { 'tx': 'tx', 'addr': 'address' }, ), } FAUCET_URL = "https://faucet.bitcoinscaling.io" KEEPKEY_DISPLAY_COIN_NAME = 'Testnet' # Note: testnet allegedly supported only by unofficial firmware TREZOR_COIN_NAME = 'Bcash Testnet' # Really we want to put the difficulty logic in this file TWENTY_MINUTE_RULE = True