Transaction Anatomy

How Ladder Script transactions are structured, byte by byte

1. Funding Transaction
A standard Bitcoin input creates a Ladder Script output. This is how coins enter the system.
Version
4 bytes
04000000
Marker
2 B
0001
Input (P2PKH)
~148 bytes
txid + vout + scriptSig + sequence
Output
8 bytes
value only
Conditions Root
33 bytes
df + root
Locktime
4 bytes
00000000
Version
4 bytes, little-endian

Transaction version 4 signals a TX_MLSC. Nodes without Ladder Script treat it as a standard transaction (soft fork compatibility). The version routes validation to VerifyRungTx instead of VerifyScript.

Input
~148 bytes for P2PKH

The funding input is a standard Bitcoin input: P2PKH, P2WPKH, P2TR, or any existing type. The wallet signs it normally. Ladder Script only governs the output side.

Output (value only)
8 bytes per output

Each output is exactly 8 bytes: the value in satoshis. There is no per-output script. Conditions are defined once per transaction via the shared conditions_root (PLC model).

Conditions Root
33 bytes, one per transaction

One 0xDF prefix + 32-byte Merkle root shared across all outputs. The root defines a condition tree (PLC model) where outputs are mapped to conditions via the output() wrapper. A creation proof in the witness validates the root is protocol-derived.

0xDFTX_MLSC prefix (1 byte)
rootSHA-256 Merkle root of conditions, relays, and coil (32 bytes)
2. Spending Transaction
An MLSC input spends a Ladder Script output. The witness carries the conditions and proof.
Version
4 B
04000000
Marker
2 B
Input
41 B
txid + vout + empty scriptSig + seq
Output
8 B
value
Conditions Root
33 B
df + root
Witness
variable
ladder witness + MLSC proof
Locktime
4 B

The per-input witness stack has exactly 2 elements:

Witness Stack[0]: Ladder Witness

The serialised rung with all blocks and their witness fields (signatures, pubkeys, preimages), plus coil metadata and relay definitions.

Witness Stack[1]: MLSC Proof

The Merkle proof linking the revealed conditions to the conditions_root. Contains the rung index, revealed conditions, and sibling hashes.

The creation proof is a separate per-transaction blob (not a per-input witness element). It validates that the conditions_root is protocol-derived from valid typed structure. It is carried after all per-input witness stacks in the TX_MLSC wire format (flag byte 0x02).

3. Inside the Ladder Witness
The witness encodes exactly one rung with all its blocks and fields.
Rungs
1 B
01
Blocks
1 B
02
Block 1
header + fields
Block 2
header + fields
Coil
type + scheme + address + destinations
Micro-header encoding

Each block starts with a single byte. Values 0x000x3E are micro-headers that encode the block type via a lookup table. Fields use the implicit layout, so no field count or type bytes are needed. Values 0x80/0x81 are escape codes for full 2-byte type + explicit fields.

0x00SIG
0x01MULTISIG
0x03CSV
0x0ACTV
0x3EOUTPUT_CHECK
0x80Escape (full type follows)
0x81Escape + inverted
Typed fields

Every field has a declared type with enforced size. No arbitrary data is possible.

TypeSizeUsed for
PUBKEY1–2,048 BPublic keys (Schnorr 33B, PQ up to 2KB)
SIGNATURE1–50,000 BSignatures (Schnorr 64B, PQ up to 49KB)
HASH25632 BSHA-256 commitments
NUMERIC1–4 BThresholds, timelocks, counts
SCHEME1 BSignature scheme selector
PREIMAGE32 BHash preimage (max 2 per witness)
Coil

Defines what happens when a rung is satisfied.

coil_typeUNLOCK (0x01) or UNLOCK_TO (0x02). All other values rejected.
attestationINLINE (0x01). All other values rejected.
schemeSCHNORR, ECDSA, or PQ scheme
address_hash0 or 32 bytes (destination for UNLOCK_TO)
rung_destinationsPer-rung destination overrides
4. Funding vs Spending
Funding (coins enter)

Input: any standard Bitcoin output

Output: 8 bytes (value only) per output

Conditions root: 0xDF + 32-byte Merkle root (one per tx)

Witness: standard Bitcoin witness + creation proof

The funding wallet needs the Ladder Script library (or the engine/RPC) to compute the conditions_root from the desired conditions. Each output is just 8 bytes; the shared root is 33 bytes per transaction.

Spending (coins leave)

Input: references the TX_MLSC output

Output: another TX_MLSC output (8 bytes value only)

Witness: ladder witness + MLSC proof + creation proof

The node verifies the Merkle proof, merges conditions with witness, and evaluates the ladder.

5. Verification flow

1. Node sees tx version 4, input spending a TX_MLSC output

2. Routes to VerifyRungTx

3. Validates outputs are value-only (8 bytes each) with one conditions_root per tx

4. Deserialises witness stack[0] as LadderWitness

5. Deserialises witness stack[1] as MLSCProof

6. Validates the per-transaction creation proof (root is protocol-derived)

7. Extracts pubkeys from witness blocks (merkle_pub_key)

8. Verifies Merkle proof against conditions_root

9. Merges conditions with witness into single structure

10. Evaluates the ladder (AND within rung, OR across rungs)

11. If SATISFIED, the input is valid