sapio-lang / sapio

A Bitcoin Programming Language
Mozilla Public License 2.0
244 stars 43 forks source link

More Efficient Emulator API #100

Open JeremyRubin opened 3 years ago

JeremyRubin commented 3 years ago

Currently we call the emulator API on each individual template during compilation.

Instead of doing that, investigate an API where all calls can be batched at the same time.

Why?

This gives flexibility of the Emulator to return a global clause that can be satisfied by any txtemplate. E.g., we could change the concrete emulator API to derive the key from a merkle tree of all txtemplate psbts passed, and require a merkle path in order to sign with a given key?

This is important for reducing the script size without taproot or ctv.

JeremyRubin commented 2 years ago

Currently, CTV Emulation is done via a plugin system, and the Emulator plugin must be remembered. We should make the emulation info have some SIMPs that include the instructions for getting emulators to sign.

This way we can separate out the notion of emulation as requiring some sort of special casing, it's just a SIMP for pre-signing with particular servers