Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
convert xpub to ypub
from electrum import bitcoin
xpub1 = 'xpub661MyMwAqRbcEcF8odLPZvkWA3xi9ptJqzfzzFFmvNcRtnGb2wzKgVCNN8i1uAwa6kwXLgG7atobaSoExfhpxDfuQp3FfSKPWcocLxKJyk9'
xtype, depth, fingerprint, child_number, c, K_or_k = bitcoin.deserialize_xkey(xpub1, False)
xpub2 = bitcoin.serialize_xpub('p2wpkh-p2sh', c, K_or_k, depth, fingerprint, child_number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.