Skip to content

Mezgeb Engineering Roadmap

The goal is a professionally engineered, secure, reliable, auditable double-entry ledger: an open-source project in its own right, ready to become the core accounting infrastructure of production payment applications.

Folder / file Steps Contents
phase-1-core-engine/ 1.01–1.16 Accounting Model and Core Engine
phase-2-operations-and-security/ 2.01–2.16 Financial Operations, API, Security and Offline
phase-3-scale-and-integration/ 3.01–3.16 Scale, Operations and Client Integration
phase-4-finalization/ 4.01–4.04 Finalization
strategies.md Testing, security, database and operations strategies; readiness checklist
../architecture.md Stack evaluation, system shape, data model, the 10 architectural questions
  • The work is divided into 52 steps in four phases. A step ID such as 2.05 means phase 2, step 5. Each step has its own file with an objective, tasks, tests, deliverables and an Exit Gate.
  • Steps run in dependency order. A step closes only when its exit gate is demonstrated and the evidence is committed under docs/evidence/. If a gate fails, the step repeats; later steps don’t start.
  • Each step is sized at about 15–20 focused hours of work.
  • Steps 1.10, 1.15, 2.10, 2.12–2.14, 3.03 and 3.04 are the most likely to overrun. Budget 1.5–2× for each. Step 3.08 has deliberate spare capacity.
Milestone Reached after Evidence
M0 Model agreed 1.03 Worked entries, ADRs, invariants v1, threat model v0
M1 Engine correct 1.16 Tag v0.1.0-engine: concurrency, idempotency, holds, reversals, verify, chaos clean
M2 Functional and secured 2.16 Tag v0.2.0-functional: all operations, secured API, audit chain, offline simulator clean
M3 Shadow on live traffic 3.16 Tag v0.9.0-rc-shadow: targets met, DR proven, 14 clean shadow days
M4 Release candidate 4.04 Tag v1.0.0-rc.1, readiness checklist with evidence, cutover rehearsed

Model (1.01–1.03) → types (1.04–1.06) → oracle (1.07) → schema (1.08) → posting (1.09) → concurrency (1.10) → idempotency (1.11) → corrections (1.12) → verification (1.13) → holds (1.14) → failure proof (1.15) → templates (2.01) → money operations (2.02–2.04) → periods (2.05) → API (2.06–2.07) → access control (2.08) → audit (2.09) → offline (2.10–2.14) → reconciliation (2.15) → security gate (2.16) → performance (3.01–3.05) → integration plumbing (3.06–3.08) → operations (3.09–3.12) → migration (3.13–3.16) → finalization (4.01–4.04).

graph TD
S1[1.01 Accounting model] --> S2[1.02 ADRs]
S2 --> S3[1.03 Invariants / threats / regulation]
S2 --> S4[1.04 Money & IDs]
S4 --> S5[1.05 Chart of accounts]
S5 --> S6[1.06 Journal entries]
S6 --> S7[1.07 Oracle]
S3 --> S8[1.08 Schema]
S6 --> S8
S7 --> S9[1.09 Posting]
S8 --> S9
S9 --> S10[1.10 Concurrency]
S10 --> S11[1.11 Idempotency]
S11 --> S12[1.12 Reversals]
S12 --> S13[1.13 Verification]
S13 --> S14[1.14 Holds]
S14 --> S15[1.15 Fault injection]
S15 --> S16[1.16 Phase 1 gate]
S16 --> S17[2.01 Templates]
S17 --> S18[2.02 Deposits/withdrawals]
S17 --> S19[2.03 Payments & fees]
S19 --> S20[2.04 Refunds/disputes]
S13 --> S21[2.05 Periods]
S18 & S20 & S21 --> S22[2.06 API design]
S22 --> S23[2.07 API impl]
S23 --> S24[2.08 AuthZ]
S24 --> S25[2.09 Audit chain]
S14 & S25 --> S26[2.10 Offline design]
S26 --> S27[2.11 Vouchers] --> S28[2.12 Receipts] --> S29[2.13 Conflicts] --> S30[2.14 Offline sim]
S18 & S21 & S29 --> S31[2.15 Reconciliation]
S30 & S31 --> S32[2.16 Phase 2 gate]
S32 --> S33[3.01 Benchmark] --> S34[3.02 Indexes] --> S35[3.03 Hot accounts]
S34 --> S36[3.04 Partitioning]
S34 --> S37[3.05 Reporting]
S23 --> S38[3.06 Outbox]
S31 --> S39[3.07 Settlement]
S36 --> S43[3.11 CI/CD]
S13 --> S41[3.09 Observability]
S25 --> S42[3.10 Backups/DR]
S27 --> S44[3.12 Secrets/keys]
S38 --> S45[3.13 Integration design] --> S46[3.14 Replay] --> S47[3.15 Shadow] --> S48[3.16 Phase 3 gate]
S48 --> S49[4.01 Game day] --> S50[4.02 Security assessment] --> S51[4.03 Runbooks] --> S52[4.04 Release]

