Inspiration
I started with a simple question: “How can we demystify CBDCs by showing how their core pieces actually work?”
Most discussions around digital currency architecture are abstract. I wanted something concrete — wallets, minting, transfers, and a visible audit trail. The idea was not to rebuild a full CBDC but to build a teachable replica that shows the flow end-to-end and demonstrates how a public blockchain can help provide tamper-evident logs.
That led to the Mini-CBDC Stack.
⸻
What it does
The system simulates a minimal CBDC pipeline: • Create wallets with a chosen currency • Mint test digital cash (under admin permissions) • Transfer funds between users • Score each transaction using a simple ML-based risk engine • Anchor every transfer to the Polkadot Westend network as an on-chain audit hash
Every step — from mint to transfer — is logged and visible through FastAPI endpoints.
⸻
How we built it
The architecture intentionally stays small and understandable: • FastAPI for all service endpoints • SQLite for the local ledger (ideal for fast prototyping) • Python ML module for transaction-level risk scoring • Polkadot Ledger wrapper to push audit hashes on-chain • A hybrid model: Local Ledger -> Risk Engine -> Polkadot Audit Anchor
We used a thread-safe blockchain logger running in a background executor so that FastAPI doesn’t block on RPC calls. If the blockchain RPC fails, the system automatically generates a fallback hash — ensuring every transaction gets a verifiable anchor.
⸻
Challenges we ran into • Polkadot RPC variations Some functions documented in examples didn’t behave as expected on Westend, leading to retries and workarounds. • Threading vs. signal handling FastAPI workers don’t allow signal-based timeouts, so the blockchain logger had to be rewritten using ThreadPoolExecutor. • Schema migrations Rebuilding the database multiple times to stabilize the wallet schema and remove conflicts between older versions. • Integrating ML safely Ensuring the risk engine didn’t slow down transfers or introduce unwanted side effects.
Each challenge forced the project to become more resilient and cleaner.
⸻
Accomplishments we’re proud of • A complete mint → transfer → risk-score → audit pipeline • A fully stable blockchain logging mechanism that never blocks the API • Clean APIs for wallets, transactions, and ML summaries • A compact backend that others can easily read, modify, and extend
The final build feels like a credible demonstration of how a small CBDC-style system behaves.
⸻
What we learned • A hybrid architecture works extremely well — fast local settlement with a public audit layer • Polkadot is powerful, but developers must handle RPC inconsistencies gracefully • Simple database schemas beat over-engineered ones, especially in hackathon time • Risk scoring becomes more meaningful when logs are consistent and immutable
At a higher level, I learned how blockchain can complement, not replace, traditional settlement layers.
⸻
What’s next for Mini-CBDC Stack • Build a custom Substrate pallet for structured CBDC audit metadata • Improve the ML scoring using network-graph features • Add real-time monitoring dashboards • Offer this as a small developer sandbox for digital-currency experiments
The project hints at a future where fast centralized systems and transparent decentralized audit layers work together.
Log in or sign up for Devpost to join the conversation.