Off-chain Bitcoin

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.

Built by
CommerceBlock; released January 2024 as a library and command-line client9,10
Signing
Blinded two-party Schnorr, a variant of MuSig2, on Taproot outputs1,3
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.

Figure 1.One blind signing session. Turn on “Show the actual numbers” to see real secp256k1 values computed in your browser; step 5 then checks the signature for real. The equations are in the precise version.

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

Figure 2.Alice transfers a coin to Bob. The key arithmetic is real when the numbers are shown; authentication keys, encryption and the backup’s own signing session are summarised.

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 checkWhat a dishonest sender could doResult for the receiverSeverity
Sighash flagsSign with SIGHASH_NONE, so anyone can change the outputsThe backup can be redirected; the coin is mostly lost to feesMedium
Transaction versionUse a non-standard version numberNodes won’t relay the backup, so the sender’s older backup wins laterMedium
Number of outputsAdd an output so outputs exceed the inputThe backup can never be mined; the sender sweeps laterMedium
Initial locktimeSet locktimes in the pastEvery backup works at once; the sender can race immediatelyHigh
Input sequenceSet sequence to 0xFFFFFFFF, which switches the locktime offThe sender’s backup works at any time, even after later transfersHigh

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

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

server: picks r₁, sends R₁ = r₁·G owner: picks r₂ and b R = R₁ + r₂·G + b·P e = H(P ‖ R ‖ m) c = e + b sent to the server server: σ₁ = r₁ + c·s sent back; count += 1 owner: σ = σ₁ + r₂ + c·o check: σ·G = R₁ + r₂·G + c·P = R₁ + r₂·G + b·P + e·P = R + e·P

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

Sources

Mercury Layer files are cited from mercury-layer/mercurylayer at commit f130a3b, identical to the copies examined for this chapter.

  1. Mercury Layer documentation, introduction, sections “Statechains”, “Blinding” and “Keyshare publication”. docs/README.md; the public-key-list endpoint.
  2. Mercury Layer protocol specification, sections “Initialisation”, “Transfer” and “Orderly Closure”. docs/protocol.md.
  3. “Blinded two-party Musig”, Mercury Layer design notes, including the Wagner attack and the proposed nonce commitments. docs/blind_musig.md.
  4. Server sign/first endpoint: returns the stored nonce while a session has no challenge. server/src/endpoints/sign.rs, lines 51–64.
  5. Receiver checks: sequence, version and locktime (lib/src/transfer/receiver.rs, lines 394–440); challenge recomputation (lines 505–554).
  6. Server defaults lockheight_init: 10000, lh_decrement: 100. server/src/server_config.rs, lines 65–70.
  7. “Atomic transfer protocols”, Mercury Layer documentation. docs/atomic_transfer.md.
  8. Conduition, “Mercury Layer vulnerability disclosure”, 6 September 2024.
  9. Shinobi, “Mercury Layer: A Massive Improvement On Statechains”, Bitcoin Magazine, 8 January 2024.
  10. Bitcoin Optech, “Statechains” topic page, entry for Mercury Layer’s announcement on 24 January 2024.
  11. Benhamouda, Lepoint, Loss, Orrù and Raykova, “On the (in)security of ROS”, 2020.
  12. “Lightning Latch”, Mercury Layer documentation. docs.mercurylayer.com.
  13. Lockbox key manager options (lockbox/README.md) and the SGX enclave server (enclave/README.md).

Checked 10 October 2026.