chore: remove obsolete files and add Solidity build artifacts to .gitignore

- Add ignore patterns for Solidity build artifacts (typechain-types, artifacts, cache)
- Remove unused exchange mock API server (api/exchange_mock_api.py)
- Remove obsolete client-web README placeholder
- Remove deprecated marketplace-ui HTML implementation
```
This commit is contained in:
oib
2026-01-24 15:46:23 +01:00
parent 9b9c5beb23
commit 55ced77928
195 changed files with 951 additions and 30090 deletions

View File

@@ -0,0 +1,141 @@
# 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-payment` creates payment requests
- **Status Tracking**: `/api/exchange/payment-status/{id}` checks payment status
- **Exchange Rates**: `/api/exchange/rates` provides current BTC/AITBC rates
## Configuration
### Bitcoin Settings
```python
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
```bash
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
1. **User Initiates Purchase**
- Enters AITBC amount or BTC amount
- System calculates the conversion
- Creates a payment request
2. **Payment Address Generated**
- Unique payment address (demo: uses fixed address)
- QR code generated with `bitcoin:` URI
- Payment details displayed
3. **Payment Monitoring**
- System checks blockchain every 30 seconds
- Updates payment status automatically
- Notifies user when confirmed
4. **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
```http
POST /api/exchange/create-payment
{
"user_id": "user_wallet_address",
"aitbc_amount": 1000,
"btc_amount": 0.01
}
```
### Check Payment Status
```http
GET /api/exchange/payment-status/{payment_id}
```
### Get Exchange Rates
```http
GET /api/exchange/rates
```
## Testing
### Testnet Bitcoin
- Use Bitcoin testnet for testing
- Get testnet Bitcoin from faucets:
- https://testnet-faucet.mempool.co/
- https://coinfaucet.eu/en/btc-testnet/
### Demo Mode
- Currently running in demo mode
- Payments are simulated
- Use admin API to manually confirm payments
## Next Steps
1. **Production Wallet Integration**
- Implement HD wallet (BIP32/BIP44)
- Connect to mainnet/testnet
- Secure private key storage
2. **Blockchain API Integration**
- Real-time transaction monitoring
- Webhook implementation
- Confirmation tracking
3. **Enhanced Security**
- Multi-signature support
- Cold storage integration
- Audit logging
4. **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`

View File

@@ -0,0 +1,62 @@
# Local Assets Implementation Summary
## ✅ Completed Tasks
### 1. Downloaded All External Assets
- **Tailwind CSS**: `/assets/js/tailwind.js`
- **Axios**: `/assets/js/axios.min.js`
- **Lucide Icons**: `/assets/js/lucide.js`
- **Font Awesome**: `/assets/js/fontawesome.js`
- **Custom CSS**: `/assets/css/tailwind.css`
### 2. Updated All Pages
- **Main Website** (`/var/www/html/index.html`)
- Removed: `https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css`
- Added: `/assets/css/tailwind.css` and `/assets/js/fontawesome.js`
- **Exchange Page** (`/root/aitbc/apps/trade-exchange/index.html`)
- Removed: `https://cdn.tailwindcss.com`
- Removed: `https://unpkg.com/axios/dist/axios.min.js`
- Removed: `https://unpkg.com/lucide@latest`
- Added: `/assets/js/tailwind.js`, `/assets/js/axios.min.js`, `/assets/js/lucide.js`
- **Marketplace Page** (`/root/aitbc/apps/marketplace-ui/index.html`)
- Removed: `https://cdn.tailwindcss.com`
- Removed: `https://unpkg.com/axios/dist/axios.min.js`
- Removed: `https://unpkg.com/lucide@latest`
- Added: `/assets/js/tailwind.js`, `/assets/js/axios.min.js`, `/assets/js/lucide.js`
### 3. Nginx Configuration
- Added location block for `/assets/` with:
- 1-year cache expiration
- Gzip compression
- Security headers
- Updated Referrer-Policy to `strict-origin-when-cross-origin`
### 4. Asset Locations
- Primary: `/var/www/aitbc.bubuit.net/assets/`
- Backup: `/var/www/html/assets/`
## 🎯 Benefits Achieved
1. **No External Dependencies** - All assets served locally
2. **Faster Loading** - No DNS lookups for external CDNs
3. **Better Security** - No external network requests
4. **Offline Capability** - Site works without internet connection
5. **No Console Warnings** - All CDN warnings eliminated
6. **GDPR Compliant** - No external third-party requests
## 📊 Verification
All pages now load without any external requests:
- ✅ Main site: https://aitbc.bubuit.net/
- ✅ Exchange: https://aitbc.bubuit.net/Exchange
- ✅ Marketplace: https://aitbc.bubuit.net/Marketplace
## 🚀 Production Ready
The implementation is now production-ready with:
- Local asset serving
- Proper caching headers
- Optimized gzip compression
- Security headers configured

