Notary receipts and double-spend proofs
Developers12.5.11+

Notary receipts and double-spend proofs

Accept a payment in seconds: what a 3-of-5 notary receipt says and does not say, how to verify it, the Accepted and Settled labels, and the REST, WebSocket and RPC surface.

From 12.5.11 a node relays and serves notary receipts: signed statements by the notaries of a fixed set that they saw a transaction first and knew no conflicting spend. A payment is accepted when receipts from at least 3 of the 5 notaries are valid and no double-spend proof was seen. A point-of-sale terminal can then hand over the goods within a few seconds instead of waiting for a block.

Receipts are node policy, carried over P2P. They are not a consensus rule: a receipt never makes a block invalid and never changes which chain a node follows.

What a receipt says #

One receipt is one notary's signed statement:

At issued_ms, this node had the transaction txid (exact bytes tx_hash) in its mempool on top of block tip_hash. It first saw it at first_seen_ms, and it had seen no other transaction spending any of its inputs.

A notary signs a transaction only after a waiting window (500 ms by default) with no conflict, only once per transaction, and only for transactions it saw enter its mempool itself.

What a receipt does not say:

  • that the transaction will be mined. The notaries keep their promise among themselves (first seen wins), but a miner outside them can still mine a conflicting transaction it kept private;
  • that the payment is final. An accepted payment can still be replaced by such a conflicting block.

The optional payer bond (below) covers that remaining case with collateral; it still does not make a payment final.

Accepted and Settled #

Show these labels. Never show "final" for an accepted payment.

LabelWhen
SentBroadcast or seen, no receipt yet
Checking: 1 of 3 receiptsReceipts arriving, the window running
Accepted by 3 of 5 network nodes, no conflict3 valid receipts of one set, and the double-spend window closed with no proof
In a block, then n confirmationsThe block chain
SettledThe payment's block is at or under the node's finalized height (finalized.height of GET /api/v1/chain/forks)
Double-spend detectedA valid proof on one of its coins, before a block

Only node finalization is "Settled". A block always wins over an earlier conflict report. Where no notary set is pinned, or the node has no receipt routes (404), skip "Accepted" and wait for a block.

The notary sets #

Each network has one pinned set, embedded in the release. Set version 1, threshold 3, 5 keys:

Networkset_id
Mainnetd82b1453e9b73f0ccd388eb1f0319ad0b190aeeae9fbc120e4b19f41e6c5d5a1
Napoleon test networka16c5a90b065d4cd7d8f5ce82a6fe61c03cbc55e1733f9e81cf26a9675b4fdca

Other networks (regtest, the old testnet) have no set: nothing is issued or accepted there, and the API answers "notaries": 0.

set_id is TaggedHash("LotusNotarySet", body): SHA-256 of SHA256(tag) || SHA256(tag) || body. Fetch the set once from GET /api/v1/finality/notaries, check that the set_id of its body is the one above, and keep that body in your application. A later set is published as a signed update (the update field): apply it only when at least the threshold of distinct keys of the set you already trust signed it. A node can withhold an update, never invent one. Do not take a node's set on trust.

A set has a valid_from time. After an update the previous set stays trusted for 3600 seconds, unless the update revokes it (a leaked key).

Verify a receipt yourself #

A receipt is 228 bytes: a 164-byte body and a 64-byte Schnorr signature (the scheme of the script interpreter, not BIP 340). Integers are little endian.

OffsetSizeField
01version (1)
11scheme (1)
24network: the network magic
64set_version
101key_index in that set
111flags: bit 0 first seen, bit 1 no conflict (both set), bit 2 unconfirmed inputs, bit 3 reserved (0)
1232txid
4432tx_hash: SHA256d of the full transaction
7632tip_hash
1084tip_height
11232template_id (zero)
1448first_seen_ms
1528issued_ms
1604expiry_s (1 to 86400; notaries issue 600)

