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)
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)
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)
def extended_key_string(self, coin): '''Return an extended key as a base58 string.''' return Base58.encode_check(self.extended_key(coin))