BRC-226 · working sketch
A two-op on-chain counter. Minted once, advanced by anyone, owned by no one — and it pays for its own heartbeat.
One JavaScript line — n = n + 1 — compiled to a Bitcoin covenant. If this can live on the chain and tick forever with no operator, the rest of the language is just more BMF atoms.
Nothing guards this counter but its own script — no server, no admin, no key. So try to beat it. Your browser will build a real transaction that breaks one of its rules and hand it to a real node. Watch what happens.
This costs nothing and risks nothing. The counter needs no signature to spend, so no wallet is involved and you sign nothing. A transaction the network refuses never exists — no sats move, nothing is touched.
No account · no owner · no off-switch. Anyone can push the counter forward, no mark can ever be deleted, and because each post costs real (if tiny) sats, spam prices itself out — no moderators. Coins trapped in a walled garden? own your keys → 🎱
Colophon. The smallest thing
in this family, and the first: one number, advanced by anyone, owned by nobody. Designed by
sun-dive — the deposit that makes spam price itself out, the mark that can never be
deleted, and the refusal to put an owner anywhere in it — and written with
Claude (Opus 5). Everything after it, the battery and the racers, is this same idea
carrying more weight.
© 2026 sun-dive · Apache License 2.0 ·
in the covenant we trust
Each transaction is one tick. The lineage of UTXOs is the running program.
← scroll → · every arrow is a real tx at 100 sat/KB · the counter can only ever go n → n+1
Two rules the covenant enforces on its own spend — nothing more.
Spent, the script reads its own transaction (OP_PUSH_TX puts the sighash preimage on the stack) and checks two things about the output that continues it:
n the counter
lastFunder who to repay · relay only
out.script == C(n + 1)
The next output must lock to this very covenant, with the counter bumped by one. It rebuilds itself, one higher.
out.value ≥ in.value − STEP
Carry the battery forward, minus a fixed budget. The freed STEP − fee is the reward the spender pockets for doing the work.
Mint the logic. Anyone invokes it. The result can't be argued with.
Publish C(0) funded with the battery. The logic now lives on-chain, referenced by txid — reusable inventory, not a copy.
Anyone builds the spend and signs their fuel input SIGHASH_ANYONECANPAY — so a half-built tx can be completed and relayed by anyone.
The covenant admits exactly one valid continuation. The counter can only become n+1. Deterministic logic — a fact, not a vote.
It can't fork. It can't stall.
One valid spend, always. A normal contract's next state is a negotiation — many spends might pass. This one passes for exactly one output. So each tx isn't a choice, it's a line in a proof. You can't fork a proof.
A standing bounty. While STEP − fee > 0, there's always a reason to tick it. The program pays for its own execution and pulls itself down the chain. No operator, ever. It lives as long as its battery — and anyone can top it up.
Where the bounty comes from decides how long a program lives.
Carries its own funding. Each tick drains it a little.
Many programs draw ticks from one tank a patron refills.
Each funder repays the previous one. The program's own value never drains.
A reimbursement, not a yield. Promise profit and the payout must escalate — that's a chain letter. Keep the deposit tiny → the last funder risks only a crumb, and the program simply sleeps.
…and they stack: a tiny battery for a baseline pulse · relay for real demand · a pool when someone wants to sponsor a favourite.
The same two rules — and the relay — as a real covenant.
Written sCrypt-style (it compiles to Bitcoin Script). Tx.checkPreimage is the OP_PUSH_TX move: it forces the spending transaction's own sighash preimage onto the stack and proves it's genuine — so the script can read its own tx and pin down the future.
contract SelfRunningCounter { @state int n; // the counter @state PubKeyHash lastFunder; // who to repay static const int DEPOSIT = 1000; // sats · the rolling refund — keep it tiny @method() public tick(SigHashPreimage txp, PubKeyHash funder) { require(Tx.checkPreimage(txp)); // OP_PUSH_TX — prove txp IS this very tx int V = SigHash.value(txp); // my sats · carried forward, never drained PubKeyHash prev = this.lastFunder; // who advanced me last time this.n = this.n + 1; // the whole computation: n -> n+1 this.lastFunder = funder; // record this advancer — repaid next tick bytes out0 = this.buildStateOutput(V); // Rule 1 · quine + increment, value V bytes out1 = Utils.buildOutput( // Rule 2 · repay the previous funder Utils.buildPublicKeyHashScript(prev), DEPOSIT); require(hash256(out0 + out1) == SigHash.hashOutputs(txp)); // exactly these outputs = the only valid future } } // to advance: add your OWN input (SIGHASH_ANYONECANPAY) covering DEPOSIT + fee, // name yourself `funder`, and the NEXT tick repays you. permissionless, deterministic.
n → n+1, the repayment to the previous funder, and the carried value — all committed by hashOutputs. Exactly one valid future.
Who advances it. The funder names their own address and adds one ANYONECANPAY input. Anyone can — and that freedom never bends the counter's path.
Foundations, not vibe. Where the real work is.
The counter is not a toy. It's the first opcode.
Bitcoin isn't the ledger the program writes to. Bitcoin is the CPU that runs it — and every step is proven the moment it happens.
the point of writing it down
This is a seed, not a spec — the smallest working example, offered as a BRC so anyone can grow it. Take the block, change the rule, plant your own.
Something did grow from it. Demo two — the Bitcoin battery →
The same covenant with a fuel tank, computing one Mandelbrot iteration per transaction inside Script. A battery can power a fractal, or an AI agent: OP_PUSH_TX needs no signature, so the thing advancing it holds no key at all.
This page holds no key and broadcasts nothing. It reads that address\u2019s coins from the chain and assembles one transaction \u2014 the counter advanced, your mark written, the previous poster repaid, your change returned \u2014 then hands it to you to sign in whatever wallet holds the address.
Sats stuck in a wallet you don\u2019t control? Own your keys →