Mercury Layer
What can a co-signer do without seeing what it signs?
Mercury Layer’s server signs with its half of each coin’s key without learning which coin, which transaction or which final signature it is helping with. All it keeps is a count of its signatures. Everything the server can’t check, the receiving wallet has to.
- The server sees
- A coin ID, its own key share, one blinded challenge per signature, and a signature count
- Status, October 2026
- The reference repository is no longer public; mirrors and the documentation site remain
The idea: a co-signer with a blindfold
A statechain server takes part in every transfer, so an ordinary one could keep a perfect record of who sent which coin to whom. The server behind CommerceBlock’s earlier Mercury wallet could see those details.9 Mercury Layer’s server cannot. It never learns which coin it is helping with, the coin’s address, or any signature that ends up on the blockchain.1
The trick is a blind signature. Think of a notary stamping a sealed envelope with carbon paper inside: the document gets a valid stamp, and the notary never reads it. Here, the owner disguises each signing request with a random number, the server signs the disguised request with its half of the key, and the owner removes the disguise. The result is an ordinary Bitcoin signature that the server cannot recognise.2,3
Step through one signing session in Figure 1. Watch the table on the right: the server’s column stays almost empty.
What the server still knows
For each coin, the server keeps its key half, the disguised requests it answered, and a count of how many signatures it has given.1,2 That count matters more than it looks. The server can’t check what it signs, so the count is the only way a future owner can tell whether some extra, unknown backup transaction exists.
Blindness also means the server can’t publish a list of the coins it manages. It publishes its current public key share for each coin instead, so an owner can check that its own public key share and the server’s add up to the coin’s public key. The private key shares stay secret.1
Blind signing has a known weak spot: a user who runs many signing sessions at the same time can, with some cleverness, combine the answers into one more valid signature than the server issued.11 For a statechain, that would be a backup the server never counted. The precise version describes how Mercury Layer guards against it.
A transfer, message by message
The previous chapter said the server swaps its key half so that it fits the new owner’s half. Doing that without anyone seeing either owner’s half takes one extra trick: the server lends the sender a random mask. Figure 2 walks through every message.2
Compare this with the 2018 design, in which the owner’s key itself was handed to every new owner. Here Bob never learns Alice’s key half, and the server learns only the difference between the two halves.
The receiver does the checking
Because the server is blind, the receiving wallet has to check everything the server can’t. With every transfer the sender passes along every backup ever signed for the coin, and the receiver checks the signatures, that the backups unlock in the right order, that the newest pays the receiver and isn’t about to unlock, that the coin is unspent, and that the number of backups equals the server’s count.2
Getting these checks right is hard. In September 2024 Conduition published five ways a dishonest sender could hand over backups that looked fine but would lose on chain:8
| What the receiver did not check | What a dishonest sender could do | Result for the receiver | Severity |
|---|---|---|---|
| Sighash flags | Sign with SIGHASH_NONE, so anyone can change the outputs | The backup can be redirected; the coin is mostly lost to fees | Medium |
| Transaction version | Use a non-standard version number | Nodes won’t relay the backup, so the sender’s older backup wins later | Medium |
| Number of outputs | Add an output so outputs exceed the input | The backup can never be mined; the sender sweeps later | Medium |
| Initial locktime | Set locktimes in the past | Every backup works at once; the sender can race immediately | High |
| Input sequence | Set sequence to 0xFFFFFFFF, which switches the locktime off | The sender’s backup works at any time, even after later transfers | High |
Conduition’s main advice was structural: instead of inspecting transactions the sender built, the receiver should rebuild each backup from a fixed template, so any deviation shows up as a bad signature.8 The client code in the mirror cited here checks each of these fields explicitly.5
Withdrawing, swapping and Lightning
To leave, the owner and the server sign an ordinary transaction to any address. The server can’t tell it from a backup. Afterwards the coin can never be transferred again: a future receiver would see one more signature than there are backups and refuse it.2
The server can also make transfers conditional. An atomic swap locks several coins together, so either all of them change hands or none do.7 Lightning Latch sells a coin for a Lightning payment: the server creates a secret, the seller issues a Lightning invoice tied to that secret, and the server only reveals it, letting the seller collect, once both sides have confirmed the transfer.12 In both cases the server enforces the deal, so it is trusted for that too.
What you trust
- That the server deleted the old key half. As with every statechain. Mercury Layer keeps key halves in a separate “lockbox” service that can run inside an Intel SGX enclave or use a key manager such as Google Cloud KMS or HashiCorp Vault.13 That makes keeping old halves harder; it doesn’t prove they’re gone.
- That the server’s signature count is honest. It is the only evidence a receiver has that no other valid transaction spends the coin.1
- That your wallet checks correctly. A wallet that skips a check can lose the coin without any help from the server.
- That the server runs swaps and Lightning Latch fairly.
Coins still move whole, and the countdown still limits how often a coin can change hands: with the default settings, a new coin’s first backup unlocks 10,000 blocks (about ten weeks) after deposit, and each transfer brings the next one forward by 100 blocks.6
Status
As of 10 October 2026, the commerceblock organisation on GitHub, which hosted the reference implementation, returns “not found”. The code survives in forks, including mercury-layer/mercurylayer, which this chapter cites at a pinned commit, and the documentation at docs.mercurylayer.com is still online.
The precise version
A Schnorr signature on message m under key P is a pair (R, σ) with σ·G = R + e·P, where e = H(P ‖ R ‖ m). In Mercury Layer, P = O + S, the owner holds o and the server holds s. One signing session runs as follows:2,3
Figure 1 uses this plain hash over compressed points, as the specification writes it. Real Taproot signatures use BIP 340’s tagged hash and x-only keys, and Mercury Layer’s code applies the Taproot tweak before signing. Key aggregation uses no MuSig2 coefficients (both are 1), which is what makes the additive key update possible; rogue-key attacks are prevented because every owner proves knowledge of its key by signing the transfer.3
The transfer from Figure 2, in symbols: the server sends Alice a random x₁; Alice sends Bob t₁ = o₁ + x₁; Bob checks t₁·G = O₁ + X₁ and O₁ + S₁ = P, then sends t₂ = t₁ − o₂; the server sets s₂ = s₁ + t₂ − x₁ = s₁ + o₁ − o₂ and deletes s₁.2
The weakness of concurrent blind Schnorr signing goes back to Wagner’s generalised birthday algorithm and was made efficient in 2020 by Benhamouda and co-authors, who called the underlying problem ROS.11 Mercury’s design notes discuss it and propose that the owner commit to its nonce and blinding factor before the server reveals its own.3 In the published server code, a coin can have at most one open signing session: asking again returns the same server nonce until a challenge arrives.4 Every answered challenge is stored, and each later receiver recomputes every past challenge from the backup and its blinding factor and compares.5 Whether this is a sufficient defence is not evaluated here.
The server publishes its current public key share S = s·G for each coin; its private share s stays secret. Per the design documentation, it commits that public list to Bitcoin through CommerceBlock’s Mainstay service.1 Mercury Layer was released in January 2024 as a library and command-line client for other wallets to integrate.9,10
Where this explanation stops
- The server is shown as one signer. In deployment the key shares live in the lockbox service, behind the server.
- Authentication keys, message encryption, deposit tokens and backup fees are left out.
- The figures use the specification’s plain hash and full points rather than BIP 340’s tagged hash, x-only keys and the Taproot tweak.
Sources
Mercury Layer files are cited from mercury-layer/mercurylayer at commit f130a3b, identical to the copies examined for this chapter.
- Mercury Layer documentation, introduction, sections “Statechains”, “Blinding” and “Keyshare publication”. docs/README.md; the public-key-list endpoint.
- Mercury Layer protocol specification, sections “Initialisation”, “Transfer” and “Orderly Closure”. docs/protocol.md.
- “Blinded two-party Musig”, Mercury Layer design notes, including the Wagner attack and the proposed nonce commitments. docs/blind_musig.md.
- Server
sign/firstendpoint: returns the stored nonce while a session has no challenge. server/src/endpoints/sign.rs, lines 51–64. - Receiver checks: sequence, version and locktime (lib/src/transfer/receiver.rs, lines 394–440); challenge recomputation (lines 505–554).
- Server defaults
lockheight_init: 10000,lh_decrement: 100. server/src/server_config.rs, lines 65–70. - “Atomic transfer protocols”, Mercury Layer documentation. docs/atomic_transfer.md.
- Conduition, “Mercury Layer vulnerability disclosure”, 6 September 2024.
- Shinobi, “Mercury Layer: A Massive Improvement On Statechains”, Bitcoin Magazine, 8 January 2024.
- Bitcoin Optech, “Statechains” topic page, entry for Mercury Layer’s announcement on 24 January 2024.
- Benhamouda, Lepoint, Loss, Orrù and Raykova, “On the (in)security of ROS”, 2020.
- “Lightning Latch”, Mercury Layer documentation. docs.mercurylayer.com.
- Lockbox key manager options (lockbox/README.md) and the SGX enclave server (enclave/README.md).
Checked 10 October 2026.