chore: enhance .gitignore and remove obsolete documentation files - Reorganize .gitignore with categorized sections for better maintainability - Add comprehensive ignore patterns for Python, Node.js, databases, logs, and build artifacts - Add project-specific ignore rules for coordinator, explorer, and deployment files - Remove outdated documentation: BITCOIN-WALLET-SETUP.md, LOCAL_ASSETS_SUMMARY.md, README-CONTAINER-DEPLOYMENT.md, README-DOMAIN-DEPLOYMENT.md ```
3.7 KiB
3.7 KiB
Bitcoin Wallet Integration for AITBC Trade Exchange
Overview
The AITBC Trade Exchange now supports Bitcoin payments for purchasing AITBC tokens. Users can send Bitcoin to a generated address and receive AITBC tokens after confirmation.
Current Implementation
Frontend Features
- Payment Request Generation: Users enter the amount of AITBC they want to buy
- Dynamic QR Code: A QR code is generated with the Bitcoin address and amount
- Payment Monitoring: The system automatically checks for payment confirmation
- Real-time Updates: Users see payment status updates in real-time
Backend Features
- Payment API:
/api/exchange/create-paymentcreates payment requests - Status Tracking:
/api/exchange/payment-status/{id}checks payment status - Exchange Rates:
/api/exchange/ratesprovides current BTC/AITBC rates
Configuration
Bitcoin Settings
BITCOIN_CONFIG = {
'testnet': True, # Using Bitcoin testnet
'main_address': 'tb1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
'exchange_rate': 100000, # 1 BTC = 100,000 AITBC
'min_confirmations': 1,
'payment_timeout': 3600 # 1 hour expiry
}
Environment Variables
BITCOIN_TESTNET=true
BITCOIN_ADDRESS=tb1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh
BITCOIN_PRIVATE_KEY=your_private_key
BLOCKCHAIN_API_KEY=your_blockchain_api_key
WEBHOOK_SECRET=your_webhook_secret
MIN_CONFIRMATIONS=1
BTC_TO_AITBC_RATE=100000
How It Works
-
User Initiates Purchase
- Enters AITBC amount or BTC amount
- System calculates the conversion
- Creates a payment request
-
Payment Address Generated
- Unique payment address (demo: uses fixed address)
- QR code generated with
bitcoin:URI - Payment details displayed
-
Payment Monitoring
- System checks blockchain every 30 seconds
- Updates payment status automatically
- Notifies user when confirmed
-
Token Minting
- Upon confirmation, AITBC tokens are minted
- Tokens credited to user's wallet
- Transaction recorded
Security Considerations
Current (Demo) Implementation
- Uses a fixed Bitcoin testnet address
- No private key integration
- Manual payment confirmation for demo
Production Requirements
- HD wallet for unique address generation
- Blockchain API integration (Blockstream, BlockCypher, etc.)
- Webhook signatures for payment notifications
- Multi-signature wallet support
- Cold storage for funds
API Endpoints
Create Payment Request
POST /api/exchange/create-payment
{
"user_id": "user_wallet_address",
"aitbc_amount": 1000,
"btc_amount": 0.01
}
Check Payment Status
GET /api/exchange/payment-status/{payment_id}
Get Exchange Rates
GET /api/exchange/rates
Testing
Testnet Bitcoin
- Use Bitcoin testnet for testing
- Get testnet Bitcoin from faucets:
Demo Mode
- Currently running in demo mode
- Payments are simulated
- Use admin API to manually confirm payments
Next Steps
-
Production Wallet Integration
- Implement HD wallet (BIP32/BIP44)
- Connect to mainnet/testnet
- Secure private key storage
-
Blockchain API Integration
- Real-time transaction monitoring
- Webhook implementation
- Confirmation tracking
-
Enhanced Security
- Multi-signature support
- Cold storage integration
- Audit logging
-
User Experience
- Payment history
- Refund mechanism
- Email notifications
Support
For issues or questions:
- Check the logs:
journalctl -u aitbc-coordinator -f - API documentation:
https://aitbc.bubuit.net/api/docs - Admin panel:
https://aitbc.bubuit.net/admin/stats