Cryptocurrency Payment System Integration Specification
To enhance payment flexibility and global user accessibility, we plan to integrate native cryptocurrency payment functionality into our website. The system must support asset reception and transaction monitoring across major blockchain networks, with direct connections to each chain’s native RPC nodes (not third-party aggregators), ensuring security, control, and alignment with decentralized principles.
Target Blockchain Networks
The following blockchains and their respective native assets and token standards must be supported:
- Bitcoin (BTC): Native Bitcoin transfers
- Ethereum (ERC-20): Support for USDT, USDC, and other ERC-20 tokens
- BNB Smart Chain (BEP-20): Support for BUSD, USDT-BSC, and other BEP-20 tokens
- TRON (TRC-20): Support for USDT-TRC20 and other TRC-20 tokens
- Solana (SPL): Support for USDC, USDT, and other SPL-standard tokens
- TON (The Open Network): Support for TON native coins and Jetton standard tokens
Core Functional Requirements
1. Wallet Address Generation & Management
- Dynamically generate unique cryptocurrency deposit addresses for each user (isolated wallets or derived addresses)
- Unified multi-chain address management system
2. Real-Time Transaction Monitoring & Confirmation
- Poll or subscribe to block data via native RPC endpoints for each chain
- Detect incoming transactions (both native coin and token transfers)
- Validate transaction legitimacy (e.g., confirmation count, amount, recipient address)
3. Automated Fund Aggregation (Cold Wallet Sweeping)
- Automatically sweep funds to a main/cold wallet when a user’s balance exceeds a predefined threshold
- Handle gas/energy fees during sweeping (with auto-top-up if necessary)
- Support fee management across chains (e.g., energy/bandwidth on BSC/Tron)
4. Withdrawal Functionality
- Enable withdrawals from the main wallet to external addresses for both native coins and tokens
- Provide transaction status tracking and database logging
5. Security & Risk Control
- Private keys must be stored offline; never exposed in application code or environment variables
- Use MPC wallets, HSMs, or hardware signing devices for critical operations
- Implement approval workflows for large withdrawals
6. Data Synchronization & Reconciliation
- Persist on-chain transaction records in the local database
- Provide APIs for transaction status queries
- Support fiat value conversion using exchange rate APIs
7. High Availability Architecture
- Integrate message queues (e.g., Redis + BullMQ) for asynchronous processing and retry mechanisms
Technical Implementation Requirements
- Connect directly to **public or self-hosted full-node RPCs** for each chain. Avoid reliance on third-party gateways (e.g., Alchemy, Infura, TronGrid) to ensure operational autonomy.
- Use officially recommended SDKs per chain:
- Bitcoin**: `bitcoinjs-lib` + self-hosted `bitcoind` node
- Ethereum/BSC: `ethers.js` or `web3.js`
- Tron: `tronweb`
- Solana: `@ solana/web3.js`
- TON: `ton`, `ton-core`
Future Extensibility
- Design a modular architecture to easily add new blockchains (e.g., Polygon, Avalanche)
- Provide internal admin APIs for manual sweeping, balance checks, withdrawal approvals, etc.
This system will serve as a core component of our financial infrastructure and must meet high standards of **security, reliability, and observability** to ensure user asset safety and business continuity.