def hex_private_key_to_WIF_private_key(hex_key):
"""
Converts a raw 256-bit hex private key to WIF format
returns => <string> in hex format
"""
hex_key_with_prefix = "80" + hex_key
h1 = hash_sha256(hex_key_with_prefix.decode("hex"))
h2 = hash_sha256(h1.decode("hex"))
checksum = h2[0:8]
wif_key_before_base58Check = hex_key_with_prefix + checksum
wif_key = b58encode(wif_key_before_base58Check.decode("hex"))
return wif_key
################################################################################################
#
# Bitcoin helper functions
#
################################################################################################
评论列表
文章目录