1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
# Copyright (C) The python-bitcoinlib developers
#
# This file is part of python-bitcoinlib.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoinlib, including this file, may be copied, modified,
# propagated, or distributed except according to the terms contained in the
# LICENSE file.
import bitcoin.core
# Note that setup.py can break if __init__.py imports any external
# dependencies, as these might not be installed when setup.py runs. In this
# case __version__ could be moved to a separate version.py and imported here.
__version__ = '0.12.2'
class MainParams(bitcoin.core.CoreMainParams):
MESSAGE_START = b'\xf9\xbe\xb4\xd9'
DEFAULT_PORT = 8333
RPC_PORT = 8332
DNS_SEEDS = (('bitcoin.sipa.be', 'seed.bitcoin.sipa.be'),
('bluematt.me', 'dnsseed.bluematt.me'),
('dashjr.org', 'dnsseed.bitcoin.dashjr.org'),
('bitcoinstats.com', 'seed.bitcoinstats.com'),
('xf2.org', 'bitseed.xf2.org'),
('bitcoin.jonasschnelli.ch', 'seed.bitcoin.jonasschnelli.ch'))
BASE58_PREFIXES = {'PUBKEY_ADDR':0,
'SCRIPT_ADDR':5,
'SECRET_KEY' :128}
BECH32_HRP = 'bc'
class TestNetParams(bitcoin.core.CoreTestNetParams):
MESSAGE_START = b'\x0b\x11\x09\x07'
DEFAULT_PORT = 18333
RPC_PORT = 18332
DNS_SEEDS = (('testnetbitcoin.jonasschnelli.ch', 'testnet-seed.bitcoin.jonasschnelli.ch'),
('petertodd.org', 'seed.tbtc.petertodd.org'),
('bluematt.me', 'testnet-seed.bluematt.me'),
('bitcoin.schildbach.de', 'testnet-seed.bitcoin.schildbach.de'))
BASE58_PREFIXES = {'PUBKEY_ADDR':111,
'SCRIPT_ADDR':196,
'SECRET_KEY' :239}
BECH32_HRP = 'tb'
class SigNetParams(bitcoin.core.CoreSigNetParams):
MESSAGE_START = b'\x0a\x03\xcf\x40'
DEFAULT_PORT = 38333
RPC_PORT = 38332
DNS_SEEDS = (("signet.bitcoin.sprovoost.nl", "seed.signet.bitcoin.sprovoost.nl"))
BASE58_PREFIXES = {'PUBKEY_ADDR':111,
'SCRIPT_ADDR':196,
'SECRET_KEY' :239}
BECH32_HRP = 'tb'
class RegTestParams(bitcoin.core.CoreRegTestParams):
MESSAGE_START = b'\xfa\xbf\xb5\xda'
DEFAULT_PORT = 18444
RPC_PORT = 18443
DNS_SEEDS = ()
BASE58_PREFIXES = {'PUBKEY_ADDR':111,
'SCRIPT_ADDR':196,
'SECRET_KEY' :239}
BECH32_HRP = 'bcrt'
"""Master global setting for what chain params we're using.
However, don't set this directly, use SelectParams() instead so as to set the
bitcoin.core.params correctly too.
"""
#params = bitcoin.core.coreparams = MainParams()
params = MainParams()
def SelectParams(name):
"""Select the chain parameters to use
name is one of 'mainnet', 'testnet', or 'regtest'
Default chain is 'mainnet'
"""
global params
bitcoin.core._SelectCoreParams(name)
if name == 'mainnet':
params = bitcoin.core.coreparams = MainParams()
elif name == 'testnet':
params = bitcoin.core.coreparams = TestNetParams()
elif name == 'regtest':
params = bitcoin.core.coreparams = RegTestParams()
elif name == 'signet':
params = bitcoin.core.coreparams = SigNetParams()
else:
raise ValueError('Unknown chain %r' % name)
|