Skip to content

Instantly share code, notes, and snippets.

@freenancial
Created August 5, 2020 06:31
Show Gist options
  • Save freenancial/d82fec076c13158fd34d1c4300b2b300 to your computer and use it in GitHub Desktop.
Save freenancial/d82fec076c13158fd34d1c4300b2b300 to your computer and use it in GitHub Desktop.
Convert xpub/xprv to zpub/zprv
import base58
x = 'xprv9s21ZrQH143K2f55zo5GiXiX16MiPzBgc2bEXNd77e1ooGsjxAyXjozyuniqiSB76VESjTW8s7vdsK3NFboha6tZgF9BzcDdNtUT6Aw99P2'
zp = b'\x04\xb2\x43\x0c'
base58.b58encode_check(zp + base58.b58decode_check(x)[4:]).decode('ascii')
# output: 'zprvAWgYBBk7JR8GjFTKfWeX8huXM2ecHEAgSFdg6AQssemZuUWCTVJeywKFxCe1iFUwumU4EQhFnSdjdtGVgzdjAaFmQvY3ARrbvLbjsLf6oNE'
# xprv = b'\x04\x88\xad\xe4'
# yprv = b'\x04\x9d\x78\x78'
# zprv = b'\x04\xb2\x43\x0c'
# xpub = b'\x04\x88\xb2\x1e'
# ypub = b'\x04\x9d\x7c\xb2'
# zpub = b'\x04\xb2\x47\x46'
@ArmanTheParman
Copy link

How do we get the taproot extended public and private keys?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment