A full crypto exchange built for Nigeria: a Spring Boot matching engine and double-entry ledger, naira and crypto deposits, KYC, and a Flutter mobile app.
A full crypto exchange built for Nigeria: a Spring Boot matching engine and double-entry ledger, naira and crypto deposits, KYC, and a Flutter mobile app. Explore the repository for the source code and the latest project information.
LANGUAGE
Java · Dart
FOCUS
Matching engine and ledger · Naira and crypto rails · Flutter mobile app
Home: portfolio value and hot marketsTrade: live chart, order book and order formAssets: balances with average cost and P&LEarn: flexible and fixed-term savingsLight themeYorùbá, one of four languages
Sandbox funds, live reference prices.
ARCHITECTURE
One API, every rail behind an interface.
CLIENTS
Flutter appAndroid and iOS · 4 languages
Admin console2FA operators · audit log
HTTPS · JWT · server-sent events
SPRING BOOT API · JAVA 21
Auth and sessionsOrders and matchingDouble-entry ledgerWallets and custodyNaira paymentsKYC and screeningMarket dataEarn and referrals
SQL · FlywayProvider interfaces
DATA
PostgreSQLLedger, orders, trades · checks enforced in the schema
Object storageEncrypted KYC documents
PROVIDERS
PaymentsSandboxPaystack · Flutterwave
CustodySandboxFireblocks · BitGo
IdentitySandboxSmile ID · Sumsub
ScreeningSandboxChainalysis · TRM
PushLiveFirebase Cloud Messaging
PricesLiveBinance · MEXC · Gate.io
LIFE OF AN ORDER
Six steps, one database transaction.
01
Deduplicate
A repeated client order id returns the original order. Submissions with the same id are serialized so the check cannot race itself.
02
Lock the market
The market row is locked with SELECT … FOR UPDATE, so exactly one transaction matches a given market at a time.
03
Reserve funds
A ledger transfer moves the order’s cost from AVAILABLE to LOCKED. If funds are short, the order is never written.
04
Match
Resting orders are crossed best price first, then oldest first. Each maker row is locked, so one cancelled mid-match is skipped.
05
Settle each fill
Both legs and the fees post as one balanced ledger transaction, at the maker’s price, which is never worse than the taker’s limit.
06
Release
Once an order is done, any unused reservation, including rounding dust, goes back to AVAILABLE.
KEY DECISIONS
Where the hard parts were.
Correctness
A ledger that cannot drift
Every balance change is a double-entry transaction whose entries must sum to zero for each asset. Customer accounts can never go negative, accounts are locked in a fixed order to rule out deadlocks, and a unique reference makes every posting idempotent. A metric alerts if the books ever stop balancing.
Trade-off
Matching serialized in Postgres
Rather than an in-memory engine, matching runs inside the database transaction behind a per-market row lock. It is simple to reason about and impossible to double-spend, at the cost of horizontal scale. The next step is a single-writer engine per market fed by an event log.
Design
Providers behind interfaces
Payments, custody, identity checks, screening and push each sit behind an interface with a sandbox implementation. The whole exchange runs end to end with no external accounts, and a real provider plugs in without touching the core.
Safety
Reference prices never trade
Live prices from external venues are for display only. They never create ledger entries or trades. Market orders also only fill within a band around the best price, so a thin book cannot fill someone at an absurd price.
SECURITY
Built as if the money were real.
Admin sign-in with mandatory TOTP, lockout after 5 failures, and hashed session tokens
KYC documents encrypted with AES-256-GCM before they reach object storage
Payment webhooks verified by HMAC-SHA512 signature and processed once per event id
Withdrawal limits by KYC level, plus sanctions screening of every destination address
Per-client rate limiting, request ids on every log line, and Prometheus metrics
CI runs the test suite, builds the Docker image and scans every push for secrets
TESTING
Proving it under contention.
Integration tests run against a real Postgres database, not mocks. They fire concurrent orders and reservations at the same account and assert that nothing is ever spent twice, and they check that settlement and rounding leave the ledger summing to zero.
The test setup refuses to run against any database whose name does not contain “test”, so a stray connection string can never wipe real data.
STATUS
Feature-complete in sandbox: trading, convert, deposits and withdrawals, KYC, Earn and referrals all run end to end. Before real money it needs licensing with SEC Nigeria, live payment, custody and identity providers, and production liquidity. The source is private; I’m happy to walk through it.
Open to new work. I’m most interested in backend systems, embedded and IoT work, cloud infrastructure and energy technology. Email is the fastest way to reach me.
Open to full-time roles, contract work, and interesting conversations about building useful systems.
1