Miniscript: Bitcoin's Policy Language That Makes Smart Contracts Readable
Bitcoin has always had programmable money. You can create scripts that say “Alice can spend immediately, OR Bob can spend after a week.” The problem? Actually writing those scripts was like coding in assembly language while blindfolded.
Enter Miniscript: a structured language that sits between human-readable policies and raw Bitcoin Script. It makes advanced spending conditions analyzable, composable, and actually safe to deploy.
The problem: Bitcoin Script is powerful but opaque
Bitcoin Script can do impressive things. But working with it directly is treacherous:
- Impossible to analyze: Hand a script to a wallet, and it can’t tell you what it does without custom code.
- Composition nightmares: Try combining “2-of-3 multisig” with “OR single key after timeout” and you’ll hit malleability bugs, resource limits, or scripts that lock funds forever.
- No generic signing logic: Every script template needs custom wallet code.
- Unpredictable costs: You can’t reliably estimate fees until you’ve already spent.
Miniscript fixes this by adding structure. It’s a formal specification that guarantees correctness before deployment.
How it works: three layers
Miniscript is actually three things at once:
1. A structured subset of Bitcoin Script
Every Miniscript expression has well-defined properties: type, correctness guarantees, malleability status, and exact resource costs. Before you deploy, you know it works.
2. A human-readable policy language
Instead of wrestling with opcodes, you write:
or(pk(alice), and(pk(bob), older(1008)))
That compiles to Miniscript, which compiles to Bitcoin Script. One mistake in raw Script locks funds forever. One mistake in policy? The compiler catches it.
3. A formal specification (BIP 379)
The BIP 379 spec defines fragment semantics, a type system for correctness, satisfaction rules, and malleability analysis. Wallets that support Miniscript can automatically:
- Understand what a script does
- Figure out how to satisfy it
- Calculate exact costs
- Verify it’s non-malleable
No custom code per template. It just works.
Real use cases
Timelocked inheritance
You want primary control, but if you’re inactive for six months, your heir can recover.
Policy:
or(pk(my_key), and(older(25920), pk(heir_key)))
Normally you sign with your key. If you’re gone, the heir waits six months (25,920 blocks) and spends with theirs. Liana wallet builds exactly this pattern.
Decaying multisig
Corporate treasury starts as 3-of-3, relaxes to 2-of-3 after six months, then 1-of-3 after nine.
Policy:
or(multi(3,key1,key2,key3),
or(and(older(25920), multi(2,key1,key2,key3)),
and(older(38880), pk(key1))))
High security for fresh funds, but prevents total loss if keys are misplaced.
Hash lock with timeout
Lightning-style hash time-locked contract (HTLC):
Policy:
or(and(sha256(preimage_hash), pk(recipient)),
and(older(144), pk(sender)))
Recipient claims with preimage + signature. After timeout (144 blocks ≈ one day), sender reclaims.
The killer feature: type safety
Miniscript’s type system guarantees correctness at composition time. When you combine two Miniscripts, the type checker verifies the result is valid Bitcoin Script before you deploy it.
Four basic types:
- B (Base): Pushes 0 (fail) or nonzero (success). Example:
older(1000) - V (Verify): Continues or aborts. Example:
v:pk(key)=<key> CHECKSIGVERIFY - K (Key): Pushes a pubkey. Example:
pk_h(key) - W (Wrapped): Takes input from below top of stack. Example:
s:pk(key)
Plus type modifiers tracking malleability, stack consumption, and dissatisfiability.
The result? If your Miniscript compiles, it works. No “oops, this script is unspendable.”
Wallet support (March 2026)
Full support:
| Wallet | P2WSH | Taproot | Since |
|---|---|---|---|
| Bitcoin Core | ✅ v25.0 | ✅ v26.0 | May 2023 |
| Liana | ✅ | ✅ (planned) | May 2023 |
| Nunchuk | ✅ | ✅ | August 2025 |
| Ledger | ✅ | ✅ | February 2023 |
| Blockstream Jade | ✅ | ✅ | July 2024 |
| BitBox02 | ✅ | ❓ | May 2025 |
| Coldcard | ✅ | ✅ | 2025 |
Partial/none:
- Sparrow: Standard multisig only. No arbitrary Miniscript as of mid-2025 (GitHub issue #1700).
- Trezor: No support as of 2025.
Adoption is growing, but wallet interop is still rough. Importing a Liana descriptor into Sparrow won’t work yet.
Example: Liana wallet
Liana (1.0 released May 2023) is the first production wallet built on Miniscript. Every Liana wallet has:
- Primary path: Immediate spending (single-sig or multisig)
- Recovery path: Timelocked backup keys
Descriptor:
wsh(or_d(
pk(primary_key),
and_v(v:older(26280), pk(recovery_key))
))
Before Miniscript, this would need custom Bitcoin Core patches. Hardware wallets couldn’t verify the script. There was no way to prove correctness.
With Miniscript:
- Bitcoin Core natively supports it
- Ledger/Jade display “Primary: You, Recovery: Your heir (6mo)”
- The wallet can prove: “This script is non-malleable, costs X bytes, never hits limits”
The unbackdoorable wallet
One of the most powerful applications: trustless wallets that protect against hardware backdoors.
In May 2024, Ledger published a design for multi-path Miniscript with:
- Primary path: Hardware key + software hot key (2-of-2)
- Recovery path 1: After six months, hot recovery key + blinded third-party key
- Recovery path 2: After nine months, hardware failsafe key (single-sig)
Key insights:
- Hardware can’t steal (needs hot key)
- Software can’t steal (needs hardware sig)
- If hardware fails (loses key, goes rogue), recovery paths kick in
- Third party is blinded (can’t spy on UTXOs until you request recovery)
After setup, it works like a normal wallet. The complexity is invisible.
Limitations
Miniscript can’t do:
- Covenants: Can’t restrict where funds go (no OP_CTV, OP_VAULT, etc.)
- Turing-completeness: Still limited to Bitcoin Script’s expressiveness
- Dynamic conditions: Can’t change script based on blockchain state
- Cross-input constraints: Each input’s script is independent
Taproot tradeoffs:
Benefit: Script-path spends hide unused branches. A three-branch Taproot Miniscript only reveals one branch when spent. Huge privacy and efficiency gain.
Cost: Taproot deprecated CHECKMULTISIG, replaced with CHECKSIGADD. k-of-n multisig now requires k separate operations (less efficient for large k).
Why this matters
Miniscript unlocks Bitcoin Script’s potential without a soft fork. It’s arguably more important than new opcodes because it makes existing features usable.
If every wallet supported Miniscript, we’d see an explosion in creative custody solutions: inheritance planning, corporate governance, decaying multisigs. All without changing consensus.
Best analogy? Miniscript is to Bitcoin Script what SQL is to database files: a structured language that makes a powerful-but-opaque system accessible to developers.
And now, accessible to your wallet.
Bitcoin Optech - Miniscript Topic, BIP 379 Specification, Bitcoin Core 25.0 Release Notes, Bitcoin Core 26.0 Release Notes, Liana Wallet, Ledger - Towards a Trustless Bitcoin Wallet, Blockstream Jade Miniscript Support, Sparrow Issue #1700, Nunchuk Miniscript Integration, BitBox02 Miniscript Guide. Data as of March 15, 2026.