The soon-to-be proposed Segregated Witness soft fork is set to extend Bitcoin’s potential in several ways. One potentially promising innovation enabled by “SegWit” is MAST, an abbreviation for Merkelized Abstract Syntax Trees. While mainly designed to increase smart contract flexibility, MAST would increase scalability and privacy on the platform at the same time.
The idea of MAST originates from Blockstream developer Russell O’Connor, Blockstream and Bitcoin Core developer, Dr. Pieter Wuille, and Bitcoin Core developer, Peter Todd. It was recently drafted into an initial Bitcoin Improvement Proposal (BIP) by Bitcoin Core developer Dr. Johnson Lau.
Given its potential, MAST is surprisingly straightforward.
P2SH: A Primer
One part of the MAST puzzle is based on P2SH, which has been used in certain Bitcoin transactions for several years now.
All Bitcoin transactions in effect “lock bitcoins up” in outputs, which typically refer to Bitcoin addresses. These bitcoins are locked to be unlocked (and then locked again) in a later transaction; that’s how bitcoins effectively move from address to address.
This locking-up is really done with a script — a couple lines of code. For standard transactions, the script is included in the output and defines the requirement to spend