# BUSINESS PLAN: SELF-HOSTED NON-CUSTODIAL CRYPTO PAYMENT GATEWAY ## 1. PROJECT OVERVIEW A lightweight, open-source-inspired, non-custodial crypto payment gateway clone of Aurpay. It derives sequential merchant addresses via extended public keys, processes checkouts on a low-cost server, and takes a 0.8% transaction fee split on-the-fly directly at the blockchain level. --- ## 2. INFRASTRUCTURE & MONTHLY BUDGET * Server Hosting: $8.00 / month (1-2 GB RAM, 1 vCPU Virtual Private Server via DigitalOcean, Vultr, or Hetzner). * Blockchain Data (RPC/APIs): $0.00 (Using free tiers from Infura, Alchemy, or BlastAPI). * SSL Encryption: $0.00 (Free via Let's Encrypt / Certbot). * Domain Name: ~$1.00 / month ($12/year renewal). * TOTAL RUNNING COST: ~$9.00 / Month --- ## 3. CORE ARCHITECTURE & CODE LOGIC ### A. Non-Custodial Address Generation (BIP32 / BIP44) 1. Merchant inputs their Extended Public Key (xpub for Bitcoin, or Account Extended Public Key for EVM chains) into your dashboard during setup. 2. The database assigns an `address_index` starting at `0` for that merchant. 3. Upon checkout, your backend runs a derivation function to generate a fresh public address: `Address = DerivationFunction(xpub, address_index)` 4. The database counter increments by 1 (`index++`) for the next invoice. 5. Absolute Security: Your server never holds private keys. If the server is hacked, zero funds can be stolen. ### B. Lightweight Tech Stack * Backend: Node.js, Python (FastAPI), or Go. * Database: SQLite or PostgreSQL (keeps RAM utilization below 200MB). * Data Fetching: Queries external public APIs to monitor addresses rather than running hardware-heavy full nodes. --- ## 4. REVENUE MODEL (THE 0.8% FEE SPLIT) To replicate Aurpay without requiring merchants to deposit pre-paid gas balances, the 0.8% processing fee is split directly at the point of transaction authorization. ### Implementation Methods: * UTXO Chains (Bitcoin): Code your payment URI/QR code generation to use BIP21 multi-output formats. A single user payment natively broadcasts two outputs simultaneously: * Output 1: 99.2% of the payment goes straight to the merchant's derived address. * Output 2: 0.8% of the payment goes straight to your gateway wallet address. * Smart Contract Chains (Solana, Arbitrum, Tron): Your frontend Web3 checkout wrapper triggers an atomic split instruction inside the token contract execution: `USDT.transfer(merchantAddress, ninety_nine_point_two_percent);` `USDT.transfer(myGatewayWalletAddress, zero_point_eight_percent);` --- ## 5. ARCHITECTURAL RISKS & MITIGATIONS * High Gas Fee Chains: Splitting small transactions on mainnet Ethereum (ERC-20) can burn more in network gas fees than the 0.8% fee is actually worth. * Mitigation Strategy: Code your gateway to exclusively enforce or incentivize low-fee rails: Bitcoin Lightning Network, Solana, Tron (TRC-20), and Ethereum Layer 2s (Arbitrum, Optimism). Waive or put a minimum threshold cap on high-fee layer-1 transfers.