Ladder Script
A proposal to replace Bitcoin Script with typed, structured spending conditions
Bitcoin Script is a stack-based language from 2009. It works, but it has real limitations. Writing correct scripts is hard. Analysing them requires execution simulation. There is no way to express covenants, recursive conditions, or transaction-level constraints without ugly workarounds. The opcode model allows arbitrary data embedding (inscriptions, stamps), and there is no native path to post-quantum signatures.
Every proposal to fix one of these problems (CTV, APO, OP_VAULT, OP_CAT) adds individual opcodes that interact in unpredictable ways with each other and with the existing opcode set. The result is a growing pile of narrow fixes with no coherent model underneath.
Ladder Script replaces the opcode model entirely. Instead of a stack machine that executes arbitrary instructions, spending conditions are declared as typed blocks arranged in rungs. Each block has a fixed type, fixed fields with enforced sizes, and a single evaluation function. No loops, no stack manipulation, no arbitrary data.
The name comes from ladder logic, the programming model used in industrial automation for decades. A ladder diagram has two vertical rails (power in, power out) connected by horizontal rungs. Each rung contains contacts (conditions) and a coil (output). Power flows left to right through a rung only if every contact is closed. If a rung fails, the next one is tried.
In Ladder Script, blocks within a rung are AND (all must pass) and rungs are OR (first passing rung wins). This gives you the same expressiveness as Bitcoin Script's IF/ELSE branching but with a deterministic, bounded evaluation model.
A simple example: a vault with a hot key for daily spending and a multisig fallback for recovery.
Ladder Script uses Version 4 transactions (TX_MLSC). Outputs are 8 bytes each (value only, no script). One conditions_root per transaction defines a shared condition tree (PLC model). A creation proof in the witness validates the root is protocol-derived. The actual condition structure is only revealed at spend time in the witness. Unrevealed rungs stay private.
You can describe conditions in a compact notation. The output() wrapper maps outputs to the shared condition tree:
Ladder Script has 61 block types across 10 families. Here are some things they enable that Bitcoin Script cannot do today:
Vaults with clawback. Lock funds with a hot key + timelock on rung 0, cold key sweep (no delay) on rung 1. The VAULT_LOCK block handles this in a single block.
Rate-limited wallets. RATE_LIMIT restricts how many satoshis per block can be spent. Even if your key is compromised, the attacker can only drain at the rate you set.
Recursive covenants. RECURSE_SAME forces the output to carry the same conditions as the input. RECURSE_COUNT counts down each hop. RECURSE_SPLIT lets a UTXO split into multiple re-encumbered outputs. All with bounded depth.
Per-output governance. OUTPUT_CHECK verifies that a specific output has the right value and script. Enforce that treasury spends route funds to the correct address.
Cross-input dependencies. COSIGN requires that another UTXO (identified by its script hash) is spent in the same transaction. Creates physical "key" UTXOs that must be present to authorise spending.
Post-quantum migration. Any signature block works with Schnorr, ECDSA, FALCON-512, FALCON-1024, Dilithium3, or SPHINCS+ by changing a single SCHEME byte. No new opcodes needed.
Next-generation payment channels. ANYPREVOUT sighash support enables payment channels where any state can replace any earlier state, removing the need for penalty transactions.
Ladder Script adds 197 lines of changes to existing Bitcoin Core code across 16 files. Everything else is a self-contained library of 11,318 lines in 21 new files. The patch does not modify any existing Bitcoin Script evaluation, signature verification, or consensus logic.
Anti-spam overhead is 112 bytes per transaction (flat). There is no contiguous data block in a TX_MLSC transaction, making inscriptions structurally impossible. A simple payment is 647 WU / 162 vB. A batch of 100 outputs is 7,867 WU / ~1,967 vB.
The formal properties come from 9 TLA+ specifications that were model-checked across 3.3 million states, verifying evaluation semantics, anti-spam guarantees, wire format correctness, Merkle proof security, sighash binding, covenant termination, and cross-input rules.
Ladder Script is live on a dedicated signet. You can try it right now: