Esempio n. 1
0
 def P2PKH_address_from_hash160(cls, hash160):
     '''Return a P2PKH address given a public key.'''
     assert len(hash160) == 20
     return Base58.encode_check(cls.P2PKH_VERBYTE + hash160)
Esempio n. 2
0
 def P2SH_address_from_hash160(cls, hash160):
     '''Return a coin address given a hash160.'''
     assert len(hash160) == 20
     return Base58.encode_check(cls.P2SH_VERBYTES[0] + hash160)
Esempio n. 3
0
 def privkey_WIF(cls, privkey_bytes, compressed):
     '''Return the private key encoded in Wallet Import Format.'''
     payload = bytearray(cls.WIF_BYTE) + privkey_bytes
     if compressed:
         payload.append(0x01)
     return Base58.encode_check(payload)
Esempio n. 4
0
 def extended_key_string(self, coin):
     '''Return an extended key as a base58 string.'''
     return Base58.encode_check(self.extended_key(coin))