Statechains
How can a coin change owners without moving?
Put it behind a lock that needs two keys, the owner’s and a server’s. To pay someone, the server swaps its key for one that fits the new owner’s key instead. A pre-signed backup lets the owner leave if the server ever disappears.
- Proposed
- Ruben Somsen, Scaling Bitcoin, Tokyo, October 20181
- On the blockchain
- One output, unchanged by any number of transfers
- What moves
- The whole UTXO; there are no partial amounts
- You trust
- The server never helps an earlier owner sign
The idea: a lock with two keys
Picture the coin behind a lock that only opens when two keys turn together: one belongs to whoever owns the coin, the other to a server. The server cannot open it alone, and neither can the owner.
To pay someone, you don’t move the coin. The server swaps its key for a new one that only works together with the new owner’s key, and throws its old key away. Your key now opens nothing, and the coin, untouched on the blockchain, belongs to someone else.4
Two more pieces make this usable: a backup that lets the owner leave if the server disappears, and the server really throwing old keys away. Step through Figure 1 to see all three.
Backups that count down
Without a backup, an owner whose server vanished would be stuck forever. So before every handover, the server and the owner sign a backup transaction: a normal Bitcoin transaction that pays the coin to the new owner but carries a timelock, so the network will not accept it before a certain block.5 It is kept off chain and normally never used.
The catch is that old backups stay valid. After Alice pays Bob, Alice still holds a signed transaction paying herself. So each new backup is set to unlock a little earlier than the previous one. If the server disappears, the newest owner’s backup is the first one Bitcoin will accept, and it wins as long as that owner sends it in time.5
Move time forward in Figure 2 to see what that means for Carol, the coin’s third owner.
Counting down has three practical consequences.
- A limited number of transfers. Every handover uses up one step of the countdown, and nobody will accept a coin whose backup is about to unlock. With Mercury Layer’s defaults, a fresh coin can change hands roughly a hundred times.6
- An expiry date. Before the current owner’s backup unlocks, the coin should be withdrawn with the server’s help. Wallets are expected to handle this automatically.4
- A duty to be online around that date, in case the server has gone and the backup has to be sent.
Somsen’s original design avoided the countdown by assuming eltoo, a proposed Bitcoin upgrade under which a newer state can always replace an older one on chain.1 Bitcoin does not have it, so statechains in use today count down instead.3,7
What the server can and cannot do
- It cannot take the coin by itself. Spending needs the owner’s key as well.4
- It cannot freeze the coin. The owner’s backup unlocks without it.4
- It can take the coin together with a previous owner, if it kept that owner’s key. A fresh signature needs no timelock, so there is no race to win. Nothing on the blockchain shows whether an old key was deleted. Secure hardware and splitting the server among several parties make cheating harder; they do not prove deletion.4
- It can be caught afterwards. Every transfer is backed by a signature from the outgoing owner, so a server that signs for anyone else leaves evidence. Cheating is provable, not prevented.1,4
- It can make you wait. If it disappears, you get your coin back only when your backup unlocks.
One limit has nothing to do with trust: a statecoin moves as a whole. Somsen’s answer for other amounts was to swap coins with other users, a 2 BTC coin for two 1 BTC coins, say.1 Spark, in chapter three, splits coins instead.
The precise version
The coin is a Taproot output whose public key P is the sum of the owner’s key O = o·G and the server’s key S = s·G, where G is the secp256k1 generator, lower-case letters are secret numbers and upper-case letters are points. The private key o + s never exists in one place; a signature needs a partial signature from each side.4
A transfer from Alice (o₁) to Bob (o₂) replaces the server’s share so that the sum stays the same:
The server can do this without learning o₁ or o₂ separately; the Mercury Layer chapter shows the messages.5
The first owner’s backup has nLockTime = h₀, a block height set at deposit. The n-th owner’s backup gets h₀ − (n − 1)·c, so each one unlocks c blocks before the previous one.5 Mercury Layer’s server defaults are h₀ = current height + 10,000 blocks (about ten weeks) and c = 100 blocks.6
In Somsen’s 2018 proposal there was no share update: the owner’s transitory key was handed, private key and all, to each new owner, and the entity promised to co-sign only for whoever it had recorded as the latest owner.1 He suggested the entity could be a federation, for example 8 of 10 signers, and in 2019 that it could sign blind.1,2 Updating the server’s share changes its job from refusing old owners to forgetting old shares, which protects past owners’ coins even if the server is hacked later, provided the shares really were deleted.4
Where this explanation stops
- Keys are drawn as whole keys. In reality each side holds a share of one Schnorr key, and signing is a short exchange of messages; the next chapter shows it.
- Fees are ignored. A real backup must pay a fee, and one racing another may need to outbid it.
- Taproot key tweaks and the x-only keys of BIP 340 are left out of the formulas.
- The server’s signature counter and the checks a receiving wallet performs are covered in the Mercury Layer chapter.
Sources
- Ruben Somsen, “Statechains: Non-custodial off-chain Bitcoin transfer”, talk at Scaling Bitcoin, Tokyo, October 2018. Transcript.
- Ruben Somsen, “Formalizing Blind Statechains as a minimalistic blind signing server”, bitcoin-dev mailing list, June 2019. Archive.
- Bitcoin Optech, “Statechains” topic page.
- Mercury Layer documentation, introduction (
docs/README.md), sections “Overview”, “Statechains” and “Blinding”. mercury-layer/mercurylayer@f130a3b. - Mercury Layer protocol specification (
docs/protocol.md), sections “Initialisation” and “Transfer”. mercury-layer/mercurylayer@f130a3b. - Mercury Layer server configuration defaults,
lockheight_init: 10000andlh_decrement: 100. server/src/server_config.rs, lines 65–70. - Bitcoin Optech, “Eltoo” topic page, and “SIGHASH_ANYPREVOUT” topic page.
Checked 10 October 2026.