Very high overall. The accounting core (Phase 1) is high complexity. Offline settlement (2.10–2.14) is the hardest part and has no off-the-shelf reference. Migrating the first client application (3.13–3.16) carries the most operational risk.

  1. Concurrency correctness under contention (1.10, 3.03).
  2. Offline protocol: cloned devices, gaps and late receipts with sound accounting (2.10–2.14).
  3. Partitioning a live, append-only, uniquely-constrained schema (3.04).
  4. Proving crash safety rather than assuming it (1.15, 4.01).
  5. Migrating live money with zero unexplained differences (3.13–3.16).
  • Self-review blindness on security and accounting. Plan external eyes (below).
  • Operations on call: one person cannot be on call permanently. Before go-live, arrange at least one more person who can follow the runbooks.
  • Sustained pace: protect your other commitments; if a step slips, the schedule slips. Don’t skip gates.
  • Hardware coupling: offline depends on card and phone capabilities being decided by the tap-to-pay work.
Area Reviewer When
Chart of accounts, posting rules, reports Accountant / auditor 1.01, 2.05, 3.05
Offline cryptographic protocol Security engineer with crypto background 2.10, 4.02
API and application security Penetration tester 4.02
Schema, locking, partitioning, backups Experienced PostgreSQL DBA 1.08, 1.10, 3.04, 3.10
Regulatory applicability Ethiopian fintech legal advisor 1.03, before go-live
  • NBE rules for stored value, offline limits, record retention and reporting (1.03).
  • Card chip capabilities: secure element, counter, signing (before 2.10; affects current card work).
  • Android Keystore/StrongBox attestation reliability on devices common in Ethiopia (2.10).
  • PostgreSQL MVCC, explicit locking, isolation and WAL chapters (before 1.08–1.10).
  • Partner bank statement formats (before 2.15). Decided in 2.15: a generic CSV with a mapping per bank (statement format); the first real bank still needs its mapping.
  1. Every entry balances, enforced in types, the engine and the database.
  2. History is never modified. Corrections are new entries.
  3. Idempotency commits in the same transaction as the money movement.
  4. No float money; no silent rounding.
  5. The ledger is the source of truth, and caches never override it.
  6. Offline spending is always backed by reserved escrow.
  7. No manual money movement without maker-checker and an audit event.
  8. No production claim without evidence.

The maintainer’s working plan: one step per work week of about 15–20 focused hours, not a calendar week. At a weekends-only pace, the 52 steps take roughly 12–18 calendar months. Correctness comes before the date: if a step slips, only this table changes.

Is the plan long enough? For a release candidate with evidence: yes, tightly. For going live: not on its own. Going live also needs at least 30 clean shadow days, an external review and possibly regulatory sign-off, which plausibly adds 1–3 months after step 4.04. No gate is shortened to hit a date.

