Merkelized Alternative Script Tree (MAST)

2 min read

A Merkelized Alternative Script Tree (MAST) is a proposal to encapsulate an arbitrary number of different scripts in a Bitcoin address. The concept is now part of the Taproot upgrade. MAST expands the flexibility and utility of Bitcoin contracts in an inexpensive and privacy preserving way.

The original proposal for the concept of MAST was named Merkelized Abstract Syntax Tree. However, since the current version of the proposal no longer implements abstract syntax trees, the name was changed in 2018.

In order to avoid taking up large amounts of space by including many scripts in a transaction, a Merkle tree is used to summarize the collection of possible spending scripts. In this way, MAST is similar to a P2SH script, except that the script hash of a MAST transaction represents multiple scripts. When bitcoin is sent to a MAST output, the bitcoin is technically locked to the Merkle root of these scripts. To spend the bitcoin, the spender must reveal the script which they are using to unlock the bitcoin,as well as proof that this script is included in the Merkle root of the previous transaction. The privacy and efficiency improvements come from the fact that the spender of a MAST output need not reveal all of the scripts, only the one they used.