Docs · 06 / 8
Execution
How the indexer verifies and applies an action, and what makes it invalid.
The pipeline
For every transaction in every block, the indexer decides in this order:
- Is it a deploy? A reveal whose input 0 carries a valid envelope (see Deploying). If so it stores the program and runs
init. - Is it an action? Every input must be a valid program-account leaf spend (see Actions). If any input is not, the transaction is ignored: it is not an action.
- The OP_RETURN must hold JSON with a
prog_idnaming a deployed program, and the input leaves must carry that program'scmr. A differentcmr, or an unknown program, means the transaction is ignored. - Output 1 must be input 0's own program account, and the transaction must have at least 3 outputs.
- The action must have
pequal tosats-20, and anopthat is one of the program's write methods. - The method's
requireconditions are evaluated, then itssetsteps. If anything fails, the action is rejected and no state changes. - On success the writes and the record are saved atomically, and an action already recorded is never applied twice.
Invalid actions
An invalid action is simply not part of the protocol state; nothing needs to be undone. An action is invalid when any of the following holds:
- An input is not a valid program-account leaf spend.
- The
prog_idis unknown, or an input leaf carries a differentcmr. - Output 1 is not input 0's own program account, or there are fewer than 3 outputs.
pis notsats-20, oropis not a write method of the program.- A
requirefails, or a step fails (for example division by zero or an out-of-range$txindex).