Exemple #1
0
def serialize_xpub(xtype,
                   c,
                   cK,
                   depth=0,
                   fingerprint=chr(0) * 4,
                   child_number=chr(0) * 4):
    xpub = xpub_header(xtype) + chr(
        depth) + fingerprint + child_number + c + cK
    return b58encode_check(xpub)
Exemple #2
0
def serialize_xprv(xtype,
                   c,
                   k,
                   depth=0,
                   fingerprint=chr(0) * 4,
                   child_number=chr(0) * 4):
    xprv = xprv_header(xtype) + chr(
        depth) + fingerprint + child_number + c + chr(0) + k
    return b58encode_check(xprv)
Exemple #3
0
 def parse_xpubkey(cls, pubkey):
     assert pubkey[0:2] == 'ff'
     pk = pubkey.decode('hex')
     pk = pk[1:]
     xkey = b58encode_check(pk[0:78])
     dd = pk[78:]
     s = []
     while dd:
         n = read_uint16(dd[:2])
         dd = dd[2:]
         s.append(n)
     assert len(s) == 2
     return xkey, s
Exemple #4
0
def SecretToASecret(secret, compressed=False):
    addrtype = Parameter().ADDRTYPE_P2PKH
    vchIn = chr((addrtype + 128) & 255) + secret
    if compressed: vchIn += '\01'
    return b58encode_check(vchIn)