Both Minsc and Sapio are high level scripting languages that compile down to Miniscript. What are the differences between the two? When should I use one over the other?
Asked
Active
Viewed 81 times
1 Answers
1
The two have very little to do with one another.
- Minsc is a scripting tool for defining keys.
- Sapio is a compiler framework for defining covenant contracts.
You could, if you wanted, use Minsc from Sapio as a plugin for defining the unlocking conditions in any given Sapio program path, but you could not use Sapio inside of Minsc in the same way.
Sapio does not compile down to miniscript; it has it's own compiled object format that contains miniscript. There is other stuff in there as well.
Jeremy Rubin
- 299
- 1
- 5
-
A covenant contract has to produce a script that goes onchain. I get that OP_CTV adds an extra opcode to Script (other than that Script stays the same). But at least in theory in a world where OP_CTV has activated on mainnet Miniscript could be extended to support OP_CTV? Just like Miniscript will hopefully be extended to support Taproot? – Michael Folkson Aug 04 '21 at 16:27
-
Perhaps as Miniscript only encodes a subset of Script you've made the decision to bypass Miniscript as you want the full Script functionality... but it is impossible to bypass Script. Somehow a Sapio contract needs to turn into Script. – Michael Folkson Aug 04 '21 at 16:38
-
yes, miniscript would have CTV support -- you can see i've added it to my fork of rust miniscript. it's missing the point though. think of miniscript/minsc as generally being focused on the problem of "compiling a single function that has the API `bool spend(SigningData, Utxo)`. Sapio is focused on the problem of `either
spend(SigningData, Utxo)`. The functions are fundamentally different types. miniscript/minsc tell you true/false, sapio tells you either a specific txn OR anything OR not valid. – Jeremy Rubin Aug 05 '21 at 17:28 -
1so what you're missing is that sapio encodes state transitions and unlocking conditions, whereas minsc/miniscript just encodes the specific unlocking conditions. of course you could consider the state transitions to be part of the unlocking condition, but that's not what miniscript or minsc have been designed to think about. – Jeremy Rubin Aug 05 '21 at 17:29
-
So across multiple transactions (multiple locking and unlocking) rather than just a locking script within a single UTXO? State transitions can only really happen across transactions in Bitcoin so it must be that. – Michael Folkson Aug 08 '21 at 12:24
-
exactly; sapio lets you author transactions and scripts, not just scripts. the transactions are embedded in the scripts of course through ctv – Jeremy Rubin Aug 09 '21 at 17:04