The Dedup Window That Turns a Ledger Outage Into Double Settlement

The configuration that causes duplicate machine payments after a wCBDC ledger failover is rarely wrong in any one file. The settlement gateway keeps idempotency keys for a fixed retention window, and the edge payment agents on the shop floor buffer signed instructions while the ledger is unreachable and replay them once it comes back. If an outage outlasts the gateway's retention, the replayed instructions arrive as strangers and settle a second time. Each value passes review because each reviewer only sees their own repository.

Two sane numbers, one broken system

Take a typical layout. The gateway team sets idempotency key retention to 900 s, which is generous for normal client retries and keeps the key store small. Separately, the OT integration team configures the edge agents on presses, AGVs and energy meters to hold up to a full shift of signed settlement instructions in a store-and-forward queue, because the plant must keep producing when the wholesale ledger node or its interconnect drops. Nothing in either diff is wrong, and the payment messaging standards both sides follow, such as ISO 20022, carry a unique end-to-end identifier but say nothing about how long the receiver must remember it. The failure only exists in the gap between the two configs, and no single pull request ever contains both.

Why failover makes it worse

A clean outage is not the dangerous case. The dangerous case is partial failover: the primary ledger node accepts an instruction, commits it, and dies before the acknowledgement reaches the edge, so the agent marks the instruction as unsent and keeps it in the buffer. When the standby takes over, perhaps forty minutes later by a rough estimate for a cross-site promotion with manual approval, the agent replays everything it holds. The gateway's key for that instruction expired long ago, so it forwards a fresh settlement request, and the ledger, which validates signatures and balances rather than business intent, books it again. The resilience mechanism you built so the plant keeps running is exactly what produces the duplicate, and reconciliation catches it days later as an unexplained debit between two participants.

A detection step you can run today

Query the settlement record for any machine instruction that maps to more than one ledger transaction: SELECT machine_id, seq_no, count(DISTINCT ledger_tx_id) AS settlements FROM settlement_instructions GROUP BY machine_id, seq_no HAVING count(DISTINCT ledger_tx_id) > 1; any row it returns is a replay that escaped deduplication, and if you correlate those rows with failover timestamps you will usually find the pattern within the first outage that exceeded retention. Then make the relationship mechanical by pulling both values in CI, for example with yq '.dedup.retention_seconds' on the gateway config and yq '.buffer.max_replay_age_seconds' on the edge agent profile, and failing the pipeline whenever retention is not strictly greater than the replay horizon plus your worst observed clock skew. The decision rule is that dedup retention must cover the longest time an instruction can sit in any buffer, and an edge agent must refuse to replay anything older than that horizon, escalating it to manual reconciliation instead of guessing.

The remaining trade-off is storage against autonomy: either the gateway pays for a key store sized to the plant's longest tolerated disconnection, perhaps tens of millions of keys by a loose estimate for a large multi-site fleet, or the plant accepts a shorter offline horizon and stops machine payments earlier during an outage, and whichever you choose, write it down as one number owned by one team so the next review has something to check against.

Back to WCBDCGrid · Domains

← Back to WCBDCGrid
Engineering & Architecture Brief

The Dedup Window That Turns a Ledger Outage Into Double Settlement

The configuration that causes duplicate machine payments after a wCBDC ledger failover is rarely wrong in any one file. The settlement gateway keeps idempotency keys for a fixed retention window, and the edge payment agents on the shop floor buffer signed instructions while the ledger is unreachable and replay them once it comes back. If an outage outlasts the gateway's retention, the replayed instructions arrive as strangers and settle a second time. Each value passes review because each reviewer only sees their own repository.

Two sane numbers, one broken system

Take a typical layout. The gateway team sets idempotency key retention to 900 s, which is generous for normal client retries and keeps the key store small. Separately, the OT integration team configures the edge agents on presses, AGVs and energy meters to hold up to a full shift of signed settlement instructions in a store-and-forward queue, because the plant must keep producing when the wholesale ledger node or its interconnect drops. Nothing in either diff is wrong, and the payment messaging standards both sides follow, such as ISO 20022, carry a unique end-to-end identifier but say nothing about how long the receiver must remember it. The failure only exists in the gap between the two configs, and no single pull request ever contains both.

Why failover makes it worse

A clean outage is not the dangerous case. The dangerous case is partial failover: the primary ledger node accepts an instruction, commits it, and dies before the acknowledgement reaches the edge, so the agent marks the instruction as unsent and keeps it in the buffer. When the standby takes over, perhaps forty minutes later by a rough estimate for a cross-site promotion with manual approval, the agent replays everything it holds. The gateway's key for that instruction expired long ago, so it forwards a fresh settlement request, and the ledger, which validates signatures and balances rather than business intent, books it again. The resilience mechanism you built so the plant keeps running is exactly what produces the duplicate, and reconciliation catches it days later as an unexplained debit between two participants.

A detection step you can run today

Query the settlement record for any machine instruction that maps to more than one ledger transaction: SELECT machine_id, seq_no, count(DISTINCT ledger_tx_id) AS settlements FROM settlement_instructions GROUP BY machine_id, seq_no HAVING count(DISTINCT ledger_tx_id) > 1; any row it returns is a replay that escaped deduplication, and if you correlate those rows with failover timestamps you will usually find the pattern within the first outage that exceeded retention. Then make the relationship mechanical by pulling both values in CI, for example with yq '.dedup.retention_seconds' on the gateway config and yq '.buffer.max_replay_age_seconds' on the edge agent profile, and failing the pipeline whenever retention is not strictly greater than the replay horizon plus your worst observed clock skew. The decision rule is that dedup retention must cover the longest time an instruction can sit in any buffer, and an edge agent must refuse to replay anything older than that horizon, escalating it to manual reconciliation instead of guessing.

The remaining trade-off is storage against autonomy: either the gateway pays for a key store sized to the plant's longest tolerated disconnection, perhaps tens of millions of keys by a loose estimate for a large multi-site fleet, or the plant accepts a shorter offline horizon and stops machine payments earlier during an outage, and whichever you choose, write it down as one number owned by one team so the next review has something to check against.

Related Architecture Specifications (WCBDC): walletcert.com · wcbdcwallet.com · wcbdcnet.com

More Technical Articles on wcbdcgrid.com

Performance Benchmarking of Private BFT Ledgers Under 50,000 Industrial M2M Transactions Per Second →TPM 2.0 and Hardware Enclave Key Isolation for Unattended Autonomous Machine Wallets →