Example #1
0
def is_xprv(text):
    if text[0:4] != 'xprv':
        return False
    try:
        deserialize_xkey(text)
        return True
    except:
        return False
Example #2
0
def is_xprv(text):
    if text[0:4] != 'xprv':
        return False
    try:
        deserialize_xkey(text)
        return True
    except:
        return False
Example #3
0
def is_xprv(text):
    if text[0:4] not in ('xprv', 'Ltpv'):
        return False
    try:
        deserialize_xkey(text)
        return True
    except:
        return False
Example #4
0
def is_xprv(text):
    if text[0:4] not in ('xprv', 'Ltpv'):
        return False
    try:
        deserialize_xkey(text)
        return True
    except:
        return False
Example #5
0
 def derive_pubkey(self, for_change, n):
     xpub = self.xpub_change if for_change else self.xpub_receive
     if xpub is None:
         xpub = bip32_public_derivation(self.xpub, "", "/%d" % for_change)
         if for_change:
             self.xpub_change = xpub
         else:
             self.xpub_receive = xpub
     _, _, _, c, cK = deserialize_xkey(xpub)
     cK, c = CKD_pub(cK, c, n)
     result = cK.encode('hex')
     return result
Example #6
0
 def get_private_key(self, sequence, password):
     xprv = self.get_master_private_key(password)
     _, _, _, c, k = deserialize_xkey(xprv)
     pk = bip32_private_key(sequence, k, c)
     return pk
Example #7
0
 def check_password(self, password):
     xprv = pw_decode(self.xprv, password)
     if deserialize_xkey(xprv)[3] != deserialize_xkey(self.xpub)[3]:
         raise InvalidPassword()
Example #8
0
 def get_pubkey_from_xpub(self, xpub, sequence):
     _, _, _, c, cK = deserialize_xkey(xpub)
     for i in sequence:
         cK, c = CKD_pub(cK, c, i)
     return cK.encode('hex')
Example #9
0
 def get_private_key(self, sequence, password):
     xprv = self.get_master_private_key(password)
     _, _, _, c, k = deserialize_xkey(xprv)
     pk = bip32_private_key(sequence, k, c)
     return pk
Example #10
0
 def check_password(self, password):
     xprv = pw_decode(self.xprv, password)
     if deserialize_xkey(xprv)[3] != deserialize_xkey(self.xpub)[3]:
         raise InvalidPassword()
Example #11
0
 def get_pubkey_from_xpub(self, xpub, sequence):
     _, _, _, c, cK = deserialize_xkey(xpub)
     for i in sequence:
         cK, c = CKD_pub(cK, c, i)
     return cK.encode('hex')