The MATT (Merkleize All The Things) framework introduces stateful contracts to the Bitcoin network. Unlike standard scripts that evaluate transactions independently, MATT allows data to persist across multiple transactions by embedding contract states directly into Taproot output keys.
The core of this framework is the proposed OP_CHECKCONTRACTVERIFY (OP_CCV) opcode. It enables scripts to verify that a Taproot output key is correctly tweaked to commit to specific state data. The opcode supports three operational modes: default, deduct, and ignore, which manage how BTC values are allocated across outputs while allowing for dynamic fee adjustments.
When combined with OP_CAT, which enables byte concatenation, the MATT framework can construct and verify Merkle proofs on-chain. This combination facilitates the creation of fraud-proof systems similar to optimistic rollups, where long computations occur off-chain and only disputed steps require on-chain verification.
This approach provides a more general design for implementing vaults compared to previous proposals like OP_VAULT. By enforcing state transitions on-chain, MATT avoids the need for complex pre-signed transaction graphs or one-time signatures, offering a more robust method for maintaining state consistency.






