Inspiration
A Senegalese shop owner who wants to buy shea butter or textiles from a supplier in Ghana faces a hard choice: pay everything upfront to someone they have never met, or lose the deal. Suppliers face the mirror problem: shipping goods without any guarantee of payment. Add different currencies, slow cross-border payments and no portable proof that a merchant is reliable, and small traders are left out of regional trade.
We asked: what if two merchants who share no bank, no currency and no jurisdiction could still trade safely, using Bitcoin and ecash?
What it does
AfriTrade is a trust and settlement layer for cross-border African B2B trade, starting with the Dakar ↔ Accra corridor. It has four modules:
- Conditional escrow: the buyer locks funds (in sats) for an order. The order follows a strict state machine: created → accepted → funded/locked → shipped → delivered → released, with dispute and refund paths.
- Reusable digital contracts: templates for goods, agricultural trade and multi-step deliveries, with milestones (e.g. 30% / 70%), a contract hash, and cryptographic signatures by both parties, linked to an order.
- Portable reputation: each merchant gets a
did:keyidentifier and receives Verifiable Credentials after a settled order (fulfillment, prompt settlement, verified transit by the carrier). Credentials can be verified by anyone against the issuer's public key. - Multi-mint interoperability (research demo): a simulator of Mint A ↔ Lightning ↔ Mint B routing, plus a live probe of Cashu test mints.
A carrier role signs timestamped logistics checkpoints (pickup, customs, hub arrival), and an admin role handles disputes with a full audit log.
How we built it
- Frontend: React 19, Vite, Tailwind, React Query.
- Backend: Express + TypeScript, Zod validation, JWT auth with role-based access, SQLite (WAL, foreign keys), idempotency keys on payments, restricted CORS and rate limiting.
- Escrow: Cashu NUT-11 locks with multi-signature spending conditions, a locktime and a buyer refund path, via
@cashu/cashu-ts. Spending conditions are enforced by the mint, not only by our app. - Identity & reputation: real public keys for merchants, Ed25519 signatures on contracts, and Verifiable Credentials verifiable without trusting our server.
- Payments: a
PaymentProviderinterface with a clearly labelled demo mode (simulated balances) and a Cashu mode tested against a Cashu test mint. - Quality: automated end-to-end and security tests with Vitest, strict TypeScript, and a clean production build.
What we learned
- Cashu NUT-11 gives powerful spending conditions (public-key locks, multisig, locktime and refund), but a condition in the app is not the same as a condition enforced by the mint. Designing an escrow means being precise about who can spend, when, and with which keys.
- A mint is still a trusted party. AfriTrade does not remove trust; it reduces it and makes guarantees verifiable.
- Reputation should live outside the platform: credentials must be verifiable by anyone, not just by the app that issued them.
Challenges
- Escrow design: a lock to the seller's key alone lets the seller spend before delivery. We moved to a multi-signature condition with a refund path after locktime, so "release on delivery" is enforced by cryptography, not only by app logic.
- Key management: private keys are never stored in our database; signing happens on the client side.
- Locktime vs. reality: cross-border shipping and customs delays can outlast a locktime, so the contract's locktime now drives the escrow and disputes must be resolvable before expiry.
- Honest scoping: by default the app runs in demo mode with simulated balances, and the multi-mint module is a simulation, not live swaps. A mint remains a trusted party: we reduce trust and make guarantees verifiable, we do not eliminate trust.
What's next
- Real multi-mint swaps over Lightning
- Pilot with traders in Dakar and Bamako
- Fiat on/off-ramps (Orange Money, Wave, MTN MoMo)
- Legal review of contract validity per jurisdiction
Built With
- bcrypt
- better-sqlite3
- bitcoin
- cashu
- did
- ecash
- express.js
- framer-motion
- jwt
- lightning-network
- node.js
- nut-11
- qrcode
- react
- react-router
- sqlite
- tailwindcss
- tanstack-query
- typescript
- verifiable-credentials
- vite
- vitest
- zod