Docs · 05 / 8

Actions

The exact transaction layout of an action.

Transaction layout

An action is a Bitcoin transaction with this layout.

Inputs

Input 0

program account (sender)
witness: [signature, leaf script, control block]

Input 1…n

program accounts of this program
witness: [signature, leaf script, control block]

Outputs

Output 0

OP_RETURN · action JSON

Output 1

change → input 0's own program account

Output 2+

free; meaning set by the program via $tx.outputs[i]
Action transaction. At least 3 outputs; every input is a script-path spend.

Rules

PartRule
InputsEvery input must be a script-path spend of a program account of this program, through its leaf. The witness is exactly [signature, leaf script, control block]. The signature is 64 bytes (SIGHASH_DEFAULT) or 65 with SIGHASH_ALL. The leaf must be the exact 68-byte <cmr> OP_DROP <pubkey> OP_CHECKSIG, and the control block's internal key must equal the signer.
Output 0OP_RETURN with the action JSON.
Output 1Input 0's own program account: the change, where the sender's funds continue.
Output 2+Free. The program decides what they mean through $tx.outputs[i] (for example output 2 = payment or receiver).
CountAt least 3 outputs.

The action JSON

output 0 (OP_RETURN)
{"p":"sats-20","op":"<method>","prog_id":"<program id>", ...args}

Notes