Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 3s
CLI Tests / test-cli (push) Failing after 3s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Successful in 2s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 3s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Successful in 2s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Deploy to Testnet / deploy-testnet (push) Successful in 1m12s
Documentation Validation / validate-docs (push) Failing after 8s
Documentation Validation / validate-policies-strict (push) Successful in 3s
Integration Tests / test-service-integration (push) Successful in 2m6s
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Successful in 2s
Multi-Node Blockchain Health Monitoring / health-check (push) Failing after 4s
P2P Network Verification / p2p-verification (push) Successful in 4s
Package Tests / Python package - aitbc-agent-sdk (push) Successful in 32s
Package Tests / Python package - aitbc-core (push) Successful in 14s
Package Tests / Python package - aitbc-crypto (push) Successful in 12s
Package Tests / Python package - aitbc-sdk (push) Successful in 9s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 8s
Package Tests / JavaScript package - aitbc-token (push) Successful in 17s
Python Tests / test-python (push) Successful in 15s
Security Scanning / security-scan (push) Successful in 27s
Node Failover Simulation / failover-test (push) Successful in 7s
Multi-Node Stress Testing / stress-test (push) Successful in 6s
Cross-Node Transaction Testing / transaction-test (push) Successful in 4s
- Add SQLCipher encryption for ait-mainnet database with configurable flag - Add db_encryption_enabled and db_encryption_key_path config settings - Implement encryption key loading and PRAGMA key setup via connection events - Add shutdown_db function for proper database cleanup - Export middleware classes in aitbc/__init__.py - Fix import path in sync.py for settings - Remove duplicate agent documentation from docs
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