Generated: 2026-04-22 17:14:45+02:00 Environment: Mainnet (Bitcoin, Litecoin, Solana) Status: Ready for deployment
This document outlines the deployment process for the Crypto Processing Services on mainnet with real funds. The system includes RPC caching to respect free tier rate limits (5 req/min).
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Frontend │ │ API │ │ Backend │
│ (VueJS) │◄───►│ (Go) │◄───►│ (Go) │
└─────────────┘ └─────────────┘ └─────────────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ PostgreSQL │ │ Blockchains │
└─────────────┘ │ (BTC,LTC,SOL)
└─────────────┘
│
┌─────────────┐
│ RPC Cache │
│ (15s gap) │
└─────────────┘
- VPS with Docker and Docker Compose installed
- PostgreSQL 14+ (or use managed service)
- Domain name with DNS configured
- Cloudflare account (for tunnel)
- BTC wallet with mnemonic seed (for payment address derivation)
- LTC wallet with mnemonic seed (for payment address derivation)
- SOL wallet with mnemonic seed (for payment address derivation)
- Each wallet should have limited funds (hot wallet principle)
- Tatum.io free tier accounts (or preferred RPC providers)
- RPC endpoints configured for mainnet
# Database
DATABASE_URL=postgresql://user:password@host:5432/crypto_services
# Bitcoin (BTC)
BTC_RPC_URL=https://bitcoin-mainnet.gateway.tatum.io
BTC_RPC_USER=
BTC_RPC_PASS=
BTC_WALLET_ADDRESS=bc1q... # Mainnet address for wallet
# Litecoin (LTC)
LTC_RPC_URL=https://litecoin-mainnet.gateway.tatum.io
LTC_RPC_USER=
LTC_RPC_PASS=
LTC_WALLET_ADDRESS=ltc1q... # Mainnet address for wallet
# Solana (SOL)
SOL_RPC_URL=https://solana-mainnet.gateway.tatum.io
SOL_WALLET_ADDRESS=SolanaAddress # Base58 encoded address
# Fiat API (for conversions)
FIAT_API_URL=https://api.coingecko.com/api/v3
# Logging
LOG_LEVEL=INFO# Rate Limiting (defaults shown)
API_RATE_LIMIT=100 # requests per minute per IP
API_RATE_WINDOW=60 # window in seconds
# RPC Cache (defaults shown)
RPC_MIN_GAP=15 # seconds between RPC calls
TX_CACHE_TTL=60 # transaction cache TTL
CONF_CACHE_TTL=30 # confirmation cache TTL- All environment variables stored securely (not in git)
-
wallets.keysfile encrypted at rest - Database password strong and unique
- Cloudflare tunnel properly secured
- No exposed API keys in code
- RPC endpoints tested and responsive
- Database migrations ready
- Wallets funded with small test amounts
- Callback URLs accessible (for testing)
- Logging configured (JSON structured)
- Log rotation configured
- Disk space monitoring enabled
# SSH to your VPS
ssh user@your-server
# Install Docker if not present
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Install Docker Compose
sudo apt-get install docker-compose
# Create application directory
mkdir -p /opt/crypto-services
cd /opt/crypto-services# Create .env file
cat > .env << 'EOF'
DATABASE_URL=postgresql://crypto_user:secure_password@db:5432/crypto_services
BTC_RPC_URL=https://bitcoin-mainnet.gateway.tatum.io
BTC_RPC_USER=
BTC_RPC_PASS=
BTC_WALLET_ADDRESS=bc1q...your-btc-address
LTC_RPC_URL=https://litecoin-mainnet.gateway.tatum.io
LTC_RPC_USER=
LTC_RPC_PASS=
LTC_WALLET_ADDRESS=ltc1q...your-ltc-address
SOL_RPC_URL=https://solana-mainnet.gateway.tatum.io
SOL_WALLET_ADDRESS=your-sol-address
FIAT_API_URL=https://api.coingecko.com/api/v3
LOG_LEVEL=INFO
EOF
# Secure the file
chmod 600 .env# Create wallets.keys (encrypted mnemonic storage)
cat > wallets.keys << 'EOF'
btc_mnemonic=your-24-word-btc-mnemonic
ltc_mnemonic=your-24-word-ltc-mnemonic
sol_mnemonic=your-24-word-sol-mnemonic
EOF
# Encrypt if needed (optional but recommended)
# gpg --symmetric wallets.keys
chmod 600 wallets.keys# Create PostgreSQL container
cat > docker-compose.yml << 'EOF'
version: '3.8'
services:
api:
build: ./api
ports:
- "8080:8080"
env_file:
- .env
depends_on:
- db
restart: unless-stopped
backend:
build: ./backend
env_file:
- .env
depends_on:
- db
restart: unless-stopped
frontend:
build: ./frontend
ports:
- "3000:80"
depends_on:
- api
restart: unless-stopped
db:
image: postgres:14-alpine
environment:
POSTGRES_USER: crypto_user
POSTGRES_PASSWORD: secure_password
POSTGRES_DB: crypto_services
volumes:
- pgdata:/var/lib/postgresql/data
restart: unless-stopped
volumes:
pgdata:
EOF# Create cmd/api/main.go and cmd/backend/main.go environment loading
# Ensure they read from .env file# Build images
docker-compose build
# Run database migrations
docker-compose run --rm api ./migrate
# Start services
docker-compose up -d
# Check status
docker-compose ps
# View logs
docker-compose logs -f api
docker-compose logs -f backend# Install cloudflared
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o cloudflared
chmod +x cloudflared
# Create tunnel
./cloudflared tunnel create crypto-services
# Configure tunnel
./cloudflared tunnel run --name crypto-services --url http://localhost:8080
# Or use docker network mode
docker run cloudflare/cloudflared tunnel run --name crypto-services crypto-servicesRequest → Cache Check → [Gap < 15s?]
│
├─ Yes (gap not elapsed) → Return error "rate limit: must wait X seconds"
│
└─ No (gap elapsed) → Fetch from RPC → Store in cache → Return result
| Operation | Cache Key | TTL | Gap |
|---|---|---|---|
| GetTransactions | txs_{address} |
60s | 15s |
| GetConfirmations | conf_{txHash} |
30s | 15s |
| SendTransaction | Invalidates txs_{sender} |
- | - |
# Check cache stats via logs
docker-compose logs backend | grep "cache"
# Expected output
{"level":"info","msg":"Cache stats","total_entries":10,"active_entries":8,"min_gap_seconds":15}# Test database connection
docker-compose exec api curl http://localhost:8080/health
# Test API ticker endpoint
curl http://localhost:8080/tickers
# Test conversion
curl "http://localhost:8080/tickers/btc/convert-to/eur/0.001"# Generate a payment address for BTC
curl -X POST http://localhost:8080/tickers/btc/generate-payment-address \
-H "Content-Type: application/json" \
-d '{
"outputs": [
{"address": "your-output-address", "percentage": 100}
],
"callback_url": "https://your-callback.com/callback"
}'
# Send small amount (0.0001 BTC) to generated address
# Monitor forwarding
curl "http://localhost:8080/tickers/btc/payment-address/{address}?payment_uid={uid}"
# Verify:
# - Callback received
# - 4 confirmations observed
# - Funds forwarded to output address# Test all three chains
# 1. BTC: Send 0.001 BTC, verify forwarding
# 2. LTC: Send 0.01 LTC, verify forwarding
# 3. SOL: Send 0.1 SOL, verify forwarding
# Monitor logs for any errors
docker-compose logs -f | grep -E "(error|warning|failed)"┌─────────────────────────────────────────────────────────┐
│ FUNDS ALLOCATION │
├─────────────────────────────────────────────────────────┤
│ │
│ Cold Storage (80%) ──► Hardware wallet, offline │
│ │ │
│ ▼ │
│ Exchange/Wallet (15%) ──► Refill hot wallet │
│ │ │
│ ▼ │
│ Hot Wallet (5%) ──► VPS deployment, operational │
│ Only this amount at risk │
│ │
└─────────────────────────────────────────────────────────┘
| Chain | Hot Wallet Limit | Recommended Balance |
|---|---|---|
| BTC | 0.01 BTC | $500-1000 USD |
| LTC | 0.5 LTC | $50-100 USD |
| SOL | 5 SOL | $500-1000 USD |
Set up alerts for:
- Wallet balance < threshold
- Unusual transaction patterns
- Failed RPC calls (rate limiting)
- High error rate in logs
- All services running
- Health checks passing
- RPC connections stable
- Cache working (monitor logs)
- Callback URLs responsive
- Small test transactions successful
- Monitoring/alerting configured
- Log rotation working
- Backup strategy in place
- Free tier RPC: Limited to 5 req/min, cache helps but may still hit limits
- Solana mainnet: Requires SOL for transaction fees
- Bitcoin/Litecoin: Higher fees during network congestion
- Confirmation times: BTC ~10 min, LTC ~5 min, SOL ~1 sec
- Cache hit rate: Expected 70-80% for active payment addresses
| Version | Date | Changes |
|---|---|---|
| 1.0 | 2026-04-22 | Initial deployment plan with RPC cache |