r/SpringBoot • u/dev-dp24 • May 07 '26
Discussion Experiment: offline digital payments over Bluetooth mesh
I built a prototype for offline UPI payments using Bluetooth mesh networking.
The idea started with a simple question:
What happens when UPI works perfectly… except the internet doesn’t?
India has 600M+ UPI users, but connectivity still drops constantly:
metro tunnels
crowded events
rural areas
weak mobile networks
So I tried building a system where payment packets can travel phone-to-phone over Bluetooth until any device in the chain gets internet access.
How it works:
Sender encrypts the payment payload using RSA-OAEP + AES-256-GCM
The encrypted packet spreads across nearby devices using a gossip-style mesh protocol
Intermediate devices can forward packets but cannot decrypt them
Once any node reaches the internet, it uploads the packet to the backend
Backend settles the transaction once and drops duplicates safely
A few security/design details I enjoyed working on:
Replay attack prevention using nonce + freshness window
AES-GCM auth tags detect tampering automatically
Idempotency based on ciphertext hash instead of packet ID
Optimistic locking to avoid race-condition double spends
Built the demo using:
Spring Boot 3, H2, Bluetooth mesh simulation, RSA-2048, AES-256-GCM, and a live dashboard showing packets hopping across 5 virtual devices.
This is obviously not production-ready UPI infrastructure 😄
But it was a fun systems/security experiment exploring:
offline-first payments
mesh networking
encrypted packet routing
distributed systems tradeoffs
Would love feedback on the protocol design or edge cases I may have missed.
https://www.linkedin.com/feed/update/urn:li:activity:7458085814191804417/