Unified P2P Remittance + Merchant POS on Algorand
StablePay is a dual-mode blockchain payment application built on the Algorand blockchain. The application targets two primary user segments: (1) diaspora workers sending cross-border remittances, and (2) Indian SME merchants accepting stablecoin payments at point-of-sale. Both modes use USDC as the settlement currency and run on Algorand for near-zero fees and 3.6-second finality.
┌─────────────────────────────────────────────────────────────────┐
│ StablePay Architecture │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ React │───▶│ FastAPI │───▶│ Algorand Network │ │
│ │ Frontend │ │ Backend │ │ (algod + indexer) │ │
│ │ (UI) │ │ (API) │ │ Smart Contracts │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ CLI │ │ ML/Fraud │ │ USDC ASA (ASA) │ │
│ │ (Click) │ │ Detection │ │ Escrow Contract │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
| Layer | Technology |
|---|---|
| Blockchain | Algorand TestNet/MainNet |
| Smart Contracts | Algorand Python (AlgoKit 3.0) |
| Backend | Python 3.11+ / FastAPI |
| Frontend | React 18 + TypeScript + Vite |
| Database | SQLite / PostgreSQL |
| Payments | USDC (ASA ID: 10458941 TestNet / 31566704 MainNet) |
- Create/import Algorand wallets with AES-256 encryption
- Fiat on-ramp simulation (INR → USDC via CoinGecko rates)
- Escrow-based transfers with 72-hour claim window
- Recipient confirmation triggers atomic fund release
- Mock UPI off-ramp for INR settlement simulation
- Generate QR codes for USDC payments
- Real-time settlement via Algorand Indexer polling
- GST invoice generation (18% IGST simulation)
- Merchant dashboard with daily settlement summaries
- ML-based fraud detection (Isolation Forest)
- KYC flagging for transfers > 1,000 USDC
- FEMA compliance (250,000 USD limit simulation)
- Smart contract escrow for trustless payments
- Python 3.11+ for backend and CLI
- Node.js 20+ for React frontend
- Docker Desktop for AlgoKit LocalNet
- AlgoKit 3.0+ (
pipx install algokit) - Git for version control
git clone https://github.com/Mosss-OS/stablepay.git
cd stablepaycd frontend
npm install
npm run devcd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cp ../.env.example .env
# Configure your Algorand credentials in .env
uvicorn main:app --reloadalgokit localnet start
algokit localnet status # Confirm runningcd contracts
python deploy.py --network localnet| Command | Description |
|---|---|
stealth wallet create |
Generate new Algorand wallet |
stealth wallet import --mnemonic '...' |
Import wallet via mnemonic |
stealth wallet balance --address ADDR |
Show ALGO + USDC balances |
stealth send --mode p2p --to ADDR --amount 50 |
Initiate P2P transfer |
stealth pos invoice --amount 1200 --currency INR |
Generate QR invoice |
stealth pos confirm --invoice-id ID |
Poll indexer for payment |
stealth tx history --address ADDR --days 7 |
Transaction history |
stealth contracts deploy --network testnet |
Deploy smart contracts |
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /wallets/create |
Create new wallet | - |
| POST | /wallets/import |
Import wallet | - |
| GET | /wallets/{address}/balance |
Get USDC balance | - |
| POST | /transfers/initiate |
Create escrow transfer | JWT |
| POST | /transfers/{id}/release |
Release escrowed funds | JWT |
| POST | /transfers/{id}/reclaim |
Reclaim expired escrow | JWT |
| GET | /transfers/{id}/status |
Get transfer status | JWT |
| POST | /invoices/create |
Generate QR invoice | JWT |
| GET | /invoices/{id}/poll |
Poll for payment | JWT |
| GET | /invoices/{id}/receipt |
Get GST receipt | JWT |
| GET | /fraud/check |
ML fraud risk score | JWT |
| POST | /fraud/retrain |
Retrain ML model | Admin |
| GET | /rates/usdc-inr |
Current exchange rate | - |
| GET | /analytics/volume |
7-day transaction volume | JWT |
| Contract | App ID | Explorer |
|---|---|---|
| EscrowContract | TBD | Lora |
stealth/
├── contracts/ # Algorand Python smart contracts
│ ├── escrow.py # EscrowContract (ARC-4)
│ ├── payment_sig.py # PaymentSig (stateless)
│ ├── deploy.py # Deployment script
│ └── tests/ # Contract tests
├── backend/ # FastAPI backend
│ ├── main.py # App entry point
│ ├── routers/ # API endpoints
│ ├── services/ # Business logic
│ ├── cli.py # Click CLI
│ └── tests/ # Backend tests
├── frontend/ # React + TypeScript
│ ├── src/
│ │ ├── pages/ # Route pages
│ │ ├── components/ # UI components
│ │ └── hooks/ # Custom React hooks
│ └── package.json
├── docker-compose.yml # Full stack deployment
├── .env.example # Environment template
└── README.md
- Frontend UI scaffolding (React + TypeScript + Tailwind)
- Mode switcher (P2P / POS)
- Wallet creation/import UI
- P2P transfer flow UI
- POS terminal UI with QR generation
- Transaction history view
- Merchant dashboard
- Fraud review page
- Analytics dashboard
- GST invoice component
- Compliance indicators (KYC, FEMA)
- Backend API (FastAPI)
- Algorand smart contracts
- Algorand indexer integration
- Real wallet operations
- CLI implementation
- EscrowContract deployment
- Atomic group transactions
- Real-time indexer polling
- ML fraud detection model
- CoinGecko rate integration
- UPI off-ramp simulation
- Integration tests
- TestNet deployment
Coming soon - 5-minute Loom demo of P2P + POS flows
MIT License - see LICENSE file for details.
Built for AlgoBharat Hack Series 3.0
Track: Future of Finance — Stablecoin Payments
Prize Pool: USD 30,000 + Acceleration Support
For questions on Algorand development: developer.algorand.org
AlgoBharat Discord: discord.com/invite/xnrb3yne8