Exemplo n.º 1
0
def encode_base58_checksum(raw):
    checksum = hash256(raw)[:4]
    return encode_base58(raw + checksum)
Exemplo n.º 2
0
 def get_pfx(self):
     return encode_base58(self.pfx)
Exemplo n.º 3
0
#
# Convert the following hex to binary and then to Base58:
#
# * `7c076ff316692a3d7eb3c3bb0f8b1488cf72e1afcd929e29307032997a838a3d`
# * `eff69ef2b1bd93a66ed5219add4fb51e11a840f404876325a1e8ffe0529a2c`
# * `c7207fee197d27c618aea621406f6bf5ef6fca38681d82b2f06fddbdce6feab6`

# In[5]:

# Exercise 4
# Convert the following hex to binary and then to Base58

from helper import encode_base58
# 7c076ff316692a3d7eb3c3bb0f8b1488cf72e1afcd929e29307032997a838a3d
h = '7c076ff316692a3d7eb3c3bb0f8b1488cf72e1afcd929e29307032997a838a3d'
print(encode_base58(bytes.fromhex(h)))
# result : 9MA8fRQrT4u8Zj8ZRd6MAiiyaxb2Y1CMpvVkHQu5hVM6

# eff69ef2b1bd93a66ed5219add4fb51e11a840f404876325a1e8ffe0529a2c
h = 'eff69ef2b1bd93a66ed5219add4fb51e11a840f404876325a1e8ffe0529a2c'
print(encode_base58(bytes.fromhex(h)))
# result : 4fE3H2E6XMp4SsxtwinF7w9a34ooUrwWe4WsW1458Pd

# c7207fee197d27c618aea621406f6bf5ef6fca38681d82b2f06fddbdce6feab6
h = 'c7207fee197d27c618aea621406f6bf5ef6fca38681d82b2f06fddbdce6feab6'
print(encode_base58(bytes.fromhex(h)))
# result : EQJsjkd6JaGwxrjEhfeqPenqHwrBmPQZjJGNSCHBkcF7

# ### Exercise 5
#
# Find the address corresponding to Public Keys whose Private Key secrets are:
Exemplo n.º 4
0
 def __repr__(self):
     return encode_base58(self.serialize())
Exemplo n.º 5
0
def encode_base58_checksum(raw):
    checksum = hash256(raw)[:4]
    base58 = encode_base58(raw + checksum)
    return base58.decode('ascii')