Back to work
FINTECH · EXCHANGE

Zyvora

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.

View on GitHub
PROJECT NOTES · Java · Dart
ASMODEUS8 / ZYVORA
Zv

Trading, built for Nigeria.

01Matching engine and ledger
02Naira and crypto rails
03Flutter mobile app
MADE WITH CURIOSITY ↗

Trading, built for Nigeria.

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
SOURCE
GitHub
15klines of Java
14klines of Dart
113backend tests
26schema migrations

Flutter, running against the real API.

Home: portfolio value and hot markets
Home: portfolio value and hot markets
Trade: live chart, order book and order form
Trade: live chart, order book and order form
Assets: balances with average cost and P&L
Assets: balances with average cost and P&L
Earn: flexible and fixed-term savings
Earn: flexible and fixed-term savings
Light theme
Light theme
Yorùbá, one of four languages
Yorùbá, one of four languages

Sandbox funds, live reference prices.

One API, every rail behind an interface.

CLIENTS
Flutter appAndroid and iOS · 4 languages
Admin console2FA operators · audit log
SPRING BOOT API · JAVA 21
Auth and sessionsOrders and matchingDouble-entry ledgerWallets and custodyNaira paymentsKYC and screeningMarket dataEarn and referrals
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

Six steps, one database transaction.

  1. 01

    Deduplicate

    A repeated client order id returns the original order. Submissions with the same id are serialized so the check cannot race itself.

  2. 02

    Lock the market

    The market row is locked with SELECT … FOR UPDATE, so exactly one transaction matches a given market at a time.

  3. 03

    Reserve funds

    A ledger transfer moves the order’s cost from AVAILABLE to LOCKED. If funds are short, the order is never written.

  4. 04

    Match

    Resting orders are crossed best price first, then oldest first. Each maker row is locked, so one cancelled mid-match is skipped.

  5. 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.

  6. 06

    Release

    Once an order is done, any unused reservation, including rounding dust, goes back to AVAILABLE.

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.

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

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.

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.

NEXT PROJECTShipyard

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.

Full-time · Contract · Remote or on-site in Lagos

Comment
AB
Adewale Babalola

Open to full-time roles, contract work, and interesting conversations about building useful systems.

1