2

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?

1 Answer 1

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.

6
  • 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? Aug 4, 2021 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. Aug 4, 2021 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<txn, bool> 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. Aug 5, 2021 at 17:28
  • 1
    so 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. Aug 5, 2021 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. Aug 8, 2021 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.