Bitcoin — Private key → addresses

Summary

TypeAddress

Derivation

Step 1 — Decode private key

Hex:


  
Step 2 — Public key (k·G)

Uncompressed (65 bytes, 04 || X || Y):


    

Compressed (33 bytes, 02|03 || X):


  
Step 3 — Hash160

Hash160 of uncompressed pubkey:


    

Hash160 of compressed pubkey:


  
Step 4a — Legacy P2PKH (uncompressed)

address = Base58Check(0x00 || hash160_uncompressed)

Step 4b — Legacy P2PKH (compressed)

address = Base58Check(0x00 || hash160_compressed)

Step 5 — P2SH-wrapped SegWit

redeemScript = 0x00 0x14 || hash160_compressed


    

script_hash = Hash160(redeemScript)


    

address = Base58Check(0x05 || script_hash)

Step 6 — Native SegWit (P2WPKH, BIP-173)

address = bech32("bc", witness_version=0, hash160_compressed)

Step 7 — Taproot (P2TR, BIP-86)

internal_key (x-only, 32 bytes):


    

t = tagged_hash("TapTweak", internal_key):


    

output_key = X(lift_x(internal_key) + t·G):


    

address = bech32m("bc", witness_version=1, output_key)