Esempio n. 1
0
 def __init__(self, *, name, full_name, magic_hex, genesis_header_hex,
              required_bits, BIP65_height, BIP66_height, CSV_height,
              UAHF_height, DAA_height, genesis_height, P2PKH_verbyte,
              P2SH_verbyte, WIF_byte, xpub_verbytes_hex, xprv_verbytes_hex,
              cashaddr_prefix):
     self.name = name
     self.full_name = full_name
     self.magic = bytes.fromhex(magic_hex)
     self.genesis_header = bytes.fromhex(genesis_header_hex)
     assert len(self.genesis_header) == 80
     self.genesis_bits = self.header_bits(self.genesis_header)
     self.max_target = bits_to_target(self.genesis_bits)
     # Signature:  def required_bits(self, headers, chain, height, timestamp=None)
     self.required_bits = required_bits
     self.BIP65_height = BIP65_height,
     self.BIP66_height = BIP66_height
     self.CSV_height = CSV_height
     self.UAHF_height = UAHF_height
     self.DAA_height = DAA_height
     self.genesis_height = genesis_height
     self.P2PKH_verbyte = P2PKH_verbyte
     self.P2SH_verbyte = P2SH_verbyte
     self.WIF_byte = WIF_byte
     self.xpub_verbytes = bytes.fromhex(xpub_verbytes_hex)
     self.xprv_verbytes = bytes.fromhex(xprv_verbytes_hex)
     self.cashaddr_prefix = cashaddr_prefix
     # A cache
     self.output_script_templates = None
Esempio n. 2
0
 def __init__(self, name, genesis_header, required_bits, P2PKH_verbyte, P2SH_verbyte,
              WIF_byte, xpub_verbytes, xprv_verbytes, cashaddr_prefix):
     self.name = name
     self.genesis_header = bytes.fromhex(genesis_header)
     self.genesis_bits = self.header_bits(self.genesis_header)
     self.max_target = bits_to_target(self.genesis_bits)
     # Signature:  def required_bits(self, headers, chain, height, timestamp=None)
     self.required_bits = required_bits
     self.P2PKH_verbyte = P2PKH_verbyte
     self.P2SH_verbyte = P2SH_verbyte
     self.WIF_byte = WIF_byte
     self.xpub_verbytes = xpub_verbytes
     self.xprv_verbytes = xprv_verbytes
     self.cashaddr_prefix = cashaddr_prefix
     # A cache
     self.output_script_templates = None
Esempio n. 3
0
 def bits_to_difficulty(self, bits):
     return Bitcoin.max_target / bits_to_target(bits)
Esempio n. 4
0
 def target(self):
     return bits_to_target(self.bits)