TYPE 0x0621 · PLC FAMILY
LATCH_SET
Latch set contact. Activates when state is 0 (unset), allowing the latch to be set. Paired with RECURSE_MODIFIED to flip the state from 0 to 1. Once set, subsequent evaluations return UNSATISFIED until reset by a LATCH_RESET block.
PLC Non-InvertibleLadder Diagram
Fields
| Field | Data Type | Size | Side | Description |
|---|---|---|---|---|
| state | NUMERIC | 1-4 B | Conditions | Current latch state: 0 = unset, 1 = set |
| setter_pubkey | PUBKEY | 32-33 B | Witness | Setter key (folded out of conditions via merkle_pub_key; revealed at spend time and bound by Merkle proof). Required by HasRequiredPubkeys(block, 1) at consensus. |
Public key folded into Merkle leaf via merkle_pub_key (PubkeyCountForBlock = 1). No key field in conditions.
Wire Format Breakdown
0x0621
0
1
NUMERIC · 3B
Conditions ≈ 9 bytes
0x0621
0
1
PUBKEY · 35B
Witness ≈ 39 bytes
Total
≈ 48 bytes
Evaluation Logic
1.HasRequiredPubkeys(block, 1): at least one PUBKEY (the setter key) must be present in the merged block; else → ERROR. Pubkey identity is bound at MLSC-proof level via merkle_pub_key — the evaluator does not run a signature check itself; pair LATCH_SET with a SIG/MULTISIG block in the same rung to require a signature for state changes.
2.If no NUMERIC field present → SATISFIED (backward-compat structural-only mode — the rung is just a pubkey commitment).
3.ReadNumeric the first NUMERIC as
state; undecodable → ERROR4.If
state == 0 → SATISFIED (unset; the SET rung is active — pair with RECURSE_MODIFIED to enforce 0→1 in the output); else → UNSATISFIED (already set)Return Values
| Condition | Result |
|---|---|
| No PUBKEY in the merged block | ERROR |
| NUMERIC present but undecodable | ERROR |
| No NUMERIC field (structural-only / backward-compat) | SATISFIED |
state != 0 (already set) | UNSATISFIED |
state == 0 (unset, SET rung is live) | SATISFIED |
JSON Wire Format
Conditions (latch unset, ready to activate)
{
"type": "LATCH_SET",
"inverted": false,
"fields": [
{ "type": "NUMERIC", "value": 0 }
]
}This latch is in the unset state (0). A spend authorized by the setter key with RECURSE_MODIFIED will flip state to 1, after which the block becomes UNSATISFIED until a LATCH_RESET flips it back.
Use Cases
One-Time Authorization Toggles
A latch that can be set exactly once to authorize a spending path. Once set, the authorization is permanent within the covenant chain — it cannot be set again without a corresponding LATCH_RESET.
Feature Activation
Enable a covenant feature by setting the latch. Other blocks on the same or subsequent rungs can check the latch state to gate behavior on whether the feature has been activated.
Irreversible State Transitions
Without a paired LATCH_RESET, the set operation is irreversible. This models one-way state transitions like contract finalization or irrevocable approvals.