Overview
The Emergency Kit is Muun Wallet’s comprehensive backup solution. It’s a PDF document containing all the information needed to recover your Bitcoin funds, even if Muun’s servers are permanently offline.The Emergency Kit ensures true self-custody: you always maintain the ability to recover your funds independently, without Muun’s cooperation.
What’s in the Emergency Kit?
The Emergency Kit contains:-
Two encrypted private keys:
- Your user key (encrypted)
- Muun’s key (encrypted)
- Key fingerprints: For verification and derivation
- Output descriptors: Scripts for generating all address types
- Recovery code checksum: Validates your recovery code
- Verification code: Ensures PDF integrity
- Metadata: Birthday block, version info, technical details
Emergency Kit Versions
Muun has evolved the Emergency Kit format over time:| Version | Features | Use Case |
|---|---|---|
| -1 | Never exported | Wallet has no backup yet |
| 1 | Keys only | Manual entry, early wallets |
| 2 | Keys + Descriptors | PDF with standard scripts |
| 3 | Keys + Descriptors + MuSig | Current version with Taproot support |
libwallet/emergency_kit.go:10-19
Generation Process
Step 1: Prepare Input Data
- Both keys encrypted with the recovery code
- Fingerprints for key identification
- Recovery code checksum for validation
Step 2: Generate HTML
- Takes encrypted keys and fingerprints
- Generates localized HTML for PDF rendering
- Creates a verification code for integrity checking
- Serializes metadata for embedding
libwallet/emergency_kit.go:43-77
Step 3: Render PDF
The HTML is rendered to PDF using the device’s WebKit/Chromium engine. This happens in the native app code (Android/iOS), not in libwallet.Step 4: Embed Metadata
- Takes the rendered PDF
- Embeds machine-readable metadata
- Writes to final PDF file
- Preserves visual appearance
libwallet/emergency_kit.go:82-103
Metadata Structure
- Version: Emergency Kit format version
- Birthday Block: First block to scan during recovery
- Encrypted Keys: Both user and Muun keys with encryption details
- Output Descriptors: Scripts for all address types (V2-V6, Taproot, etc.)
- Recovery Code Checksum: Validates recovery code during recovery
libwallet/emergency_kit.go:105-143
Output Descriptors
Descriptors allow any Bitcoin wallet to derive your addresses:- P2SH scripts: For v2 addresses
- P2WSH scripts: For v3-v4 SegWit addresses
- Taproot scripts: For v5-v6 Taproot addresses with MuSig2
- Submarine swap scripts: For swap recovery
- Incoming swap scripts: For Lightning recovery
- Bitcoin Core descriptor wallets
- Other descriptor-compatible wallets
- Custom recovery tools
Encrypted Key Format
- Ephemeral Public Key: For ECDH key derivation
- Cipher Text: Encrypted private key + chain code (64 bytes)
- Salt: For key derivation function
- Recovery code → Scrypt → Challenge private key
- Challenge key + Ephemeral public key → ECDH → Encryption key
- Encryption key encrypts the master private key
Verification Code
The Emergency Kit includes a verification code:- Integrity check: Ensures PDF wasn’t corrupted or tampered with
- User verification: Displayed in app and on PDF for comparison
- Version tracking: Different codes for different kit versions
How to Use the Emergency Kit
Scenario 1: Muun Still Operational
If you lose your phone but Muun’s servers work:- Install Muun on a new device
- Choose “Recover wallet”
- Enter recovery code from your backup
- Wallet restores automatically with server assistance
Scenario 2: Muun Permanently Offline
If Muun’s servers are gone forever:- Obtain Emergency Kit PDF from your backup
- Extract encrypted keys from the PDF
- Use recovery code to decrypt both keys
- Import to recovery tool (Muun provides one, or use Bitcoin Core)
- Scan blockchain from birthday block onward
- Derive addresses using output descriptors
- Create transaction to sweep funds (requires both keys to sign)
Scenario 3: Partial Emergency
If you can access wallet but want to migrate:- Use Emergency Kit to import keys elsewhere
- Sweep funds to a new wallet
- Maintains continuity even if you stop trusting Muun
Storage Best Practices
Physical Storage
Digital Storage
If you must store digitally:- Encrypt the PDF with a strong password (separate from recovery code)
- Use offline storage (USB drive, not cloud)
- Multiple backups in different physical locations
- Test recovery process before relying on it
Recovery Code Storage
Critical: Store recovery code separately from Emergency Kit!- Write on paper, never digital
- Multiple copies in different locations
- Consider splitting across trusted parties
- Metal backup for fire/water resistance
Security Considerations
Threat Model
Protected Against:- Muun company disappearing
- Muun servers being hacked
- Muun becoming malicious
- Loss of your phone
- Forgotten passwords
- Theft of both Emergency Kit and recovery code
- Physical attacks forcing you to reveal recovery code
- Malware on the device during PDF generation
- Backdoored PDF reader during recovery
Encryption Strength
Keys are encrypted using:- Scrypt: Memory-hard KDF resistant to brute force
- ECDH: Elliptic curve Diffie-Hellman for key agreement
- Recovery code entropy: 128+ bits of randomness
PDF Security
The PDF itself:- Not password-protected: Anyone can open it
- Contains encrypted keys: Useless without recovery code
- Includes metadata: Machine-readable for tools
- Human-readable: Shows encrypted keys visually
Implementation Details
Why Two Keys?
The Emergency Kit contains both the user key and Muun’s key because:- 2-of-2 multisig: All UTXOs require both signatures
- Independent recovery: Don’t need Muun’s cooperation
- Full control: Can sweep funds without any server
- Trust minimization: Muun can’t prevent your recovery
Birthday Block Optimization
- Start scanning here: No need to scan the entire blockchain
- Skip empty blocks: Faster recovery
- Reduce bandwidth: Only download relevant blocks
Advanced: Manual Decryption
For understanding or custom tools, the decryption process:- Recovery code → Challenge private key (via Scrypt)
- Challenge private key + Ephemeral public key → Shared secret (via ECDH)
- Shared secret decrypts cipher text
- Plaintext = 32 bytes private key + 32 bytes chain code
- Reconstruct BIP32 HD key from these 64 bytes
libwallet/challenge_keys.go:92-115
Related Features
Recovery
Step-by-step recovery procedures using the Emergency Kit
Recovery Code
Understanding and managing your recovery code
Multisig
Why the Emergency Kit contains both multisig keys
Security Cards
How security cards integrate with emergency recovery