Skip to content

Instantly share code, notes, and snippets.

@0xBEEFCAF3
Last active November 17, 2022 21:15
Show Gist options
  • Save 0xBEEFCAF3/9b69c23e494842cce0c58eff75cc8da3 to your computer and use it in GitHub Desktop.
Save 0xBEEFCAF3/9b69c23e494842cce0c58eff75cc8da3 to your computer and use it in GitHub Desktop.
Parse Xpub Components
def to_hd_node(base58DecodedXpub):
try:
return {
'version': base58DecodedXpub[0:8],
'depth': base58DecodedXpub[8:10],
'pfp': base58DecodedXpub[10:18],
'index': base58DecodedXpub[18:26],
'chaincode': base58DecodedXpub[26:90],
'key': base58DecodedXpub[90:156],
'checksum': base58DecodedXpub[156:164]
}
except:
print('Invalid decoded xpub')
print(to_hd_node('0488b21e0000000000000000008f3036cc81d2d821e14a1b8971bf850e2838f295b5b84dc3ffb2a5730cdf2237039df9c8c0227088bc04548d419d26f2369c01dfffcbddc6e3cfbbe703fe48cedbd865c8fa'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment