MAST

Also: Merkelized Abstract Syntax Tree

cryptography · advanced

An optimization where a script's branches are committed via a merkle tree. Only the branch actually executed is revealed on-chain.

Pre-MAST, spending a complex script revealed every possible branch. A vault with five conditional spending paths showed all five conditions on-chain, even if only one was used. MAST replaces this with a merkle root: the locking script commits to all possible branches, but the spender reveals only the path they took plus a merkle proof.

The savings are real. A 100-branch policy that pre-MAST cost ~3 KB on-chain costs only ~200 bytes with MAST — the script for one branch plus the proof. The privacy gain is bigger: unused branches stay hidden forever.

MAST as a standalone concept (BIP-114, BIP-117, BIP-98) never activated. Taproot subsumed it. The Tapscript spending path uses MAST internally — every Taproot output with multiple script alternatives is a MAST, even though the user never has to think about it.

Related terms