The Archaeological Bitcoin Wallet
Strata is a CLI-based Bitcoin wallet built in Rust for educational purposes. Unlike production wallets that hide the complexity of the protocol, Strata is designed to expose the raw machinery of Bitcoin.
This project is an "archaeological dig" through Bitcoin's script history—traversing from the Satoshi-era P2PK bedrock to the modern Taproot surface.
- Manual Scripting: Construct every major Bitcoin locking (
scriptPubKey) and unlocking (scriptSig/witness) script manually. - Granular Control: No automated coin selection. You choose the UTXOs, you calculate the weights, and you set the fees.
- Full Compatibility: Support for P2PK, P2PKH, P2SH, P2WPKH, P2WSH, and P2TR.
- Protocol Mastery: Deep dive into Sighash algorithms, Bech32m encoding, and the Bitcoin Stack Machine.
| Component | Responsibility | Tools |
|---|---|---|
| Identity | BIP39 Mnemonics & BIP32 Key Trees | bip39, rust-bitcoin |
| Script Lab | Logic for P2PK, P2PKH, SegWit, Taproot | rust-bitcoin (Builder) |
| Observer | Fetching UTXOs and network state | esplora-client (Signet) |
| Craftsman | Manual Tx assembly and manual signing | rust-bitcoin (Transaction) |
You can use real Bitcoins at any time to test the different functionalities of the wallet, but it is suggested to use testnet as the wallet was not deeply tested nor audited. For using Signet testnet you can do the following:
- Get some coins by using Signet BTC Faucet
- Make sure to send this to a generated address with network signet flag
strata receive --network signet
- Make sure to send this to a generated address with network signet flag
- For receiving some classic P2PK (unsupported by modern wallets) you can use this P2PK Playground
- Initialize Rust project.
- Implement BIP-39: Generate Mnemonic and 512-bit Seed.
- Implement BIP-32: Master Xpriv derivation and child key derivation.
- Create an "Address Generator" command to derive:
- P2PK (Raw Pubkey Hex - No standard address)
- P2PKH (Legacy -
1...orm/n...for Testnet) - P2WPKH (Native SegWit -
bc1q...ortb1q...) - P2TR (Taproot -
bc1p...ortb1p...)
- Integrate an Esplora client (mempool.space API).
- Create a
utxo lscommand that scans your derived addresses. - Display UTXO data: TXID, Vout, Amount, and ScriptType.
- Verify blocks headers as a true SPV client
- Implement manual Transaction Building:
- Input Selection: User manually selects inputs.
- Sighash Generation: Manually hash the transaction data.
- The Signing Logic: Manually sign and attach to
scriptSigorwitness.
- Spend a P2PK output (The Satoshi Test).
- Spend a P2PKH output (The Legacy Test).
- Spend a P2WPKH output (The SegWit Test).
- Implement P2SH (2-of-3 Multisig).
- Implement P2WSH (SegWit Multisig).
- Create a "Multisig Coordinator" flow to collect signatures.
- Implement Taproot Key-path spends (Schnorr signatures).
- Implement Taproot Script-path spends (Merkle Trees/MAST).
# Generate a new master seed
strata generate --words 12
# Derive addresses for receiving BTC
strata receive --type p2wpkh
# List available UTXOs across all scripts
strata utxo ls
# Manually craft a spend
strata send --input <TXID:VOUT> --to <ADDR> --fee <SATS_vB>- First ever transaction made with this wallet