Step Topic Target week Status
1.01 Accounting Foundations and Worked Examples 1 Done (evidence; accounting review pending)
1.02 Architecture Decision Records and Repository Restructure 2 Done (evidence)
1.03 Invariant Catalogue, Threat Model v0, Regulatory Applicability 3 Done (evidence; regulatory answers pending)
1.04 Money, Currency and Identifier Types 4 Done (evidence)
1.05 Chart of Accounts and the Account Model 5 Done (evidence; accounting review pending)
1.06 Journal Entries and Posting Rules (Pure Core) 6 Done (evidence)
1.07 In-Memory Reference Ledger (the Oracle) 7 Done (evidence)
1.08 PostgreSQL Schema v1, Constraints and Roles 8 Done (evidence)
1.09 Atomic Posting with SQLx 9 Done (evidence)
1.10 Concurrency Control and Concurrent Spending 10 Done (evidence)
1.11 Idempotency and Exactly-Once Effect 11 Done (evidence)
1.12 Reversals and Adjustments 12 Done (evidence)
1.13 Balance Verification and Integrity Checking 13 Done (evidence)
1.14 Holds and Two-Phase Operations 14 Done (evidence)
1.15 Failure Injection and Crash Recovery for the Core 15 Done (evidence)
1.16 Phase 1 Consolidation, Baseline Benchmark and Exit Review 16 Done (evidence)
2.01 Operations Layer and Posting Templates 17 Done (evidence)
2.02 Deposits, Withdrawals, Clearing and Suspense Accounts 18 Done (evidence)
2.03 Transfers, Merchant Payments and Fees 19 Done (evidence)
2.04 Refunds and Disputes 20 Done (evidence; dispute policy review pending)
2.05 Accounting Periods, Closing and Trial Balance 21 Done (evidence)
2.06 REST API Design (Contract First) 22 Done (evidence; contract review pending)
2.07 REST API Implementation (Axum) 23 Done (evidence)
2.08 Authentication, Authorization and Privilege Separation 24 Done (evidence)
2.09 Audit Logging and Tamper Evidence 25 Done (evidence)
2.10 Offline Architecture and Protocol Design (Design Only) 26 Done (evidence; security review requested)
2.11 Device Registry and Voucher Issuance 27 Done (evidence)
2.12 Receipt Ingestion and Settlement 28 Done (evidence)
2.13 Gaps, Conflicts, Expiry, Rejections and Disputes 29 Done (evidence)
2.14 Offline Deterministic Simulation 30 Built (evidence); accepted after 14 consecutive clean nightly runs
2.15 Reconciliation (Internal, External, Offline) 31 Done (evidence)
2.16 Phase 2 Security Review and Exit 32 Review done (evidence); the gate and the tag wait for 2.14’s 14 clean nights
3.01 Performance Methodology and Realistic Workload 33 Not started
3.02 Indexing and Query Optimisation 34 Not started
3.03 Hot Accounts and Contention 35 Not started
3.04 Partitioning, Retention and Archival 36 Not started
3.05 Reporting and Financial Statements 37 Not started
3.06 Transactional Outbox and Event Integration 38 Not started
3.07 Merchant Settlement Automation 39 Not started
3.08 Multi-Currency, Multi-Tenant and ISO 20022 Evaluation 40 Not started
3.09 Observability: Logs, Metrics, Dashboards, Alerts 41 Not started
3.10 Backups, Point-in-Time Recovery and Disaster Recovery 42 Not started
3.11 Deployment and CI/CD 43 Not started
3.12 Secrets, Key Management and Operational Security 44 Not started
3.13 Client Integration Design and Account Mapping 45 Not started
3.14 Historical Replay and Migration Verification 46 Not started
3.15 Shadow Mode Implementation 47 Not started
3.16 Shadow Operation, Discrepancy Resolution and Phase 3 Exit 48 Not started
4.01 Full-System Fault Injection and Recovery Game Day 49 Not started
4.02 Security Assessment 50 Not started
4.03 Runbooks, Operational Documentation and Readiness Review 51 Not started
4.04 Release Candidate, Cutover Plan and Open-Source Release 52 Not started