The signature is over TaggedHash("LotusNotaryReceipt", body). The checks, in order:

  1. Length 228, version 1, scheme 1, your network's magic, no unknown flag bit, expiry_s in range.
  2. set_version is a set you trust now, and key_index is below its key count.
  3. The signature verifies with that key.
  4. Fresh: issued_ms at most 2 minutes ahead of your clock, not past issued_ms + 1000 × expiry_s, and first_seen_ms <= issued_ms. An audit later skips this check.
  5. The txid is your payment's.

Threshold. The payment is accepted when receipts that pass these checks, for that txid, come from at least threshold distinct key indexes of the same set version, and no valid double-spend proof involves one of its inputs. Receipts under two set versions are never added up.

The node offers the same checks (POST /api/v1/finality/verify, the verifyreceipt RPC), but a client that pays out goods should run them itself against its pinned set.

Double-spend proofs #

A double-spend proof is two signatures by the owner of one coin over two different transactions that spend it. It carries the two signed sighash preimages, so it can be checked without either transaction. Nodes build one when a transaction that spends an input of a mempool transaction is refused, verify it, and relay it.

Covered: P2PKH, P2PK and Taproot key-path spends signed with sighash ALL (without ANYONECANPAY). For other scripts the node records "conflict seen" (conflict: true, status: double_spend) without a proof. Treat both the same: do not accept the payment.

Run a terminal #

The web wallet of every node has one at /wallet/#/terminal (it needs no wallet and holds no key), and /wallet/#/verify checks a saved acceptance bundle. To build your own:

  1. Pin the set of your network (above).
  2. Send the payment, or watch the payee address, through more than one node: POST /api/v1/finality/submit or P2P, and subscribe to the txid on at least two nodes.
  3. Decide at the earlier of two times: 2 seconds after the 3rd valid receipt, or 3.5 seconds after the payment was seen. Accepted if 3 valid receipts of one set arrived by then and no proof came on any connection; otherwise "Not accepted yet": keep watching and wait for a block. A proof that arrives later still means "Double-spend detected".
  4. Keep the transaction, the receipts, the proofs seen (none) and the window times. They show later what you accepted, and checkreceipt can show a notary's statement was false.

REST #

Under /api/v1/finality, no authentication, never cached. With -finality=0 every route answers 404 finality_disabled. Full fields: REST API.

MethodPathAnswer
GET/finality/notariesThe trusted set: network, set_version, set_id, threshold, valid_from, revoke_previous, notaries (index, pubkey, label), body, update (hex or null), previous (the previous set in its grace, or null)
GET/finality/tx/<txid>The status object
GET/finality/dsproofs/<txid>{"txid", "dsproofs": [...]}
POST/finality/submitBody {"hex": "<raw tx>", "wait_ms": 0..4000}: broadcast, wait for accepted or double_spend or the time, return the status object plus broadcast (ok, already_known, or the reject reason). 503 busy when 16 submits are already waiting
POST/finality/verifyBody {"receipts": [hex...], "dsproofs": [hex...], "tx": "<raw tx, optional>"}: a verdict per item and accepted
Shell
curl -s $API/finality/notaries
curl -s $API/finality/tx/<txid>
curl -s -X POST $API/finality/submit -d '{"hex":"<raw tx>","wait_ms":3500}'

The status object:

JSON
{"txid": "...", "status": "accepted", "in_mempool": true,
 "first_seen_ms": 1764250000123, "accepted_ms": 1764250000610,
 "threshold": 3, "notaries": 5, "set_version": 1, "valid_receipts": 3,
 "receipts": [{"hex": "...", "key_index": 0, "txid": "...", "issued_ms": 1764250000602,
               "expiry_s": 600, "fresh": true, "check": "ok", "received_ms": 1764250000607}],
 "dsproofs": [], "conflict": false}

status is unknown, pending (fewer than threshold valid receipts), accepted or double_spend (overrides accepted). Each receipt also has id, version, network, set_version, pubkey, label, tx_hash, tip_hash, tip_height, template_id, flags, unconfirmed_inputs, first_seen_ms, expires_ms and signature. A proof has hex, id, outpoint, spent_output, spenders (two: algorithm, txid, pubkey, signature, preimage) and received_ms.

WebSocket #

On the push WebSocket, subscribe to the transaction with {"op":"subscribe","subs":[{"type":"txid","value":"<txid>"}]}. Three events come besides the usual tx_* events, each with txid and finality, the status object:

