Case study · Central bank

National e-money platform for 100M+ people

I engineered core backend services for a national digital currency platform, built to replace physical cash for a population of over 100 million, with security and high volume as the two non-negotiables.

  • 4,000transactions a second sustained, 12,000 at peak
  • 9Mwallets onboarded in the first 18 months
  • 99.99%availability
  • 0unreconciled transactions

Challenge

  • Every transaction had to be exactly correct: no double spends, no lost transfers, a full audit trail.
  • Load had to scale from launch-day sign-ups to everyday national payments, with sharp peaks at month-end and holidays.
  • It had to meet central-bank security and regulatory standards, and work with commercial banks, wallets and merchants.

What I built

  • Ledger and transaction services using double-entry accounting, idempotency keys and strong consistency on the money path.
  • Wallet, onboarding and KYC flows with tiered limits, linked to national identity and bank systems.
  • Integration APIs for banks, payment providers and merchants, with mutual TLS, request signing and rate limiting.
  • Event-driven processing for settlement, notifications, reconciliation and fraud and AML monitoring.
  • Security throughout: HSM-backed keys, encryption in transit and at rest, least-privilege access, tamper-evident audit logs, and penetration-test fixes.
  • Horizontal scaling, load and chaos testing, and disaster recovery across data centres.

Stack

Java/Spring Boot, Go, Kotlin, PostgreSQL, Redis, Kafka, a permissioned distributed ledger for issuance, Kubernetes, HashiCorp Vault, HSMs, OAuth 2.0/OpenID Connect, ISO 20022 messaging, Prometheus, Grafana, ELK.

System design

The platform follows a two-tier model. The central bank issues e-money to commercial banks, and banks and licensed wallet providers distribute it to citizens and merchants. Every movement of money is a double-entry ledger transaction.

Every movement of money is a double-entry ledger transactionissuancesame transactionrelayCentral bank treasurymaker-checker, HSM-heldkeysPermissioned ledgerCommercial banksWallet app or bank systemAPI gatewayOAuth 2.0/OpenIDConnect, mutual TLSPayment serviceJava/Spring BootRedisidempotency keyLedger servicePostgreSQL, debit andcredit entriesOutbox tableKafkaNotificationsSettlement andreconciliationISO 20022AML and fraudGo consumersAnalyticsNational real-time grosssettlement systemCase-management queue
  1. Issuance: requests to mint or redeem e-money come from the central bank's treasury and need two approvers (maker-checker). They are signed with HSM-held keys and recorded on a permissioned ledger shared with participating banks. Total e-money in circulation is reconciled against reserve accounts every day.
  2. Payment request path: a wallet app or bank system calls the API gateway, which checks OAuth 2.0/OpenID Connect tokens for users and mutual TLS plus signed requests for institutions. The payment service (Java/Spring Boot) checks the idempotency key, the sender's limits for their KYC tier and a real-time fraud score before passing the transfer to the ledger.
  3. Ledger service: each transfer is one PostgreSQL transaction holding a debit entry and a matching credit entry. Accounts are locked in a fixed order (by account ID) to avoid deadlocks, and the balance check happens inside the same transaction. Entries are never edited, only reversed with new entries. Very busy accounts such as large merchants are split into sub-accounts, so they do not become a locking bottleneck.
  4. Exactly-once effect: each request's idempotency key is cached in Redis and protected by a unique constraint in the database. A retried payment returns the original result instead of moving money twice.
  5. Transactional outbox: the same database transaction writes an event to an outbox table. A relay publishes it to Kafka for notifications, settlement, AML monitoring and analytics, so an event is never lost and never sent for a transfer that did not commit.
  6. Settlement and reconciliation: at end of day, net positions between participating banks are calculated from the ledger and settled through the national real-time gross settlement system using ISO 20022 messages. Automated reconciliation compares ledger totals, event counts and bank statements.
  7. AML and fraud: Go consumers apply streaming rules (unusual velocity, structuring just under limits, new-device patterns) and raise alerts into a case-management queue for investigators.
  8. Security: signing and encryption keys never leave the HSMs, and Vault issues short-lived credentials. All service-to-service traffic uses mutual TLS within segmented networks. Admin actions need a second approver, and the audit log is hash-chained, so any tampering is detectable.
  9. Disaster recovery: two data centres run with synchronous PostgreSQL replication to a standby, so recovery point is near zero. Kafka is mirrored. Failover is rehearsed quarterly against a 15-minute recovery target, and load tests run at 3x expected peak.

Results

  • Reach: built for a population of 100M+, with 9M wallets onboarded in the first 18 months
  • Throughput: 4,000 transactions per second sustained, 12,000 at peak
  • Ledger accuracy: zero unreconciled transactions; daily reconciliation in 7 minutes
  • Availability: 99.99%, with recovery point near zero and a 15-minute recovery time
  • Security: zero critical findings open after each external penetration test
Back to Work & Research