Merklized Abstract Syntax Tree (MAST) is a BIP (Bitcoin Improvement Proposal) that will enable Bitcoin to facilitate incredibly complex smart contracts, by extrapolating the power of Merkle trees and adding onto the current P2SH (Pay to Script Hash) capabilities of Bitcoin.
Combining the best of both worlds there is MAST, a solution that is capable of limiting and guiding conditionals for transactions, while at the same time having the flexibility of using only the most important parts of the smart contract that governs the transaction, instead of using the entire contract.
By far the best article to learn about MAST is a Medium post written by David A. Harding, who does an incredible job at explaining all working parts that go into MAST.
What are the benefits of using MAST?
Unlike pure P2SH transactions, the sender doesn’t need to include the entire script to unlock the funds contained in the transaction. Regular P2SH transactions have to reveal all conditions thus sharing unnecessary details and making them public. MAST makes sure that only the chosen/used valid condition is shared when making a transaction.
The exact same thing that increases privacy, also saves a lot of space and therefore produces lower transaction fees. With MAST making a wildly complicated smart contract payment scheme is no different than making a 2 conditional transaction, just have a look at the graph above.
Bigger Smart Contracts
For a long time now, smart contracts have been a very important topic for both developers and intermediate users of Bitcoin. All in all, it is very difficult for people to create, secure, and maintain multi-sig accounts. Even if created, they would be limited by their size.
This is no longer the case when MAST is implemented because as we’ve seen on the graph above it doesn’t increase in size when more conditions are added to the transaction. Actually, MAST is so efficient at using exactly how much space it needs that is has inspired this following quote:
“Indeed, MAST scales so well that if you had at your disposal all of the energy believed to exist in the entire observable universe, you could only create a balanced merkle tree whose merkle proof would be about 8,448 bytes in size.” – David A. Harding
What is necessary for MAST to become a reality?
The first part is done. Segwit needed to be activated in order for all of us to be able to even consider implementing MAST. But it will take more time before this functionality is voted into the network. It took more than two years of debating, convincing, and explaining to get SegWit activated.
Bitcoin is a slowly changeable network, and I believe that is for the best. After all, we are talking about one of the most innovative financial instruments of the 21st century, regardless of the fact that it is a technological fossil by now. The most important thing is that it has proven itself to be a safe storage of value.
If you want to gain even more knowledge about MAST, how it is projected to work and ways of implementing it, refer to the links below and explore. These are some of the most relevant resources out there.
The latest update on MAST is a message from Gregory Maxwell, where he talks about some privacy issues with the current MAST model and introduces a feature that he likes to call Taproot. This would make smart contracts completely indistinguishable from regular, boring payments on the network. Without Taproots, MAST still shows the transaction as being part of a smart contract, but only reveals the condition that was actually used.