eventSent when
tx_receiptA new valid receipt for the transaction
tx_acceptedOnce, when the threshold is reached with no proof
tx_double_spendA proof, or a conflict without proof, involves one of its inputs

A browser or phone node connected over P2P gets the raw finreceipt and dsproof messages instead, after it sends sendfinality, and checks them itself. A light node that connects late asks with getfinality <txid>.

RPC #

CommandResult
getfinalitystatus "txid"The status object
getdsproofs "txid"The proofs involving the transaction's inputs
verifyreceipt "hex" ( "txhex" )valid (checks 1 to 3, and the txid with txhex), fresh (also check 4), error, receipt
verifydsproof "hex"valid, error, proof (no chain check)
checkreceipt "hex" "txhex" ( maxblocks )Against the chain: contradicted_by_chain (a block at or below tip_height, on the chain of tip_hash, spends an input of the transaction in another transaction: the statement was false), conflict_mined_later (a later block of the active chain does), mined, block, conflicting_txid; maxblocks default 12, at most 144
getnotarysetThe trusted set, as GET /finality/notaries
submitnotaryset "hex"Apply and relay a signed set update: applied, error
getnotaryinfoThis node: key_index (null when it does not sign), window, expiry, counters

Node options #

OptionDefaultMeaning
finality1Relay and serve receipts and proofs, the REST routes and the WebSocket events
finalitykey=<file>noneNotaries of the set only: the file with the secret key (64 hex characters or WIF). It must belong to the user running the node and not be readable by group or others, or the node refuses to start
finalitywindow=<ms>500With finalitykey: how long to wait with no conflict before signing (50 to 10000)
finalityexpiry=<s>600With finalitykey: expiry_s of the receipts signed (1 to 86400)
finalityset=<hex>embeddedReplace the embedded set with this set body. Regtest and test networks only; refused on mainnet

The options start with finality, not notary: an option whose name starts with no is read as the negation of another one.

Nothing is persisted: after a restart a node has no receipts, proofs or set updates, and a notary does not sign the transactions already in its mempool when it starts.

A lotus: link can ask for receipts and for a payment guarantee:

Text
lotus:<address>?amount=12.5&label=Coffee&receipts=3
lotus:<address>?amount=12.5&receipts=3&req-bond=20&bond-key=<33-byte key, hex>
  • receipts=<k> (1 to 99): the terminal waits for k receipts. Informative: the threshold of the pinned set is the minimum. Wallets that do not know it pay as before.
  • req-bond=<XPI>: a payer bond of at least this much is required. As a req- parameter it makes a wallet that cannot post a bond refuse the link instead of paying without one.
  • bond-key=<hex>: the merchant's compressed public key the bond must name; required with req-bond.

See Connect a web page to a Lotus wallet.

The payer bond #

A payer can lock coins in a bond output that names the merchant's key. If the payer double spends a coin the bond covers before the bond's lock time, the merchant takes the bond with the payer's own two signatures (the double-spend proof). Otherwise the payer takes it back after the lock time. A double spend then costs the payer at least the bond, whatever the hashrate of the attacker. It is collateral: it does not make the payment final, and the merchant's claim must be mined before the lock time.

The bond is wallet-side only: a Taproot output whose leaves use the contract opcodes and extensions. There is no new consensus rule in 12.5.11; the bond can be used where those rules are active:

Napoleon upgrade

Mainnet: from the Napoleon activation (date to be announced). Napoleon test network: from median time past 1795867200 (28 November 2026, 12:00 UTC). See Network upgrades.

Receipts themselves do not depend on an activation: they work on mainnet and on the Napoleon test network as soon as the nodes run 12.5.11.

Source share/www/docs/finality.md in the lotusd repository
Checked against doc/finality/receipts.md doc/finality/ux.md doc/finality/bond.md src/finality/json.cpp src/finality/receipt.h src/finality/manager.h src/api/finality_handler.cpp src/api/api_server.cpp src/rpc/finality.cpp src/push/event.cpp src/init.cpp share/www/wallet/src/lib/payuri.ts