View File

@@ -0,0 +1,153 @@
# AITBC Trade Exchange - User Interface Guide
## Overview
The AITBC Trade Exchange features a modern, intuitive interface with user authentication, wallet management, and trading capabilities.
## Navigation
### Main Menu
Located in the top header, you'll find:
- **Trade**: Buy and sell AITBC tokens
- **Marketplace**: Browse GPU computing offers
- **Wallet**: View your profile and wallet information
### User Status
- **Not Connected**: Shows "Connect Wallet" button
- **Connected**: Shows your username with profile and logout icons
## Getting Started
### 1. Connect Your Wallet
1. Click the "Connect Wallet" button in the navigation bar
2. A demo wallet will be automatically created for you
3. Your user profile will be displayed with:
- Unique username (format: `user_[random]`)
- User ID (UUID)
- Member since date
### 2. View Your Profile
Click on "Wallet" in the navigation to see:
- **User Profile Card**: Your account information
- **AITBC Wallet**: Your wallet address and balance
- **Transaction History**: Your trading activity
## Trading AITBC
### Buy AITBC with Bitcoin
1. Navigate to the **Trade** section
2. Enter the amount of AITBC you want to buy
3. The system calculates the equivalent Bitcoin amount
4. Click "Create Payment Request"
5. A QR code and payment address will be displayed
6. Send Bitcoin to the provided address
7. Wait for confirmation (1 confirmation needed)
8. AITBC tokens will be credited to your wallet
### Exchange Rates
- **Current Rate**: 1 BTC = 100,000 AITBC
- **Fee**: 0.5% transaction fee
- **Updates**: Prices refresh every 30 seconds
## Wallet Features
### User Profile
- **Username**: Auto-generated unique identifier
- **User ID**: Your unique UUID in the system
- **Member Since**: When you joined the platform
- **Logout**: Securely disconnect from the exchange
### AITBC Wallet
- **Address**: Your unique AITBC wallet address
- **Balance**: Current AITBC token balance
- **USD Value**: Approximate value in USD
### Transaction History
- **Date/Time**: When transactions occurred
- **Type**: Buy, sell, deposit, withdrawal
- **Amount**: Quantity of AITBC tokens
- **Status**: Pending, completed, or failed
## Security Features
### Session Management
- **Token-based Authentication**: Secure session tokens
- **24-hour Expiry**: Automatic session timeout
- **Logout**: Manual session termination
### Privacy
- **Individual Accounts**: Each user has isolated data
- **Secure API**: All requests require authentication
- **No Passwords**: Wallet-based authentication
## Tips for Users
### First Time
1. Click "Connect Wallet" to create your account
2. Your wallet and profile are created automatically
3. No registration or password needed
### Trading
1. Always check the current exchange rate
2. Bitcoin payments require 1 confirmation
3. AITBC tokens are credited automatically
### Security
1. Logout when done trading
2. Your session expires after 24 hours
3. Each wallet connection creates a new session
## Demo Features
### Test Mode
- **Testnet Bitcoin**: Uses Bitcoin testnet for safe testing
- **Demo Wallets**: Auto-generated wallet addresses
- **Simulated Trading**: No real money required
### Getting Testnet Bitcoin
1. Visit a testnet faucet (e.g., https://testnet-faucet.mempool.co/)
2. Enter your testnet address
3. Receive free testnet Bitcoin for testing
## Troubleshooting
### Connection Issues
- Refresh the page and try connecting again
- Check your internet connection
- Ensure JavaScript is enabled
### Balance Not Showing
- Try refreshing the page
- Check if you're logged in
- Contact support if issues persist
### Payment Problems
- Ensure you send the exact amount
- Wait for at least 1 confirmation
- Check the transaction status on the blockchain
## Support
For help or questions:
- **API Docs**: https://aitbc.bubuit.net/api/docs
- **Admin Panel**: https://aitbc.bubuit.net/admin/stats
- **Platform**: https://aitbc.bubuit.net/Exchange
## Keyboard Shortcuts
- **Ctrl+K**: Quick navigation (coming soon)
- **Esc**: Close modals
- **Enter**: Confirm actions
## Browser Compatibility
Works best with modern browsers:
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
## Mobile Support
- Responsive design for tablets and phones
- Touch-friendly interface
- Mobile wallet support (coming soon)

View File

@@ -0,0 +1,210 @@
# User Management System for AITBC Trade Exchange
## Overview
The AITBC Trade Exchange now includes a complete user management system that allows individual users to have their own wallets, balances, and transaction history. Each user is identified by their wallet address and has a unique session for secure operations.
## Features Implemented
### 1. User Registration & Login
- **Wallet-based Authentication**: Users connect with their wallet address
- **Auto-registration**: New wallets automatically create a user account
- **Session Management**: Secure token-based sessions (24-hour expiry)
- **User Profiles**: Each user has a unique ID, email, and username
### 2. Wallet Management
- **Individual Wallets**: Each user gets their own AITBC wallet
- **Balance Tracking**: Real-time balance updates
- **Address Generation**: Unique wallet addresses for each user
### 3. Transaction History
- **Personal Transactions**: Each user sees only their own transactions
- **Transaction Types**: Buy, sell, deposit, withdrawal tracking
- **Status Updates**: Real-time transaction status
## API Endpoints
### User Authentication
```http
POST /api/users/login
{
"wallet_address": "aitbc1abc123..."
}
```
Response:
```json
{
"user_id": "uuid",
"email": "wallet@aitbc.local",
"username": "user_abc123",
"created_at": "2025-12-28T...",
"session_token": "sha256_token"
}
```
### User Profile
```http
GET /api/users/me
Headers: X-Session-Token: <token>
```
### User Balance
```http
GET /api/users/{user_id}/balance
Headers: X-Session-Token: <token>
```
Response:
```json
{
"user_id": "uuid",
"address": "aitbc_uuid123",
"balance": 1000.0,
"updated_at": "2025-12-28T..."
}
```
### Transaction History
```http
GET /api/users/{user_id}/transactions
Headers: X-Session-Token: <token>
```
### Logout
```http
POST /api/users/logout
Headers: X-Session-Token: <token>
```
## Frontend Implementation
### 1. Connect Wallet Flow
1. User clicks "Connect Wallet"
2. Generates a demo wallet address
3. Calls `/api/users/login` with wallet address
4. Receives session token and user data
5. Updates UI with user info
### 2. UI Components
- **Wallet Section**: Shows address, username, balance
- **Connect Button**: Visible when not logged in
- **Logout Button**: Clears session and resets UI
- **Balance Display**: Real-time AITBC balance
### 3. Session Management
- Session token stored in JavaScript variable
- Token sent with all API requests
- Automatic logout on token expiry
- Manual logout option
## Database Schema
### Users Table
- `id`: UUID (Primary Key)
- `email`: Unique string
- `username`: Unique string
- `status`: active/inactive/suspended
- `created_at`: Timestamp
- `last_login`: Timestamp
### Wallets Table
- `id`: Integer (Primary Key)
- `user_id`: UUID (Foreign Key)
- `address`: Unique string
- `balance`: Float
- `created_at`: Timestamp
- `updated_at`: Timestamp
### Transactions Table
- `id`: UUID (Primary Key)
- `user_id`: UUID (Foreign Key)
- `wallet_id`: Integer (Foreign Key)
- `type`: deposit/withdrawal/purchase/etc.
- `status`: pending/completed/failed
- `amount`: Float
- `fee`: Float
- `created_at`: Timestamp
- `confirmed_at`: Timestamp
## Security Features
### 1. Session Security
- SHA-256 hashed tokens
- 24-hour automatic expiry
- Server-side session validation
- Secure token invalidation on logout
### 2. API Security
- Session token required for protected endpoints
- User isolation (users can only access their own data)
- Input validation and sanitization
### 3. Future Enhancements
- JWT tokens for better scalability
- Multi-factor authentication
- Biometric wallet support
- Hardware wallet integration
## How It Works
### 1. First Time User
1. User connects wallet
2. System creates new user account
3. Wallet is created and linked to user
4. Session token issued
5. User can start trading
### 2. Returning User
1. User connects wallet
2. System finds existing user
3. Updates last login
4. Issues new session token
5. User sees their balance and history
### 3. Trading
1. User initiates purchase
2. Payment request created with user_id
3. Bitcoin payment processed
4. AITBC credited to user's wallet
5. Transaction recorded
## Testing
### Test Users
Each wallet connection creates a unique user:
- Address: `aitbc1wallet_[random]x...`
- Email: `wallet@aitbc.local`
- Username: `user_[last_8_chars]`
### Demo Mode
- No real registration required
- Instant wallet creation
- Testnet Bitcoin support
- Simulated balance updates
## Next Steps
### 1. Enhanced Features
- Email verification
- Password recovery
- 2FA authentication
- Profile customization
### 2. Advanced Trading
- Limit orders
- Stop-loss
- Trading history analytics
- Portfolio tracking
### 3. Integration
- MetaMask support
- WalletConnect protocol
- Hardware wallets (Ledger, Trezor)
- Mobile wallet apps
## Support
For issues or questions:
- Check the logs: `journalctl -u aitbc-coordinator -f`
- API endpoints: `https://aitbc.bubuit.net/api/docs`
- Trade Exchange: `https://aitbc.bubuit.net/Exchange`