So, somebody asked me about MAST yesterday.
Apparently, it's formalized in BIP114 – Merkelized Abstract Syntax Trees.
I couldn't explain what it was and what advantages it'll bring us.
What are MAST, and how will they help with scaling?
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.Sign up to join this community
From what I've read and heard about MAST, it's an alternate version of pay-to-script-hash that uses a Merkle root instead of a regular hash digest. It combines this idea with that of an abstract syntax tree, which is a data structure that compilers use to parse source code. By "Merkelizing" a syntax tree, it allows redeemers to only expose the parts of the script being used for redemption.
This means that you can have more complicated scripts than are currently allowed by the 10,000 byte or 201 OP code limit. Let's say there's a redemption script whose conditions look something like this:
A OR (B AND (C OR D)) OR ((E OR F OR (G AND H)) AND NOT I)
Right now, this script would be too complicated to fit inside the limit. By forming it into a syntax tree and Merkelizing it, a redeeming transaction would only have to expose the conditions that were met. For example, just
A would redeem it, and so would just
C. This fits inside the size limit, while also never revealing the unused conditions that could have been used to redeem the UTXO. There's a complexity gain without introducing the risk of DOS attacks, as well as a privacy gain.
I'm unsure how this will directly help with scaling, but since it allows for more complex scripts without a transaction size increase, it certainly won't hurt. It's just another building block at the disposal of a developer, which they can then hopefully use to solve some future problem.