Payment Gateway for Polkadot - Bridging the gap between Polkadot and Fireblocks
CEXs and merchants can't accept Polkadot payments easily - Fireblocks doesn't support Polkadot wallets, and existing solutions lack proper notifications and payment tracking.
Polkablocks is a payment gateway MVP that handles DOT transactions with enterprise-grade email notifications, webhook callbacks, and transaction monitoring.
- NestJS - Backend API framework
- SubQL - Polkadot blockchain indexer
- PostgreSQL - Database for transaction & merchant data
- Nodemailer - Email notifications
- Polkadot.js - Blockchain interaction
- Email Notifications - Instant email alerts for all transactions
- Payment Processing - Generate payment addresses & track payments
- Webhook Callbacks - Notify merchants of payment status
- API Key Authentication - Secure merchant access
- Transaction Monitoring - Real-time status tracking
- Initialize NestJS project with TypeScript
- Set up email service (PRIORITY #1):
- Configure Nodemailer with SMTP
- Create email templates (payment received, payment sent, payment failed)
- Test email sending endpoint
- Set up PostgreSQL with schema:
merchantstable (id, name, email, api_key, webhook_url)payment_requeststable (id, merchant_id, amount, address, status, callback_url)transactionstable (hash, payment_request_id, from, to, amount, status, email_sent)
- Configure SubQL indexer for payment monitoring
- Create merchant registration endpoint with API key generation
- Implement payment request service:
- POST
/api/payments/create- Generate payment address & amount - GET
/api/payments/:id/status- Check payment status - Generate unique payment addresses per request
- POST
- SubQL event handlers:
- Monitor incoming payments to generated addresses
- Trigger email notifications on payment received
- Update payment request status in DB
- Implement webhook service:
- Queue webhook calls on payment confirmation
- Retry logic for failed webhooks
- Log webhook responses
- Email notification triggers:
- Payment received (to merchant)
- Payment confirmed (to customer email if provided)
- Payment failed/expired notifications
- Transaction execution for payouts:
- POST
/api/payouts- Send DOT to addresses - Email confirmation on successful payout
- POST
- Implement payment expiry (15-minute timeout)
- Add idempotency keys to prevent duplicate payments
- Basic webhook signature verification
- Create simple checkout page (HTML + JS):
- Display payment address & QR code
- Show payment status in real-time
- Email receipt option
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Run PostgreSQL
docker-compose up -d postgres
# Run migrations
npm run migration:run
# Start SubQL indexer
cd subql && yarn start
# Start NestJS server
npm run start:dev| Method | Endpoint | Description |
|---|---|---|
| POST | /api/merchants/register |
Register merchant account |
| POST | /api/payments/create |
Create payment request |
| GET | /api/payments/:id/status |
Check payment status |
| POST | /api/payouts |
Execute payout (send DOT) |
| GET | /api/transactions |
List all transactions |
| POST | /api/webhooks/test |
Test webhook delivery |
- Merchant creates payment request with amount
- System generates unique payment address
- Customer sends DOT to address
- SubQL detects payment
- Email sent to merchant & customer
- Webhook triggered to merchant URL
- Payment marked as complete
After hackathon, you'll need:
- KYC/AML integration
- Multi-currency support
- Admin dashboard
- Rate limiting & DDoS protection
- Comprehensive webhook retry strategy
- Payment reconciliation system
- Refund mechanism
- SSL/TLS for webhooks
- Audit logging
- PCI compliance considerations
# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/polkablocks
# Blockchain
POLKADOT_RPC_URL=wss://rpc.polkadot.io
SUBQL_ENDPOINT=http://localhost:3000
# Email (PRIORITY!)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
EMAIL_FROM=payments@polkablocks.io
# Security
JWT_SECRET=your-secret-key
WEBHOOK_SIGNING_SECRET=webhook-secret
# Payment Config
PAYMENT_EXPIRY_MINUTES=15
CONFIRMATION_BLOCKS=2
1. payment_received.html - "Payment of X DOT received"
2. payment_confirmed.html - "Payment confirmed after X blocks"
3. payment_expired.html - "Payment request expired"
4. payout_sent.html - "Payout of X DOT sent to address"
- ✅ Email notifications work for all transactions
- ✅ Can create payment requests with unique addresses
- ✅ Payments are detected and processed automatically
- ✅ Webhooks fire on payment completion
- ✅ Basic checkout page works
- ✅ Can execute payouts with email confirmation
Hackathon Focus: Payment Gateway MVP with Email Notifications
Duration: 3 Hours
Status: 🔴 In Progress