Last active
November 17, 2022 21:15
-
-
Save 0xBEEFCAF3/9b69c23e494842cce0c58eff75cc8da3 to your computer and use it in GitHub Desktop.
Parse Xpub Components
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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