def to_addr(self, pubhex): assert pubhex.compressed, 'Uncompressed public keys incompatible with Segwit' from mmgen.protocol import hash160 return CoinAddr(g.proto.pubhash2bech32addr(hash160(pubhex)))
def Pubhex2addr(pubkeyhex): Pubhash2addr(hash160(pubkeyhex)) def Wif2hex(wif): Msg(PrivKey(wif=wif))
def to_addr(self, pubhex): from mmgen.protocol import hash160 assert type(pubhex) == PubKey return CoinAddr(g.proto.pubhash2addr(hash160(pubhex), p2sh=False))
def pubhex2addr(self,pubkeyhex:'sstr'): "convert a hex pubkey to an address" if opt.type == 'segwit': return g.proto.pubhex2segwitaddr(pubkeyhex) else: return self.pubhash2addr(hash160(pubkeyhex))
def Hash160(pubkeyhex): Msg(hash160(pubkeyhex)) def Pubhex2addr(pubkeyhex): Pubhash2addr(hash160(pubkeyhex))
def Pubhex2addr(pubkeyhex): Pubhash2addr(hash160(pubkeyhex))
def hash160(self,hexstr:'sstr'): "compute ripemd160(sha256(data)) (convert hex pubkey to hex addr)" return hash160(hexstr)
def Hash160(pubkeyhex): Msg(hash160(pubkeyhex))
def to_addr(self,pubhex): assert pubhex.compressed,'Uncompressed public keys incompatible with Segwit' from mmgen.protocol import hash160 return CoinAddr(g.proto.pubhash2bech32addr(hash160(pubhex)))
def to_addr(self,pubhex): from mmgen.protocol import hash160 assert type(pubhex) == PubKey return CoinAddr(g.proto.pubhash2addr(hash160(pubhex),p2sh=False))