Off-chain Bitcoin

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.

Figure 1.One coin passing from Alice to Bob to Carol. In real deployments the “keys” are shares of one Schnorr key and the days are block heights; the precise version is at the end of the chapter.

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.

Figure 2.Who ends up with Carol’s coin. One day stands for 144 blocks, and a broadcast transaction confirms in the next block. Real backups also need a fee, which this model ignores.

Counting down has three practical consequences.

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

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:

s₂ = s₁ + o₁ − o₂ o₂ + s₂ = o₁ + s₁ so P is unchanged

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

Sources

  1. Ruben Somsen, “Statechains: Non-custodial off-chain Bitcoin transfer”, talk at Scaling Bitcoin, Tokyo, October 2018. Transcript.
  2. Ruben Somsen, “Formalizing Blind Statechains as a minimalistic blind signing server”, bitcoin-dev mailing list, June 2019. Archive.
  3. Bitcoin Optech, “Statechains” topic page.
  4. Mercury Layer documentation, introduction (docs/README.md), sections “Overview”, “Statechains” and “Blinding”. mercury-layer/mercurylayer@f130a3b.
  5. Mercury Layer protocol specification (docs/protocol.md), sections “Initialisation” and “Transfer”. mercury-layer/mercurylayer@f130a3b.
  6. Mercury Layer server configuration defaults, lockheight_init: 10000 and lh_decrement: 100. server/src/server_config.rs, lines 65–70.
  7. Bitcoin Optech, “Eltoo” topic page, and “SIGHASH_ANYPREVOUT” topic page.

Checked 10 October 2026.