Skip to content

Instantly share code, notes, and snippets.

@jleo84
jleo84 / key_converter.py
Created September 2, 2020 01:45
Convert any Bitcoin key prefix to another (e.g.: xpub to ypub, zpriv to Zpriv)
import hashlib
import base58
import sys
prefix_dict = {
"xprv": "0488ade4", # Mainnet - P2PKH or P2SH - m/44'/0'
"yprv": "049d7878", # Mainnet - P2WPKH in P2SH - m/49'/0'
"zprv": "04b2430c", # Mainnet - P2WPKH - m/84'/0'
"Yprv": "0295b005", # Mainnet - Multi-signature P2WSH in P2SH
"Zprv": "02aa7a99", # Mainnet - Multi-signature P2WSH