Here's an easy explainer!
# What is miniscript?
Normal #Bitcoin Script is the set of instructions used to determine whether a particular coin can be spent.
Miniscript is a smaller set of pre-designed instruction chunks.
That's not very helpful though, is it?
In Bitcoin, every coin is locked with a locking script that gives instructions for how to spend it.
Nodes will only allow a coin to be spent if the tx has an unlocking script that follows these instructions.
Most coins have pretty simple locking scripts:
- Provide a signature
- Provide a public key
- check that the signature is valid for that public key
But they can also get a little wild!
multisig! timelocks! hash puzzles!
If you want to lock a coin with long list of complicated instructions...
It becomes difficult to:
- be sure of all valid spend cases
- predict the cheapest size tx to spend it
- combine it with other locking scripts
Enter miniscript! A small (mini) set of pre-designed chunks of instructions for your coins.
These mini chunks of Bitcoin Script are easier to reason about and automate in wallet software.
Using raw Bitcoin Script is a bit like playing tetris without being able to see which way the tetrominoes are oriented until they land.
Miniscript lets you play around with the tetrominoes on the way down.
Building complex Bitcoin scripts by hand is a recipe for disaster!
Miniscript ensures your script does what it says it does, nothing else.
Describe a script in Miniscript, and you get a corresponding Bitcoin Script that enforces only that.
A famous bitcoiner said something like:
Miniscript is Bitcoin's way of getting away with the fact that nobody really understand's Script.
# History:
- Initially conceived by Andrew Poelstra and Peter Wuille in 2019
- Further developed by @sanket1729 at @Blockstream
- Together with @achow101 and @darosior, they all wrote BIP-379 (Miniscript).
# Links:
Here's some links to learn more:
@bitcoinoptech: https://bitcoinops.org/en/topics/miniscript/
BIP-379: https://github.com/bitcoin/bips/blob/master/bip-0379.md
@darosior: https://bitcoinops.org/en/wizardsardine-miniscript/
Wuille: https://bitcoin.sipa.be/miniscript/
If you want to use a wallet that takes advantage of miniscirpt, check out Liana Wallet!
https://wizardsardine.com/liana/
