Inspiration & Problem Statement
Sending money between the diaspora (EUR/USD) and West Africa (XOF BCEAO in Senegal & Côte d'Ivoire, NGN in Nigeria, GHS in Ghana) still costs 7.8%–9.5% in fees and takes 2–5 business days via legacy remittance operators. Meanwhile, West African developers building solar mini-grids, local AI APIs, and cross-border B2B settlements lack accountless Lightning HTTP 402 (L402) micro-payment gateways, and millions of feature-phone users need offline-resilient USSD/SMS voucher settlement when mobile internet drops.
Technical Architecture (src/satsflow_engine.py)
- Cryptographic BOLT-11 Invoice Parser & Encoder (BIP-173 Bech32): Full 6-word polymod checksum verification, HRP multiplier decoding (
m,u,n,p), 256-bit tagged payment hash (p), description (d), expiry (x), and atomic HTLC preimage verification ($\text{SHA256}(\text{preimage}) == \text{payment_hash}$). - L402 (
LSAT) Chained HMAC-SHA256 Macaroon + Preimage API Paywall: IssuesHTTP 402 Payment Requiredheaders (WWW-Authenticate: L402 macaroon="...", invoice="lnbc...") and verifies chained caveats + HTLC preimages in sub-millisecond time. - Multi-Hop Dijkstra & Multi-Path Payment (MPP) Channel Liquidity Optimizer: Finds minimum-fee paths across European and West African LSPs (
Paris-Eclair-LSP,Frankfurt-ACINQ,Abidjan-UEMOA-Gate,Dakar-BTrust-Hub,Lagos-BitNob-Core,Accra-Sats-Bridge) and automatically splits large transfers into concurrent edge-disjoint Multi-Path Payment (MPP) shards when single-channel capacity is exceeded. - Offline USSD (
*789#) & RFC 9285 Base45 SMS Voucher Studio: Generates compact HMAC-SHA256 signed Base45 SMS tokens (SATS1:...) and USSD dial strings (*789*1*SATS*PIN#) for feature-phone users across Senegal, Nigeria, and Ghana.
How We Built It & Verification
- Zero-Dependency Python Core Engine (
src/satsflow_engine.py): Pure Python 3 implementation of BIP-173 Bech32 BOLT-11 encoding/decoding, chained HMAC-SHA256 L402 macaroons, Dijkstra + Multi-Path Payment (MPP) channel splitting, and RFC 9285 Base45 offline USSD vouchers, verified by unit tests (tests/test_satsflow.py). - Interactive Browser Command Deck (
index.html,app.js): Live interactive West Africa Remittance Corridor Comparator (EUR->XOF,USD->NGN,GBP->GHS), L402 Macaroon & BOLT-11 Sandbox, Multi-Path Payment (MPP) Route Graph Visualizer, and Offline USSD*789#Feature-Phone Emulator.
Built With
- bitcoin
- bolt11
- github
- javascript
- l402
- lightning-network
- python
- remittances
- ussd
- west-africa