This is a pure Python 3 script that takes a Bitcoin WIF (Wallet Import Format) private key as input and generates all three common types of Bitcoin addresses:
- Legacy (P2PKH, starting with
1
) - Compatibility / Nested SegWit (P2SH, starting with
3
) - Native SegWit (Bech32, starting with
bc1
)
It generates addresses for both compressed and uncompressed public keys, fully compliant with Bitcoin standards.
✅ No external libraries are used — the script implements everything from scratch:
ECC math, Base58Check, Bech32, RIPEMD160, SHA256, etc.
- Parses mainnet WIF private keys (compressed & uncompressed)
- Performs elliptic curve multiplication (secp256k1) manually
- Supports:
- P2PKH address generation (
1...
) - P2SH-P2WPKH nested addresses (
3...
) - Native SegWit Bech32 addresses (
bc1...
)
- P2PKH address generation (
- Fully offline / air-gapped compatible
- No dependencies (only uses Python standard
hashlib
)
$ python3 bitcoin_wif_address_generator.py
Enter Bitcoin WIF private key: 5HueCGU8rMjxEXxiPuD5BDuRa1fFzS2yBXDyzZYG6zDMydEvQXt
Private key (decimal): 1
Compressed: False
Addresses (uncompressed):
P2PKH: 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH
P2SH: 3Ma8dF25z3cDei3KnL8rUrsVxEGL6bdymv
Bech32: bc1qq24kshw8r33z6dnj0t4u8m8w85up2zvszsaf8y
Addresses (compressed):
P2PKH: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
P2SH: 3CMNFxN1oHBc4R1EpboAL5yzHGgE611Xou
Bech32: bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kygt080