def add_pubkeys(pubkeys, usehex): """Pubkeys should be a list (for compatibility). """ #Not supporting more than 2 items for now, not needed. assert len(pubkeys) == 2 if usehex: pubkeys = [binascii.unhexlify(x) for x in pubkeys] p1pt, p2pt = [ebt.ser_to_point(x) for x in pubkeys] sumpt = p1pt + p2pt return ebt.point_to_ser(sumpt)
def __init__(self, serP): self._point = ebt.ser_to_point(serP)
#!./venv/bin/python from electrum import bitcoin, util from sha3 import keccak_256 import sys lines = [x.strip() for x in sys.stdin.readlines()] if len(lines) != 1: print("wrong input") sys.exit(1) _xtype, _depth, _fp, _cn, _c, K = bitcoin.deserialize_xpub(lines[0]) # privkey = bitcoin.serialize_privkey(k, True, "p2pkh") keccak = keccak_256() keccak.update(bitcoin.point_to_ser(bitcoin.ser_to_point(K), False)[1:]) print("0x" + keccak.hexdigest()[24:])