TYPE 0x0681 · PLC FAMILY
COSIGN
Co-spend constraint. Requires another input in the same transaction to have a spent output whose scriptPubKey hash matches the committed HASH256. Enforces cross-input dependencies for atomic multi-UTXO operations. No Tapscript equivalent exists.
PLC Cross-Input Non-InvertibleLadder Diagram
Fields
| Field | Data Type | Size | Side | Description |
|---|---|---|---|---|
| script_hash | HASH256 | 32 B | Conditions | SHA-256 hash of the anchor's conditions scriptPubKey that must appear as a spent output in another input |
No witness fields required. The transaction context provides the spent outputs of all other inputs for cross-reference.
Wire Format Breakdown
0x0681
0
1
HASH256 · 32B
Conditions = 38 bytes
0x0681
0
0
Witness = 4 bytes (empty block)
Total
42 bytes
Evaluation Logic
1.Locate the conditions HASH256 field. Missing or not exactly 32 bytes → ERROR
2.Require
ctx.tx and ctx.spent_outputs; either missing → ERROR (fail-closed — the cross-input check cannot be performed without spending-context).3.Iterate every other input
i (skip i == ctx.input_index; skip i ≥ ctx.spent_output_count). Compute SHA256 of spent_outputs[i].script_pub_key using a single CSHA256().Write(spk).Finalize.4.
memcmp against the committed HASH256. First match → SATISFIED (returns immediately). Loop completes with no match → UNSATISFIEDReturn Values
| Condition | Result |
|---|---|
| HASH256 field missing or not exactly 32 bytes | ERROR |
No ctx.tx or ctx.spent_outputs (cross-input check needs spend context) | ERROR |
| No other input's spent scriptPubKey hash matches | UNSATISFIED |
| At least one other input's spent scriptPubKey hash matches | SATISFIED |
JSON Wire Format
Conditions (commit to anchor scriptPubKey hash)
{
"type": "COSIGN",
"inverted": false,
"fields": [
{ "type": "HASH256", "hex": "b4c5d6e7...scriptPubKey SHA256...32 bytes" }
]
}This creates a co-spend requirement. The transaction must include another input whose spent output's scriptPubKey, when SHA-256 hashed, matches the committed hash.
Worked Example
HASH256 = SHA256(anchor_scriptPubKey)
TX has 2 inputs. Input[1].spent_output.scriptPubKey matches → SATISFIED
TX has 3 inputs. Input[2].spent_output.scriptPubKey matches → SATISFIED
TX has 1 input (only self). No other inputs to check → UNSATISFIED
TX has 2 inputs. No scriptPubKey hash matches → UNSATISFIED
No tx context or spent_outputs available → ERROR (fail-closed)
Use Cases
Atomic Multi-UTXO Operations
Ensure two UTXOs are always spent together in the same transaction. Each UTXO commits to the other's scriptPubKey hash via COSIGN, creating a bidirectional dependency that prevents spending one without the other.
Paired Covenant Spends
Link a data-carrying UTXO to a value-carrying UTXO. The value output requires the data output as a co-spend, ensuring state transitions always include the associated data payload in the same transaction.
Cross-Input Authorization
Require that a specific authorization UTXO (identified by its scriptPubKey hash) is consumed in the same transaction. This creates a physical "key" UTXO that must be presented alongside the "lock" UTXO to authorize spending.