Wallets and stored value: design and regulation
A wallet balance is a promise the company owes. Limits decide how big the promise can get, and safeguarding decides whether the cash is there when customers ask for it
The lab's generator ships with invented KYC tier limits. Tier 1 is ₦30,000 a day out and a ₦200,000 balance cap. Tier 2 is ₦200,000 a day and a ₦1,000,000 cap. You replace them with limits of ₦50,000 and ₦300,000 for tier 1, and ₦200,000 and ₦500,000 for tier 2, then regenerate with the same seed. What happens to the limit failures?
Changing a number in a config file feels small. In a wallet it changes who can pay whom, which attempts fail, and how much customer money you hold. This chapter takes the wallet apart in three layers: what a wallet is in the books, what the rules on its size are, and where its cash sits.
A wallet balance is a promise
Stored value is money a company holds for a customer to spend or withdraw on demand. A wallet is the screen on which the customer sees it. In double entry for engineers you booked each customer’s wallet as a liability: the company owes the customer that sum. The asset that covers it is cash at the partner bank. In the lab those are two different kinds of account, and the difference carries the whole chapter.
| Side | Account | What it means |
|---|---|---|
| Liability | wallet:<customer id> |
What the company owes one customer. Goes up when money comes in, down when it goes out |
| Asset | settlement_bank |
Cash at the partner bank |
| Asset | card_clearing |
Card money the processor owes the company and has not yet paid |
| Equity, income, expense | share_capital, fee_revenue, processing_expense |
The company’s own money and its earnings |
Three questions follow, and each belongs to a different owner.
- How large can a promise be? Limits on the balance and on daily outflow. Regulators set them by KYC tier. KYC, short for know your customer, is the verification a company does on who a customer is.
- Who checks that a payment respects the limit? The wallet’s policy code, before it posts. The ledger does not.
- Where does the money that covers the promises sit? That is safeguarding: keeping customers’ money separate from the company’s, so it is there if the company fails.
Whether holding members’ balances needs a licence, and which one, is a question for the module on licences. This chapter takes the wallet as given and works on what any wallet must get right.
Who owns which rule
In the wallet ledger project your ledger accepted the attempts that the generator had refused for a balance cap or a daily limit. That was right. A ledger proves arithmetic: debits equal credits, and no wallet goes below zero. It does not know that a tier 1 customer may hold ₦300,000 and a tier 2 customer ₦500,000. Those are policy, and they change when a regulator or a product manager changes them.
So the wallet needs a policy layer in front of the ledger. It reads the customer’s tier, looks up the limits, checks the attempt, and only then posts. Two properties matter.
The check and the posting happen together. Two payouts submitted at the same moment can each see ₦30,000 of daily allowance left and each pass. Check and post inside one database transaction, or lock the wallet’s row first. The lesson on check-then-act lets you break the unsafe version.
The limit version is recorded. When a limit changes, yesterday’s refusals were still correct for yesterday’s rule. Store which limit set decided each attempt, or you will not be able to explain a refusal to an examiner or a customer later.
KYC tiers and their limits
A KYC tier is a level of verification, with limits that grow as the checks grow. A customer who has given little proof of identity gets a small wallet. A customer who has given more gets more room. Commentary on the CBN’s Supervisory Framework for Payment Service Banks (2021) says it provides three-tier KYC requirements, with flexible account-opening requirements for low-value and medium-value accounts that are subject to caps and restrictionsas of 2026-11. That is from search summaries of the framework, and none of them gave its limits. The CBN’s Customer Due Diligence Regulations 2023 list tiered KYC as a regulation (16) of their own, and commentary says it points to the tiered KYC measures in CBN circulars and applies to individuals, not legal personsas of 2026-11, again from search summaries. Identity requirements for each tier have been revised since the first circular. KYC itself belongs to the Compliance course, so this chapter uses only the limits.
The limits are where the sources disagree, and you should see the disagreement before you pick a number. Nothing below was read from the CBN’s own pages, because they could not be fetched. Every figure comes from search summaries of a circular or from a regulatory-database listing of its text.
- The set the lab uses. A regulatory database lists CBN circular BPS/DIR/GEN/CIR/04/007 of September 2017, addressed to mobile money operators, and search summaries of it give these mobile money wallet limits: Level 1 ₦50,000 daily and ₦300,000 cumulative balance, Level 2 ₦200,000 daily and ₦500,000 balance, Level 3 ₦5,000,000 daily with the balance unlimitedas of 2026-11. The summaries add that BVN (bank verification number) is not required at Level 1 and is mandatory at Levels 2 and 3.
- An earlier, lower set. The first tiered KYC circular is dated 18 January 2013. The database lists it as FPD/DIR/CIR/GEN/02/001, and a 2016 circular cites it under another number, so the reference varies between sources. A 1 July 2016 circular (FPR/DIR/CIR/GEN/06/002) is listed as an upward review of limits for Tier 1 and 2, but its table was garbled in the summary. Press reports say the 2013 Tier 1 limits were a ₦20,000 single deposit and a ₦200,000 balance cap, later raised. The ₦200,000 is also the invented cap in the lab’s generator, so the generator’s Tier 1 is close to the 2013 reading.
- The 2021 framework is unconfirmed. The CBN’s July 2021 Regulatory Framework and Guidelines for Mobile Money Services in Nigeria replaced the 2015 rules, and a law-firm summary says its guidelines set transaction limits for each tier. The summaries gave no table. One press report says the 2021 rules removed the ₦300,000 balance cap and raised daily activity to ₦5 million. This chapter cannot confirm or refute that, so it does not use the 2021 framework as the source of any figure.
- A later circular. A CBN circular of 1 December 2023 (PSM/DIR/PUB/CIR/001/053) amends the BVN framework to require a BVN or NIN (national identification number) for Tier 1 wallets and accountsas of 2026-11. One summary of it quotes Tier 1 as ₦50,000 a day with a ₦300,000 maximum balance. That is one summary, not the circular’s table.
- Different account types. Tier limits can differ between bank accounts and mobile money wallets. A figure with no named instrument is not a figure to use.
The lab therefore uses one stated, dated set: the 2017 mobile money wallet limits above, as search summaries reported them in November 2026, with a December 2023 summary agreeing for Tier 1. It is a design input for an exercise. It does not say what applies to any real product today, and a real wallet needs the current circular read in full by whoever signs off the limits.
| Tier | Invented (the generator’s own) | The set you will use |
|---|---|---|
| 1 | ₦30,000 daily out, ₦200,000 balance | ₦50,000 daily out, ₦300,000 balance |
| 2 | ₦200,000 daily out, ₦1,000,000 balance | ₦200,000 daily out, ₦500,000 balance |
| 3 | ₦5,000,000 daily out, no cap | ₦5,000,000 daily out, no cap |
The generator models two limits: daily_debit and max_balance. It has no per-transaction limit, so it reads “daily transaction limit” as the most a customer can send out in a day. If the CBN’s table means something else, the numbers change and the code does not.
Enforcing a limit in code
Two small calculations come up in every wallet, and both have edges.
The daily limit counts fees. In the generator a payout is checked as amount + fee against the day’s allowance. Take a tier 1 wallet with ₦50,000 a day. The wallet sends ₦40,000, and the fee is ₦25, because the generator charges ₦25 on payouts above ₦5,000 and up to ₦50,000. That uses ₦40,025 (4,002,500 kobo). The remainder is ₦9,975.
- A further ₦10,000 payout costs ₦10,025 with its fee. 4,002,500 + 1,002,500 = 5,005,000 kobo, which is more than 5,000,000, so it is refused.
- A ₦9,950 payout costs ₦9,975. 4,002,500 + 997,500 = 5,000,000 kobo, exactly the limit. The generator’s test is
used + amount > limit, so equal passes.
The balance cap tests what would arrive. A tier 1 wallet holding ₦250,000 that receives ₦60,000 would hold ₦310,000, which is above ₦300,000, so it is refused. The largest credit it can take is ₦50,000. A card funding credits the amount less the fee, and the generator tests that figure, not the amount charged.
Three more edges are worth settling before the code is written.
- What is a day? The generator keys the allowance to the calendar date in West Africa Time. A rolling 24-hour window is a different rule, and the search summaries this chapter read give no definition of the day. Choose one, write it down and test around midnight.
- Do returns give the allowance back? In the generator, a payout that the beneficiary bank returns restores the wallet’s balance but not the day’s allowance: the daily total is not reduced. Whether that is right is a policy choice, and the code should make it visibly.
- What does a tier change do? If a customer moves from tier 2 to tier 1, the new cap may be below the balance. A common approach is to stop credits and allow spending until the balance falls under the cap. It does not take the money away.
When the limit is on the credit side
Refusing an outgoing payment is easy to reason about: nothing has moved, and the customer is told. Refusing an incoming credit is not. In the lab, a funding_transfer that would breach the cap is recorded as a failed attempt with no entries. That hides the hard part. In a real instant payment the sender’s bank has already debited the sender when the credit arrives. If the wallet cannot take it, the money has to go somewhere: returned, held in a suspense account, or credited anyway. Each is a design choice with a cost. The nigerias-rails chapter ran a name enquiry against the lab’s switch, and the response includes the wallet’s KYC tier. A sending bank can use that to avoid a doomed transfer, but a balance can change between the enquiry and the transfer, so the wallet’s own check at credit time stays.
The lab data shows a subtler hole. The cap is checked on funding, card and wallet-to-wallet credits. It is not checked on payout_reversal, the credit that returns a payout the beneficiary bank sent back. Step 2 finds two tier 1 wallets that crossed ₦300,000 only because of a returned payout. One held ₦252,010.12 and received ₦50,000.00 back, ending at ₦302,010.12. Refusing a return would hold the customer’s own money, so exempting returns may be right. What is wrong is not knowing that the rule is exempt.
Where customer money sits
Name the failure first. A company keeps customer money and its own in one bank account. It pays salaries from that account, because it is the account with cash in it. Nobody breaks a rule on any one day. A few months later the wallets total more than the cash, and the shortfall is invisible until a customer asks to withdraw.
Safeguarding is the set of rules and practices that prevent this. You can see the problem in the lab’s ledger, because the trial balance has a built-in identity. Assets equal liabilities plus equity plus income minus expenses, so:
cash + card_clearing − wallets = own funds
where own funds are share capital plus fees earned minus processing expense. Rearranged, the cushion of cash over the wallets is own funds minus card_clearing. Step 3 computes both sides at the end of the lab’s data and gets the same number. It then asks a hard question: how much of the cash is customers’ money, and how much is the company’s? In the lab the company’s ₦50,000,000 of share capital sits in the same account as the wallets’ cover, so cash is above the wallets on every one of 179 days. Take the capital out and customers are short on 172 of those days, by as much as ₦1,051,093.67 on 27 May. The cause is card_clearing. A card funding credits the wallet at once, but the processor pays the cash the next day (see a card payment end to end). For that day the wallet holds money that is not yet cash.
A design that makes the ledger answer the question has four parts.
- Two bank accounts, two ledger accounts. Split
settlement_bankinto a customer pool, which holds customers’ money only, and operating cash, which holds the company’s. Each has its own statement and its own reconciliation. - A daily test. At the end of every day, the pool must be at least the sum of the wallets. A failed test is an incident, not a report.
- Sweeps are postings. Fee income earned moves from the pool to operating cash with a posting of its own, only after the fee is booked as earned. Nobody withdraws from the pool by hand.
- A plan for the float. Card money credited today and paid tomorrow has to be covered from somewhere. The company tops up the pool from its own funds, or credits the wallet only when the cash arrives. The tests in step 3 size the first option.
The reconciliation chapter of this module takes the daily statement-matching further.
What the rules say is a separate matter, and the sources here are summaries.
- Mobile money. Law-firm summaries of the CBN’s July 2021 framework say that for savings wallets the operator keeps two pool accounts at a settlement bank, one for principal and one for interest, that funds are insured through the NDIC’s pass-through deposit insurance (cover for each wallet holder, not for the operator), and that the operator must reconcile its pool account balances daily and report weekly to the CBNas of 2026-11. The summaries disagree on the cover: one report gives ₦500,000 per subscriber and another gives no figure. Read the framework for the exact wording, for what applies to wallets other than savings wallets, and for how customers rank against other creditors. The summaries do not say.
- Payment service banks. Press and law-firm summaries of the CBN’s 2020 payment service bank guidelines say a PSB accepts deposits from individuals and small businesses that deposit insurance covers, must keep at least 75% of its deposit liabilities in CBN securities, treasury bills and other short-term federal government debt instruments, and must not grant loans, advances or guarantees (they note an exception for loans to its own staff)as of 2026-11. The licences chapter in module 4 takes the licence up. Nigeria’s rails first placed both kinds of company.
- A comparison. The UK’s Electronic Money Regulations 2011, regulation 20, require an electronic money institution to safeguard funds received in exchange for electronic money it has issued, by one of two methods: keeping them segregated from its other funds or covering them with insurance or a comparable guaranteeas of 2026-11, as search summaries describe it; the segregation and insurance details sit in the regulations that follow it. The regulations were amended in 2017, so read the current version. In the administration of Ipagoo, an e-money institution, the High Court (2021) held that the safeguarding rules create no statutory trust over the funds, and the Court of Appeal (2022) upheld that outcome, noting that e-money holders have priority over other creditors in claims on the asset pool, which law-firm summaries say includes funds that should have been safeguarded and were notas of 2026-11. It is a useful case to read for what safeguarding gives customers when a firm fails: priority in the claim, not ownership of the cash. It is not Nigerian law.
Where it goes wrong
Limits copied from an article. A number in a config file with no source and no date is a number nobody can defend. Store the document, its date and the version, and have one named person approve each change. Searches for the Tier 1 limits turn up several different figures and instruments, as above.
A limit change that rewrites history. In the lab, a new limit set changes 83,887 attempts to 83,604, because every refusal alters the balances after it. In production, changes go forward only. Analysis done before and after a change has to know which set decided each row.
A cap that one path skips. Every credit path has to either check the cap or say why it is exempt. The returned payout is the example in the data.
Customer cash spent as operating cash. The ledger looks fine, because the books balance. Only the split between pool and operating accounts makes the problem visible.
Float counted as cash. card_clearing is a claim on the processor. It does not count towards the pool until it is paid.
You work in labs/finance. Every query runs through Python’s sqlite3 module. You will edit a copy of the generator, not generate.py itself, and write its data to a separate folder. The shared data in data/ stays untouched, because later chapters use it.
1. Count the limit failures by tier. Generate the shared data if you have not, then run this script.
cd labs/finance
python3 generate.py # skip if data/finance.sqlite exists
python3 - <<'PY'
import sqlite3
db = sqlite3.connect("data/finance.sqlite")
print("customers by tier")
for tier, n in db.execute("SELECT kyc_tier, COUNT(*) FROM customers GROUP BY 1"):
print(f" tier {tier}: {n:>5,}")
print("limit failures by the tier whose rule fired")
# Sender's tier, except recipient_balance_cap, which is the recipient's rule.
rows = db.execute("""
SELECT c.kyc_tier, t.failure_reason, COUNT(*)
FROM transactions t
JOIN customers c ON c.id = CASE t.failure_reason WHEN 'recipient_balance_cap'
THEN t.counterparty_customer_id ELSE t.customer_id END
WHERE t.status = 'failed'
AND t.failure_reason IN ('balance_cap', 'daily_limit', 'recipient_balance_cap')
GROUP BY 2, 1 ORDER BY 2, 1""").fetchall()
for tier, reason, n in rows:
print(f" {reason:<22} tier {tier} {n:>6,}")
for reason in ("balance_cap", "daily_limit", "recipient_balance_cap"):
print(f" {reason:<22} all {sum(n for _, r, n in rows if r == reason):>6,}")
PYcustomers by tier
tier 1: 1,069
tier 2: 647
tier 3: 284
limit failures by the tier whose rule fired
balance_cap tier 1 2,056
balance_cap tier 2 2
daily_limit tier 1 600
daily_limit tier 2 22
recipient_balance_cap tier 1 22
balance_cap all 2,058
daily_limit all 622
recipient_balance_cap all 22The invented limits show up almost entirely on tier 1: 2,056 of 2,058 balance caps and 600 of 622 daily limits. Tier 3 has no cap and a high daily limit, so it never fails. Tier 2’s cap of ₦1,000,000 is out of reach, so it fails twice. The totals are the 2,058 and 622 from the module 1 chapters. The query joins the recipient for recipient_balance_cap, because that rule belongs to the person receiving the money.
2. Replace the limits on a copy and compare. Copy the generator and open the copy.
cp generate.py generate_cbn.pyIn generate_cbn.py, replace lines 28 to 33 (the comment and the whole TIERS block) with this, which holds the set from the chapter and the date you checked it:
# KYC tier limits: the set the chapter chose from CBN mobile money circulars (checked 2026-11).
TIERS = {
1: {"daily_debit": 50_000 * NAIRA, "max_balance": 300_000 * NAIRA},
2: {"daily_debit": 200_000 * NAIRA, "max_balance": 500_000 * NAIRA},
3: {"daily_debit": 5_000_000 * NAIRA, "max_balance": None},
}Check your edit with diff, regenerate into a new folder (the copy still finds schema.sql beside it) and check the new database.
diff generate.py generate_cbn.py
python3 generate_cbn.py --out data-cbn
python3 check.py --db data-cbn/finance.sqlite28c28
< # Illustrative KYC tiers: single-transaction and daily debit limits, and a balance cap.
---
> # KYC tier limits: the set the chapter chose from CBN mobile money circulars (checked 2026-11).
30,31c30,31
< 1: {"daily_debit": 30_000 * NAIRA, "max_balance": 200_000 * NAIRA},
< 2: {"daily_debit": 200_000 * NAIRA, "max_balance": 1_000_000 * NAIRA},
---
> 1: {"daily_debit": 50_000 * NAIRA, "max_balance": 300_000 * NAIRA},
> 2: {"daily_debit": 200_000 * NAIRA, "max_balance": 500_000 * NAIRA},
customers 2,000
accounts 2,005
transactions 83,604
entries 192,039
bank_statement 56,288
planted breaks 9 (answers/breaks.csv)
accounts by type (debit-positive kobo): {'asset': 17260591427, 'equity': -5000000000, 'expense': 105494173, 'income': -213534625, 'liability': -12152550975}
settlement_bank in ledger 17,159,935,027 kobo; on the statement 17,166,267,314 kobo
OK: all invariants holdOnly the two limits that changed show in the diff. The new history has 83,604 attempts, not 83,887, and check.py prints OK. All six invariants hold because a tier’s cap is not one of them. The invariants prove arithmetic and a limit is policy, so a wrong limit and a right limit both leave the books in balance.
Now compare the two histories. This script counts the failures in both and replays each wallet’s balance to find the highest it ever reached.
python3 - <<'PY'
import sqlite3
def naira(kobo):
return f"₦{kobo // 100:,}.{kobo % 100:02d}"
SETS = (("invented", "data/finance.sqlite", {1: 200_000_00, 2: 1_000_000_00}),
("CBN set", "data-cbn/finance.sqlite", {1: 300_000_00, 2: 500_000_00}))
def failures(db):
out = {}
for tier, reason, n in db.execute("""
SELECT c.kyc_tier, t.failure_reason, COUNT(*)
FROM transactions t
JOIN customers c ON c.id = CASE t.failure_reason WHEN 'recipient_balance_cap'
THEN t.counterparty_customer_id ELSE t.customer_id END
WHERE t.status = 'failed'
AND t.failure_reason IN ('balance_cap', 'daily_limit', 'recipient_balance_cap')
GROUP BY 1, 2"""):
out[(reason, tier)] = n
return out
dbs = [sqlite3.connect(path) for _, path, _ in SETS]
old, new = failures(dbs[0]), failures(dbs[1])
print("1. failures by reason and tier")
print(f" {'reason':<22}{'tier':>5}{'invented':>10}{'CBN set':>9}")
for reason in ("balance_cap", "daily_limit", "recipient_balance_cap"):
for tier in (1, 2, 3):
a, b = old.get((reason, tier), 0), new.get((reason, tier), 0)
if a or b:
print(f" {reason:<22}{tier:>5}{a:>10,}{b:>9,}")
print(f" {reason:<22}{'all':>5}{sum(v for (r, _), v in old.items() if r == reason):>10,}"
f"{sum(v for (r, _), v in new.items() if r == reason):>9,}")
for label, sql in (("all attempts", "SELECT COUNT(*) FROM transactions"),
("all failed", "SELECT COUNT(*) FROM transactions WHERE status = 'failed'")):
a, b = (d.execute(sql).fetchone()[0] for d in dbs)
print(f" {label:<27}{a:>10,}{b:>9,}")
print("2. the highest balance each tier ever held, replaying the entries")
for (label, _, caps), db in zip(SETS, dbs):
tier = dict(db.execute("SELECT a.id, c.kyc_tier FROM accounts a JOIN customers c ON c.id = a.customer_id"))
bal, peak, passed = {}, {1: 0, 2: 0, 3: 0}, []
for acct, direction, kobo, kind in db.execute("""
SELECT e.account_id, e.direction, e.amount_kobo, t.kind FROM entries e
JOIN accounts a ON a.id = e.account_id JOIN transactions t ON t.id = e.transaction_id
WHERE a.type = 'liability' ORDER BY e.posted_at, e.id"""):
before = bal.get(acct, 0)
bal[acct] = before + (kobo if direction == "credit" else -kobo)
t = tier[acct]
peak[t] = max(peak[t], bal[acct])
if t in caps and before <= caps[t] < bal[acct]:
passed.append(kind)
print(f" {label}")
for t in (1, 2, 3):
c = caps.get(t)
note = f"cap {naira(c)}" if c else "no cap"
print(f" tier {t}: {naira(peak[t]):>16} ({note})")
print(f" crossings of a cap, by the kind of transaction that crossed it: {dict((k, passed.count(k)) for k in set(passed))}")
PY1. failures by reason and tier
reason tier invented CBN set
balance_cap 1 2,056 1,654
balance_cap 2 2 48
balance_cap all 2,058 1,702
daily_limit 1 600 198
daily_limit 2 22 17
daily_limit all 622 215
recipient_balance_cap 1 22 31
recipient_balance_cap 2 0 1
recipient_balance_cap all 22 32
all attempts 83,887 83,604
all failed 4,060 3,343
2. the highest balance each tier ever held, replaying the entries
invented
tier 1: ₦220,035.00 (cap ₦200,000.00)
tier 2: ₦982,859.95 (cap ₦1,000,000.00)
tier 3: ₦1,304,005.91 (no cap)
crossings of a cap, by the kind of transaction that crossed it: {'payout_reversal': 2}
CBN set
tier 1: ₦305,416.99 (cap ₦300,000.00)
tier 2: ₦499,604.77 (cap ₦500,000.00)
tier 3: ₦1,509,731.13 (no cap)
crossings of a cap, by the kind of transaction that crossed it: {'payout_reversal': 2}Tier 1’s looser limits cut its balance cap failures from 2,056 to 1,654 and its daily limit failures from 600 to 198. Tier 2’s cap halves, so its balance cap failures go from 2 to 48. Failures total 3,343 against 4,060: the new history is not the old one with a few attempts removed, because each refusal changes later balances. Part 2 shows tier 1 reaching ₦220,035.00 against a ₦200,000 cap, and ₦305,416.99 against ₦300,000, and in both runs the crossings are two payout_reversal credits. The generator checks the cap on every other way in, and not on returns. Tier 2 stays inside its cap in both runs.
3. Test whether customer money is covered. Back on the shared data in data/, replay the cash, the clearing account and the wallets day by day.
python3 - <<'PY'
import sqlite3
db = sqlite3.connect("data/finance.sqlite")
def naira(kobo):
sign = "-" if kobo < 0 else ""
kobo = abs(kobo)
return f"{sign}₦{kobo // 100:,}.{kobo % 100:02d}"
# Net movement per day, debit-positive, for five groups of accounts.
day_net = {}
for day, grp, kobo in db.execute("""
SELECT substr(e.posted_at, 1, 10),
CASE WHEN a.type = 'liability' THEN 'wallets' ELSE a.code END,
SUM(CASE e.direction WHEN 'debit' THEN e.amount_kobo ELSE -e.amount_kobo END)
FROM entries e JOIN accounts a ON a.id = e.account_id
GROUP BY 1, 2"""):
day_net.setdefault(day, {})[grp] = kobo
bal = dict.fromkeys(("settlement_bank", "card_clearing", "wallets", "share_capital",
"fee_revenue", "processing_expense"), 0)
short_a = short_b = 0
worst_a = worst_b = None
for day in sorted(day_net):
for grp, kobo in day_net[day].items():
bal[grp] += kobo
wallets = -bal["wallets"] # what customers are owed
cushion = bal["settlement_bank"] - wallets # cash left over after every wallet is covered
no_capital = cushion + bal["share_capital"] # the same, if the share capital were spent
short_a += cushion < 0
short_b += no_capital < 0
if worst_a is None or cushion < worst_a[0]:
worst_a = (cushion, day)
if worst_b is None or no_capital < worst_b[0]:
worst_b = (no_capital, day, bal["card_clearing"], -(bal["fee_revenue"] + bal["processing_expense"]))
last = (wallets, bal["settlement_bank"], bal["card_clearing"])
print("1. the last day of the data")
print(f" customers are owed {naira(last[0]):>18}")
print(f" settlement_bank (cash) {naira(last[1]):>18}")
print(f" card_clearing (owed us) {naira(last[2]):>18}")
print(f" cash minus wallets {naira(last[1] - last[0]):>18}")
own = -(bal["share_capital"] + bal["fee_revenue"] + bal["processing_expense"])
print("2. the identity: cash + clearing - wallets = own funds")
print(f" {naira(last[1] + last[2] - last[0])} = {naira(own)} (capital + fees - processing expense)")
print(f"3. end of every one of {len(day_net)} days with entries")
print(f" cash below wallets on {short_a} days; thinnest cushion {naira(worst_a[0])} on {worst_a[1]}")
print(f" with the ₦{-bal['share_capital'] // 100:,} share capital spent: cash below wallets on {short_b} days")
print(f" worst hole {naira(-worst_b[0])} on {worst_b[1]}: clearing {naira(worst_b[2])} less net fees earned {naira(worst_b[3])}")
PY1. the last day of the data
customers are owed ₦122,438,628.35
settlement_bank (cash) ₦171,896,465.89
card_clearing (owed us) ₦1,654,083.00
cash minus wallets ₦49,457,837.54
2. the identity: cash + clearing - wallets = own funds
₦51,111,920.54 = ₦51,111,920.54 (capital + fees - processing expense)
3. end of every one of 179 days with entries
cash below wallets on 0 days; thinnest cushion ₦48,948,906.33 on 2026-05-27
with the ₦50,000,000 share capital spent: cash below wallets on 172 days
worst hole ₦1,051,093.67 on 2026-05-27: clearing ₦1,772,558.00 less net fees earned ₦721,464.33Part 2 is the trial balance. Cash plus clearing minus wallets, ₦171,896,465.89 + ₦1,654,083.00 − ₦122,438,628.35, is ₦51,111,920.54, the same figure as share capital plus fees minus processing expense: ₦50,000,000.00 + ₦2,217,823.21 − ₦1,105,902.67. Cash covers the wallets on every day, but the capital is what makes that true. Take the ₦50,000,000 out and cash falls below the wallets on 172 of 179 days. The worst gap, ₦1,051,093.67 on 27 May, is the processor’s ₦1,772,558.00 float less the ₦721,464.33 of fees earned up to then: 1,772,558.00 − 721,464.33 = 1,051,093.67. A pool that holds customer money only would need that much of the company’s own money on that day to be covered.
Remove tier 1’s cap and see what the invariants say. Copy your edited generator with one change, regenerate to a third folder, and compare.
sed 's/"max_balance": 300_000 \* NAIRA/"max_balance": None/' generate_cbn.py > generate_break.py
python3 generate_break.py --out data-break
python3 check.py --db data-break/finance.sqlite | tail -1Then run a short script that counts the failures and the largest tier 1 balance in data-cbn and data-break.
python3 - <<'PY'
import sqlite3
def naira(kobo):
return f"₦{kobo // 100:,}.{kobo % 100:02d}"
for label, path in (("CBN set", "data-cbn"), ("tier 1 uncapped", "data-break")):
db = sqlite3.connect(f"{path}/finance.sqlite")
n = dict(db.execute("""SELECT failure_reason, COUNT(*) FROM transactions
WHERE status = 'failed' AND failure_reason IN ('balance_cap', 'daily_limit')
GROUP BY 1"""))
top, = db.execute("""SELECT MAX(s) FROM (
SELECT SUM(CASE e.direction WHEN 'credit' THEN e.amount_kobo ELSE -e.amount_kobo END) AS s
FROM entries e JOIN accounts a ON a.id = e.account_id JOIN customers c ON c.id = a.customer_id
WHERE c.kyc_tier = 1 GROUP BY e.account_id)""").fetchone()
print(f"{label:<16} balance_cap {n['balance_cap']:>5,} daily_limit {n['daily_limit']:>4,} "
f"largest tier 1 balance at the end {naira(top)}")
PYcheck.py prints OK: all invariants hold. The script prints a balance_cap count of 59, and the largest tier 1 balance at the end is ₦26,475,288.62, against ₦299,947.28 with the cap. A tier 1 wallet holding more than ₦26 million passes every check you have. Nothing in the books says it is wrong, so a test that reads the wallets against the tier limits has to exist apart from check.py. Write it, and run it in the daily job.
Template
# Wallet limits and safeguarding note: <product>
Written by <product manager> and <compliance officer> · Signed by <head of compliance> · <date>
Decision needed: <what is being approved> by <date>
## Limits we apply
| Tier | Daily out (fees included) | Balance cap | Source and date |
|---|---|---|---|
Definition of a day: <calendar date in West Africa Time, or rolling window>
Limit set version: <id>, replaces <id> from <date>
## When a limit is hit
- Daily limit on a payout: <what is refused, what the customer is told>
- Balance cap on a credit: <return, hold in suspense, or credit and flag; time limit>
- Credits exempt from the cap: <returned payouts or none>, because <reason>
## Where customer money sits
Customer pool account: <bank, ledger account>. Operating account: <ledger account>.
Card money owed but not yet paid: <figure>, covered by <own funds / wait for cash>
## The daily test
Each day end: pool balance on the bank statement is at least the sum of all wallets.
Matched by: <person or job>, at <time>. Shortfall: <who is told, what stops>.
## Evidence from the lab or the books
<Figures with the step that printed them>
## What this note cannot see
<One way it could be wrong, and what would show it>
## Out of scope
<Licence, identity checks, anything else>
## Sign-off
<Head of compliance>: approved / changes needed · <date> WORKED EXAMPLE
At a real company the product manager and the compliance officer write this note, and the head of compliance signs it. Here it is for the digital ajo in Ibadan, written by Saratu and the compliance officer on 20 November 2026, with Ugochi’s checks behind it.
Limits. The chapter’s set: Level 1 ₦50,000 daily and ₦300,000 cumulative balance, Level 2 ₦200,000 daily and ₦500,000 balance, Level 3 ₦5,000,000 daily with the balance unlimitedas of 2026-11. These come from search summaries of a 2017 mobile money circular, so the head of compliance reads the current circular in full before signing. A day is the calendar date in West Africa Time.
When a limit is hit. The daily limit counts fees: ₦40,000 sent uses ₦40,025, so a further ₦10,000 payout is refused and a ₦9,950 one passes. A member at ₦252,010.12 who is sent ₦60,000 would reach ₦312,010.12, above the cap. Proposal: hold it in suspense, tell the member, offer an upgrade. Returned payouts stay exempt, logged and counted: in the lab two tier 1 wallets crossed ₦300,000 that way, one ending at ₦302,010.12.
Customer money. On the lab’s last day members are owed ₦122,438,628.35 and the bank holds ₦171,896,465.89, with ₦1,654,083.00 still owed by the processor. The ₦49,457,837.54 cushion exists only because ₦50,000,000 of share capital sits in the same account. Without it cash is below wallets on 172 of 179 days, worst ₦1,051,093.67 on 27 May. So: a separate customer pool, and each evening Ugochi’s job checks that its statement balance is at least the wallets’ total. A failure goes to the compliance officer that day and pauses sweeps. The ₦1,654,083.00 owed by the processor is covered from own funds, topped up into the pool, until the cash arrives.
Could be wrong. The limits rest on summaries, and a different figure in the current circular would show it. The lab’s books also cannot see a real pool statement, so the first live day’s test is the real check.
Decision needed. Approve the limit set and the pool by 4 December.
Now you
A month later you are the product manager at Owoleaf at 60 people. Its help centre still shows the invented daily limits, ₦30,000 for tier 1 and ₦200,000 for tier 2. You want to move to the chapter’s stated set, which the compliance officer has agreed to review. Treasury also proposes moving the ₦50,000,000 of share capital out of the bank account that holds wallet cover, to fund a pilot elsewhere. Write the note for both changes. Use step 2’s comparison of failures under the two sets, and step 3’s counts of days when cash falls below wallets with and without the capital. State what a member sees when a limit is hit, how the pool is matched to wallets each day, and what you propose for the processor’s float. The head of compliance reads it to decide whether the new limits go live and whether the capital may leave.
Self-check
A member with a tier 1 wallet at ₦252,010.12 has ₦60,000 sent to her from her cooperative's bank account. The sender's bank has already debited it. The wallet cap is ₦300,000, and ₦60,000 would take her to ₦312,010.12. Saratu wants a rule for every credit that would breach the cap, and Ugochi can build one rule this week. What does the wallet do?
- DOC Regulatory Framework and Guidelines for Mobile Money Services in Nigeria (CBN, July 2021) Central Bank of Nigeria, 2021
The CBN's own text on mobile money operators, pool accounts and settlement banks. Look for its KYC levels table and compare it with the 2017 figures in this chapter, which are not confirmed against it. This chapter's account of it rests on search summaries, so check each figure.
- DOC Guidelines for Licensing and Regulation of Payment Service Banks in Nigeria (CBN, 27 August 2020) Central Bank of Nigeria, 2020
The text on what a payment service bank may hold and where it must put its deposits. Read the permitted and prohibited activities and the paragraph on deposit liabilities. The licence capital sections belong to the licensing module.
- DOC Supervisory Framework for Payment Service Banks (CBN, 2021) Central Bank of Nigeria, 2021
The CBN's supervisory framework for banks that hold small balances. Read the part on tiered KYC for the logic behind lighter requirements at low values. The summaries this chapter saw gave no limits, so check whether it does.
- DOC Customer Due Diligence Regulations 2023 (CBN) Central Bank of Nigeria, 2023
The current customer due diligence rules, which point to the tiered KYC circulars and say tiered KYC covers individuals only. Read the sections on tiered KYC and on due diligence for individuals. KYC itself belongs to the Compliance course, so skip the rest.
- DOC The Electronic Money Regulations 2011, regulation 20: safeguarding requirements UK Parliament (legislation.gov.uk), 2011
The UK's statute on keeping e-money customers' funds apart or insured, used here only as a comparison. Read regulations 20 to 22 as a short, precise example of what safeguarding looks like in law. The text has been amended, so read the current version. It is not Nigerian law.
- DOC Ipagoo in administration: court judgment (published by the UK judiciary) Judiciary of England and Wales
An English court on what happens to customers' e-money when the institution fails. Read it for what a safeguarding shortfall looks like in a real administration and how customers rank. Check which court's judgment this file is. It is an English case on English rules, and it is long, so start with the summary.
All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.