Transactions

Transactions consume inputs and produce outputs.

UnsignedTransaction

name type size description
inputs.length uint16 2 Next field number of bytes.
inputs bytes1[] 1* List of inputs.
outputs.length uint16 2 Next field number of bytes.
outputs bytes1[] 1* List of outputs.
data.length uint8 1 Next field number of elements.
data bytes32[] 32* Implicit unique identifier of what to spend.
signatureFeeToken uint256 32 Implicit fee token ID.
signatureFee uint256 32 Implicit fee rate.

Transaction data that is signed off-chain. The unsigned transaction data is serialized then hashed to get a unique transaction ID, which is then signed over to get a witness. Essentially, each witness authorizes an entire transaction. This scheme avoids the quadratic hashing issue present in Bitcoin.

Implicit data (data) is one 32-byte hash per input, and uniquely identifies what is being spent by that input (a UTXO ID or a deposit ID).

The transaction ID is the EIP-712 hash of the hash of the serialized unsigned transaction data.

TransactionLeaf

name type size description
length uint16 2 Total length of leaf in bytes.
metadata.length uint8 1 Next field number of elements.
metadata bytes8[] 8* List of metadata, one per input.
witnesses.length uint16 2 Next field number of bytes.
witnesses bytes1[] 1* List of witnesses.
inputs.length uint16 2 Next field number of bytes.
inputs bytes1[] 1* List of inputs.
outputs.length uint16 2 Next field number of bytes.
outputs bytes1[] 1* List of outputs.

A leaf in a transaction Merkle tree, which is committed to in a root.

Note that the implicit data is not included in the leaf, as it can be reconstructed from metadata. Rather, the root producer replaces the larger data (state element) with the smaller metadata (a pointer to an entry in the ledger or a deposit).

Note that the implicit fee token ID and feerate are not included in the leaf. Since the value of those fields must be identical for all transaction under a root, they can be hoisted and declared once at the root header level.

The minimum transaction leaf size in bytes is set by the parameter TRANSACTION_SIZE_MIN (44). The maximum transaction leaf size in bytes is set by the parameter TRANSACTION_SIZE_MAX (896). The maximum number of inputs in a single transaction is INPUTS_MAX (8). The maximum number of outputs in a single transaction is OUTPUTS_MAX (8).