Merge gitea/main, preserving release v0.2.2 stability and CLI documentation
This commit is contained in:
@@ -1,118 +0,0 @@
|
||||
🎉🎂🎁 AITBC NETWORK GIFT CERTIFICATE 🎁🎂🎉
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
|
||||
🌟 OFFICIAL GIFT TRANSACTION 🌟
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
|
||||
👤 RECIPIENT: newuser
|
||||
🏠 LOCATION: aitbc Server
|
||||
📱 WALLET: aitbc1newuser_simple
|
||||
💰 AMOUNT: 1,000 AITBC Coins
|
||||
🎁 TYPE: Welcome Gift
|
||||
📅 DATE: March 7, 2026
|
||||
⏰ TIME: 11:35 UTC
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
|
||||
🔗 TRANSACTION DETAILS:
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Transaction ID: │
|
||||
│ 0xc59be4528dbbfd1b4aaefa7ff807f72467e6b8d39857bc96a0edef3d307d780d │
|
||||
│ │
|
||||
│ From: aitbc1genesis (localhost at1) │
|
||||
│ To: aitbc1newuser_simple (aitbc server) │
|
||||
│ Amount: 1,000.000000 AITBC │
|
||||
│ Status: ✅ CONFIRMED │
|
||||
│ Network: AITBC Enhanced Development Network │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
|
||||
🎊 CONGRATULATIONS! 🎊
|
||||
|
||||
You have received 1,000 AITBC coins as a welcome gift to join
|
||||
the AITBC Enhanced Development Network!
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
|
||||
🚀 WHAT YOU CAN DO WITH YOUR AITBC COINS:
|
||||
|
||||
🤖 AI TRADING ENGINE
|
||||
• Start automated trading strategies
|
||||
• Use predictive analytics
|
||||
• Portfolio optimization
|
||||
|
||||
🔍 AI SURVEILLANCE
|
||||
• Behavioral analysis monitoring
|
||||
• Risk assessment tools
|
||||
• Market integrity protection
|
||||
|
||||
📊 ADVANCED ANALYTICS
|
||||
• Real-time market insights
|
||||
• Performance metrics
|
||||
• Custom analytics reports
|
||||
|
||||
🏢 ENTERPRISE INTEGRATION
|
||||
• Multi-tenant API access
|
||||
• Enterprise security features
|
||||
• Compliance automation
|
||||
|
||||
⛓️ CROSS-CHAIN OPERATIONS
|
||||
• Asset transfers between chains
|
||||
• Atomic swap capabilities
|
||||
• Bridge operations
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
|
||||
📱 QUICK START GUIDE:
|
||||
|
||||
1. Check your balance:
|
||||
curl http://aitbc-cascade:8000/wallet/balance
|
||||
|
||||
2. Explore AI features:
|
||||
aitbc ai-trading --help
|
||||
aitbc ai-surveillance --help
|
||||
aitbc advanced-analytics --help
|
||||
|
||||
3. Start trading:
|
||||
aitbc ai-trading start --strategy mean_reversion
|
||||
|
||||
4. Monitor your portfolio:
|
||||
aitbc advanced-analytics dashboard
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
|
||||
🌐 NETWORK INFORMATION:
|
||||
|
||||
🔗 Blockchain Explorer: http://aitbc-cascade:8016
|
||||
📡 Coordinator API: http://aitbc-cascade:8000
|
||||
⛓️ Blockchain Node: http://aitbc-cascade:8005
|
||||
📚 Documentation: http://aitbc-cascade:8000/docs
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
|
||||
💬 MESSAGE FROM THE SENDER:
|
||||
|
||||
"Welcome to the AITBC Enhanced Development Network!
|
||||
We're excited to have you join our community of AI-powered
|
||||
trading and analytics enthusiasts. Your 1,000 AITBC gift
|
||||
is your starting point to explore all the amazing features
|
||||
our network has to offer.
|
||||
|
||||
Happy trading and welcome aboard! 🚀"
|
||||
|
||||
- The AITBC Team (localhost at1)
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
|
||||
🔐 SECURITY NOTE:
|
||||
This gift certificate is for verification purposes only.
|
||||
Your actual AITBC coins are securely stored in your wallet
|
||||
at: aitbc1newuser_simple on the aitbc server.
|
||||
|
||||
═══════════════════════════════════════════════════════════════
|
||||
|
||||
🎉 ENJOY YOUR AITBC COINS! 🎉
|
||||
═══════════════════════════════════════════════════════════════
|
||||
@@ -1,42 +0,0 @@
|
||||
# Debugging Services — aitbc1
|
||||
|
||||
**Date:** 2026-03-13
|
||||
**Branch:** aitbc1/debug-services
|
||||
|
||||
## Status
|
||||
|
||||
- [x] Fixed CLI hardcoded paths; CLI now loads
|
||||
- [x] Committed robustness fixes to main (1feeadf)
|
||||
- [x] Patched systemd services to use /opt/aitbc paths
|
||||
- [x] Installed coordinator-api dependencies (torch, numpy, etc.)
|
||||
- [ ] Get coordinator-api running (DB migration issue)
|
||||
- [ ] Get wallet daemon running
|
||||
- [ ] Test wallet creation and chain genesis
|
||||
- [ ] Set up P2P peering between aitbc and aitbc1
|
||||
|
||||
## Blockers
|
||||
|
||||
### Coordinator API startup fails
|
||||
```
|
||||
sqlalchemy.exc.OperationalError: index ix_users_email already exists
|
||||
```
|
||||
Root cause: migrations are not idempotent; existing DB has partial schema.
|
||||
Workaround: use a fresh DB file.
|
||||
|
||||
Also need to ensure .env has proper API key lengths and JSON array format.
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Clean coordinator.db, restart coordinator API successfully
|
||||
2. Start wallet daemon (simple_daemon.py)
|
||||
3. Use CLI to create wallet(s)
|
||||
4. Generate/use genesis_brother_chain_1773403269.yaml
|
||||
5. Start blockchain node on port 8005 (per Andreas) with that genesis
|
||||
6. Configure peers (aitbc at 10.1.223.93, aitbc1 at 10.1.223.40)
|
||||
7. Send test coins between wallets
|
||||
|
||||
## Notes
|
||||
|
||||
- Both hosts on same network (10.1.223.0/24)
|
||||
- Services should run as root (no sudo needed)
|
||||
- Ollama available on both for AI tests later
|
||||
@@ -1,53 +0,0 @@
|
||||
# Development Logs Policy
|
||||
|
||||
## 📁 Log Location
|
||||
All development logs should be stored in: `/opt/aitbc/dev/logs/`
|
||||
|
||||
## 🗂️ Directory Structure
|
||||
```
|
||||
dev/logs/
|
||||
├── archive/ # Old logs by date
|
||||
├── current/ # Current session logs
|
||||
├── tools/ # Download logs, wget logs, etc.
|
||||
├── cli/ # CLI operation logs
|
||||
├── services/ # Service-related logs
|
||||
└── temp/ # Temporary logs
|
||||
```
|
||||
|
||||
## 🛡️ Prevention Measures
|
||||
1. **Use log aliases**: `wgetlog`, `curllog`, `devlog`
|
||||
2. **Environment variables**: `$AITBC_DEV_LOGS_DIR`
|
||||
3. **Git ignore**: Prevents log files in project root
|
||||
4. **Cleanup scripts**: `cleanlogs`, `archivelogs`
|
||||
|
||||
## 🚀 Quick Commands
|
||||
```bash
|
||||
# Load log environment
|
||||
source /opt/aitbc/.env.dev
|
||||
|
||||
# Navigate to logs
|
||||
devlogs # Go to main logs directory
|
||||
currentlogs # Go to current session logs
|
||||
toolslogs # Go to tools logs
|
||||
clilogs # Go to CLI logs
|
||||
serviceslogs # Go to service logs
|
||||
|
||||
# Log operations
|
||||
wgetlog <url> # Download with proper logging
|
||||
curllog <url> # Curl with proper logging
|
||||
devlog "message" # Add dev log entry
|
||||
cleanlogs # Clean old logs
|
||||
archivelogs # Archive current logs
|
||||
|
||||
# View logs
|
||||
./dev/logs/view-logs.sh tools # View tools logs
|
||||
./dev/logs/view-logs.sh recent # View recent activity
|
||||
```
|
||||
|
||||
## 📋 Best Practices
|
||||
1. **Never** create log files in project root
|
||||
2. **Always** use proper log directories
|
||||
3. **Use** log aliases for common operations
|
||||
4. **Clean** up old logs regularly
|
||||
5. **Archive** important logs before cleanup
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
# AITBC Development Logs - Quick Reference
|
||||
|
||||
## 🎯 **Problem Solved:**
|
||||
- ✅ **wget-log** moved from project root to `/opt/aitbc/dev/logs/tools/`
|
||||
- ✅ **Prevention measures** implemented to avoid future scattered logs
|
||||
- ✅ **Log organization system** established
|
||||
|
||||
## 📁 **New Log Structure:**
|
||||
```
|
||||
/opt/aitbc/dev/logs/
|
||||
├── archive/ # Old logs organized by date
|
||||
├── current/ # Current session logs
|
||||
├── tools/ # Download logs, wget logs, curl logs
|
||||
├── cli/ # CLI operation logs
|
||||
├── services/ # Service-related logs
|
||||
└── temp/ # Temporary logs
|
||||
```
|
||||
|
||||
## 🛡️ **Prevention Measures:**
|
||||
|
||||
### **1. Environment Configuration:**
|
||||
```bash
|
||||
# Load log environment (automatic in .env.dev)
|
||||
source /opt/aitbc/.env.dev.logs
|
||||
|
||||
# Environment variables available:
|
||||
$AITBC_DEV_LOGS_DIR # Main logs directory
|
||||
$AITBC_CURRENT_LOG_DIR # Current session logs
|
||||
$AITBC_TOOLS_LOG_DIR # Tools/download logs
|
||||
$AITBC_CLI_LOG_DIR # CLI operation logs
|
||||
$AITBC_SERVICES_LOG_DIR # Service logs
|
||||
```
|
||||
|
||||
### **2. Log Aliases:**
|
||||
```bash
|
||||
devlogs # cd to main logs directory
|
||||
currentlogs # cd to current session logs
|
||||
toolslogs # cd to tools logs
|
||||
clilogs # cd to CLI logs
|
||||
serviceslogs # cd to service logs
|
||||
|
||||
# Logging commands:
|
||||
wgetlog <url> # wget with proper logging
|
||||
curllog <url> # curl with proper logging
|
||||
devlog "message" # add dev log entry
|
||||
cleanlogs # clean old logs (>7 days)
|
||||
archivelogs # archive current logs (>1 day)
|
||||
```
|
||||
|
||||
### **3. Management Tools:**
|
||||
```bash
|
||||
# View logs
|
||||
./dev/logs/view-logs.sh tools # view tools logs
|
||||
./dev/logs/view-logs.sh current # view current logs
|
||||
./dev/logs/view-logs.sh recent # view recent activity
|
||||
|
||||
# Organize logs
|
||||
./dev/logs/organize-logs.sh # organize scattered logs
|
||||
|
||||
# Clean up logs
|
||||
./dev/logs/cleanup-logs.sh # cleanup old logs
|
||||
```
|
||||
|
||||
### **4. Git Protection:**
|
||||
```bash
|
||||
# .gitignore updated to prevent log files in project root:
|
||||
*.log
|
||||
*.out
|
||||
*.err
|
||||
wget-log
|
||||
download.log
|
||||
```
|
||||
|
||||
## 🚀 **Best Practices:**
|
||||
|
||||
### **DO:**
|
||||
✅ Use `wgetlog <url>` instead of `wget <url>`
|
||||
✅ Use `curllog <url>` instead of `curl <url>`
|
||||
✅ Use `devlog "message"` for development notes
|
||||
✅ Store all logs in `/opt/aitbc/dev/logs/`
|
||||
✅ Use log aliases for navigation
|
||||
✅ Clean up old logs regularly
|
||||
|
||||
### **DON'T:**
|
||||
❌ Create log files in project root
|
||||
❌ Use `wget` without `-o` option
|
||||
❌ Use `curl` without output redirection
|
||||
❌ Leave scattered log files
|
||||
❌ Ignore log organization
|
||||
|
||||
## 📋 **Quick Commands:**
|
||||
|
||||
### **For Downloads:**
|
||||
```bash
|
||||
# Instead of: wget http://example.com/file
|
||||
# Use: wgetlog http://example.com/file
|
||||
|
||||
# Instead of: curl http://example.com/api
|
||||
# Use: curllog http://example.com/api
|
||||
```
|
||||
|
||||
### **For Development:**
|
||||
```bash
|
||||
# Add development notes
|
||||
devlog "Fixed CLI permission issue"
|
||||
devlog "Added new exchange feature"
|
||||
|
||||
# Navigate to logs
|
||||
devlogs
|
||||
toolslogs
|
||||
clilogs
|
||||
```
|
||||
|
||||
### **For Maintenance:**
|
||||
```bash
|
||||
# Clean up old logs
|
||||
cleanlogs
|
||||
|
||||
# Archive current logs
|
||||
archivelogs
|
||||
|
||||
# View recent activity
|
||||
./dev/logs/view-logs.sh recent
|
||||
```
|
||||
|
||||
## 🎉 **Results:**
|
||||
|
||||
### **Before:**
|
||||
- ❌ `wget-log` in project root
|
||||
- ❌ Scattered log files everywhere
|
||||
- ❌ No organization system
|
||||
- ❌ No prevention measures
|
||||
|
||||
### **After:**
|
||||
- ✅ All logs organized in `/opt/aitbc/dev/logs/`
|
||||
- ✅ Proper directory structure
|
||||
- ✅ Prevention measures in place
|
||||
- ✅ Management tools available
|
||||
- ✅ Git protection enabled
|
||||
- ✅ Environment configured
|
||||
|
||||
## 🔧 **Implementation Status:**
|
||||
|
||||
| Component | Status | Details |
|
||||
|-----------|--------|---------|
|
||||
| **Log Organization** | ✅ COMPLETE | All logs moved to proper locations |
|
||||
| **Directory Structure** | ✅ COMPLETE | Hierarchical organization |
|
||||
| **Prevention Measures** | ✅ COMPLETE | Aliases, environment, git ignore |
|
||||
| **Management Tools** | ✅ COMPLETE | View, organize, cleanup scripts |
|
||||
| **Environment Config** | ✅ COMPLETE | Variables and aliases loaded |
|
||||
| **Git Protection** | ✅ COMPLETE | Root log files ignored |
|
||||
|
||||
## 🚀 **Future Prevention:**
|
||||
|
||||
1. **Automatic Environment**: Log aliases loaded automatically
|
||||
2. **Git Protection**: Log files in root automatically ignored
|
||||
3. **Cleanup Scripts**: Regular maintenance automated
|
||||
4. **Management Tools**: Easy organization and viewing
|
||||
5. **Documentation**: Clear guidelines and best practices
|
||||
|
||||
**🎯 The development logs are now properly organized and future scattered logs are prevented!**
|
||||
@@ -1,123 +0,0 @@
|
||||
# GitHub Pull and Container Update Summary
|
||||
|
||||
## ✅ Successfully Completed
|
||||
|
||||
### 1. GitHub Status Verification
|
||||
- **Local Repository**: ✅ Up to date with GitHub (commit `e84b096`)
|
||||
- **Remote**: `github` → `https://github.com/oib/AITBC.git`
|
||||
- **Status**: Clean working directory, no uncommitted changes
|
||||
|
||||
### 2. Container Updates
|
||||
|
||||
#### 🟢 **aitbc Container**
|
||||
- **Before**: Commit `9297e45` (behind by 3 commits)
|
||||
- **After**: Commit `e84b096` (up to date)
|
||||
- **Changes Pulled**:
|
||||
- SQLModel metadata field fixes
|
||||
- Enhanced genesis block configuration
|
||||
- Bug fixes and improvements
|
||||
|
||||
#### 🟢 **aitbc1 Container**
|
||||
- **Before**: Commit `9297e45` (behind by 3 commits)
|
||||
- **After**: Commit `e84b096` (up to date)
|
||||
- **Changes Pulled**: Same as aitbc container
|
||||
|
||||
### 3. Service Fixes Applied
|
||||
|
||||
#### **Database Initialization Issue**
|
||||
- **Problem**: `init_db` function missing from database module
|
||||
- **Solution**: Added `init_db` function to both containers
|
||||
- **Files Updated**:
|
||||
- `/opt/aitbc/apps/coordinator-api/init_db.py`
|
||||
- `/opt/aitbc/apps/coordinator-api/src/app/database.py`
|
||||
|
||||
#### **Service Status**
|
||||
- **aitbc-coordinator.service**: ✅ Running successfully
|
||||
- **aitbc-blockchain-node.service**: ✅ Running successfully
|
||||
- **Database**: ✅ Initialized without errors
|
||||
|
||||
### 4. Verification Results
|
||||
|
||||
#### **aitbc Container Services**
|
||||
```bash
|
||||
# Blockchain Node
|
||||
curl http://aitbc-cascade:8005/rpc/info
|
||||
# Status: ✅ Operational
|
||||
|
||||
# Coordinator API
|
||||
curl http://aitbc-cascade:8000/health
|
||||
# Status: ✅ Running ({"status":"ok","env":"dev"})
|
||||
```
|
||||
|
||||
#### **Local Services (for comparison)**
|
||||
```bash
|
||||
# Blockchain Node
|
||||
curl http://localhost:8005/rpc/info
|
||||
# Result: height=0, total_accounts=7
|
||||
|
||||
# Coordinator API
|
||||
curl http://localhost:8000/health
|
||||
# Result: {"status":"ok","env":"dev","python_version":"3.13.5"}
|
||||
```
|
||||
|
||||
### 5. Issues Resolved
|
||||
|
||||
#### **SQLModel Metadata Conflicts**
|
||||
- **Fixed**: Field name shadowing in multitenant models
|
||||
- **Impact**: No more warnings during CLI operations
|
||||
- **Models Updated**: TenantAuditLog, UsageRecord, TenantUser, Invoice
|
||||
|
||||
#### **Service Initialization**
|
||||
- **Fixed**: Missing `init_db` function in database module
|
||||
- **Impact**: Coordinator services start successfully
|
||||
- **Containers**: Both aitbc and aitbc1 updated
|
||||
|
||||
#### **Code Synchronization**
|
||||
- **Fixed**: Container codebase behind GitHub
|
||||
- **Impact**: All containers have latest features and fixes
|
||||
- **Status**: Full synchronization achieved
|
||||
|
||||
### 6. Current Status
|
||||
|
||||
#### **✅ Working Components**
|
||||
- **Enhanced Genesis Block**: Deployed on all systems
|
||||
- **User Wallet System**: Operational with 3 wallets
|
||||
- **AI Features**: Available through CLI and API
|
||||
- **Multi-tenant Architecture**: Fixed and ready
|
||||
- **Services**: All core services running
|
||||
|
||||
#### **⚠️ Known Issues**
|
||||
- **CLI Module Error**: `kyc_aml_providers` module missing in containers
|
||||
- **Impact**: CLI commands not working on containers
|
||||
- **Workaround**: Use local CLI or fix module dependency
|
||||
|
||||
### 7. Next Steps
|
||||
|
||||
#### **Immediate Actions**
|
||||
1. **Fix CLI Dependencies**: Install missing `kyc_aml_providers` module
|
||||
2. **Test Container CLI**: Verify wallet and trading commands work
|
||||
3. **Deploy Enhanced Genesis**: Use latest genesis on containers
|
||||
4. **Test AI Features**: Verify AI trading and surveillance work
|
||||
|
||||
#### **Future Enhancements**
|
||||
1. **Container CLI Setup**: Complete CLI environment on containers
|
||||
2. **Cross-Container Testing**: Test wallet transfers between containers
|
||||
3. **Service Integration**: Test AI features across all environments
|
||||
4. **Production Deployment**: Prepare for production environment
|
||||
|
||||
## 🎉 Conclusion
|
||||
|
||||
**Successfully pulled latest changes from GitHub to both aitbc and aitbc1 containers.**
|
||||
|
||||
### Key Achievements:
|
||||
- ✅ **Code Synchronization**: All containers up to date with GitHub
|
||||
- ✅ **Service Fixes**: Database initialization issues resolved
|
||||
- ✅ **Enhanced Features**: Latest AI and multi-tenant features available
|
||||
- ✅ **Bug Fixes**: SQLModel conflicts resolved across all environments
|
||||
|
||||
### Current State:
|
||||
- **Local (at1)**: ✅ Fully operational with enhanced features
|
||||
- **Container (aitbc)**: ✅ Services running, latest code deployed
|
||||
- **Container (aitbc1)**: ✅ Services running, latest code deployed
|
||||
|
||||
The AITBC network is now synchronized across all environments with the latest enhanced features and bug fixes. Ready for testing and deployment of new user onboarding and AI features.
|
||||
@@ -1,146 +0,0 @@
|
||||
# SQLModel Metadata Field Conflicts - Fixed
|
||||
|
||||
## Issue Summary
|
||||
The following SQLModel UserWarning was appearing during CLI testing:
|
||||
```
|
||||
UserWarning: Field name "metadata" in "TenantAuditLog" shadows an attribute in parent "SQLModel"
|
||||
UserWarning: Field name "metadata" in "UsageRecord" shadows an attribute in parent "SQLModel"
|
||||
UserWarning: Field name "metadata" in "TenantUser" shadows an attribute in parent "SQLModel"
|
||||
UserWarning: Field name "metadata" in "Invoice" shadows an attribute in parent "SQLModel"
|
||||
```
|
||||
|
||||
## Root Cause
|
||||
SQLModel has a built-in `metadata` attribute that was being shadowed by custom field definitions in several model classes. This caused warnings during model initialization.
|
||||
|
||||
## Fix Applied
|
||||
|
||||
### 1. Updated Model Fields
|
||||
Changed conflicting `metadata` field names to avoid shadowing SQLModel's built-in attribute:
|
||||
|
||||
#### TenantAuditLog Model
|
||||
```python
|
||||
# Before
|
||||
metadata: Optional[Dict[str, Any]] = None
|
||||
|
||||
# After
|
||||
event_metadata: Optional[Dict[str, Any]] = None
|
||||
```
|
||||
|
||||
#### UsageRecord Model
|
||||
```python
|
||||
# Before
|
||||
metadata: Optional[Dict[str, Any]] = None
|
||||
|
||||
# After
|
||||
usage_metadata: Optional[Dict[str, Any]] = None
|
||||
```
|
||||
|
||||
#### TenantUser Model
|
||||
```python
|
||||
# Before
|
||||
metadata: Optional[Dict[str, Any]] = None
|
||||
|
||||
# After
|
||||
user_metadata: Optional[Dict[str, Any]] = None
|
||||
```
|
||||
|
||||
#### Invoice Model
|
||||
```python
|
||||
# Before
|
||||
metadata: Optional[Dict[str, Any]] = None
|
||||
|
||||
# After
|
||||
invoice_metadata: Optional[Dict[str, Any]] = None
|
||||
```
|
||||
|
||||
### 2. Updated Service Code
|
||||
Updated the tenant management service to use the new field names:
|
||||
|
||||
```python
|
||||
# Before
|
||||
def log_audit_event(..., metadata: Optional[Dict[str, Any]] = None):
|
||||
audit_log = TenantAuditLog(..., metadata=metadata)
|
||||
|
||||
# After
|
||||
def log_audit_event(..., event_metadata: Optional[Dict[str, Any]] = None):
|
||||
audit_log = TenantAuditLog(..., event_metadata=event_metadata)
|
||||
```
|
||||
|
||||
## Files Modified
|
||||
|
||||
### Core Model Files
|
||||
- `/home/oib/windsurf/aitbc/apps/coordinator-api/src/app/models/multitenant.py`
|
||||
- Fixed 4 SQLModel classes with metadata conflicts
|
||||
- Updated field names to be more specific
|
||||
|
||||
### Service Files
|
||||
- `/home/oib/windsurf/aitbc/apps/coordinator-api/src/app/services/tenant_management.py`
|
||||
- Updated audit logging function to use new field name
|
||||
- Maintained backward compatibility for audit functionality
|
||||
|
||||
## Verification
|
||||
|
||||
### Before Fix
|
||||
```
|
||||
UserWarning: Field name "metadata" in "TenantAuditLog" shadows an attribute in parent "SQLModel"
|
||||
UserWarning: Field name "metadata" in "UsageRecord" shadows an attribute in parent "SQLModel"
|
||||
UserWarning: Field name "metadata" in "TenantUser" shadows an attribute in parent "SQLModel"
|
||||
UserWarning: Field name "metadata" in "Invoice" shadows an attribute in parent "SQLModel"
|
||||
```
|
||||
|
||||
### After Fix
|
||||
- ✅ No SQLModel warnings during CLI operations
|
||||
- ✅ All CLI commands working without warnings
|
||||
- ✅ AI trading commands functional
|
||||
- ✅ Advanced analytics commands functional
|
||||
- ✅ Wallet operations working cleanly
|
||||
|
||||
## Impact
|
||||
|
||||
### Benefits
|
||||
1. **Clean CLI Output**: No more SQLModel warnings during testing
|
||||
2. **Better Code Quality**: Eliminated field name shadowing
|
||||
3. **Maintainability**: More descriptive field names
|
||||
4. **Future-Proof**: Compatible with SQLModel updates
|
||||
|
||||
### Backward Compatibility
|
||||
- Database schema unchanged (only Python field names updated)
|
||||
- Service functionality preserved
|
||||
- API responses unaffected
|
||||
- No breaking changes to external interfaces
|
||||
|
||||
## Testing Results
|
||||
|
||||
### CLI Commands Tested
|
||||
- ✅ `aitbc --test-mode wallet list` - No warnings
|
||||
- ✅ `aitbc --test-mode ai-trading --help` - No warnings
|
||||
- ✅ `aitbc --test-mode advanced-analytics --help` - No warnings
|
||||
- ✅ `aitbc --test-mode ai-surveillance --help` - No warnings
|
||||
|
||||
### Services Verified
|
||||
- ✅ AI Trading Engine loading without warnings
|
||||
- ✅ AI Surveillance system initializing cleanly
|
||||
- ✅ Advanced Analytics platform starting without warnings
|
||||
- ✅ Multi-tenant services operating normally
|
||||
|
||||
## Technical Details
|
||||
|
||||
### SQLModel Version Compatibility
|
||||
- Fixed for SQLModel 0.0.14+ (current version in use)
|
||||
- Prevents future compatibility issues
|
||||
- Follows SQLModel best practices
|
||||
|
||||
### Field Naming Convention
|
||||
- `metadata` → `event_metadata` (audit events)
|
||||
- `metadata` → `usage_metadata` (usage records)
|
||||
- `metadata` → `user_metadata` (user data)
|
||||
- `metadata` → `invoice_metadata` (billing data)
|
||||
|
||||
### Database Schema
|
||||
- No changes to database column names
|
||||
- SQLAlchemy mappings handle field name translation
|
||||
- Existing data preserved
|
||||
|
||||
## Conclusion
|
||||
|
||||
The SQLModel metadata field conflicts have been completely resolved. All CLI operations now run without warnings, and the codebase follows SQLModel best practices for field naming. The fix maintains full backward compatibility while improving code quality and maintainability.
|
||||
@@ -1,181 +0,0 @@
|
||||
# Brother Chain Deployment — Working Configuration
|
||||
|
||||
**Agent**: aitbc
|
||||
**Branch**: aitbc/debug-brother-chain
|
||||
**Date**: 2026-03-13
|
||||
|
||||
## ✅ Services Running on aitbc (main chain host)
|
||||
|
||||
- Coordinator API: `http://10.1.223.93:8000` (healthy)
|
||||
- Wallet Daemon: `http://10.1.223.93:8002` (active)
|
||||
- Blockchain Node: `10.1.223.93:8005` (PoA, 3s blocks)
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Systemd Override Pattern for Blockchain Node
|
||||
|
||||
The base service `/etc/systemd/system/aitbc-blockchain-node.service`:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=AITBC Blockchain Node
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=aitbc
|
||||
Group=aitbc
|
||||
WorkingDirectory=/opt/aitbc/apps/blockchain-node
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
The override `/etc/systemd/system/aitbc-blockchain-node.service.d/override.conf`:
|
||||
|
||||
```ini
|
||||
[Service]
|
||||
Environment=NODE_PORT=8005
|
||||
Environment=PYTHONPATH=/opt/aitbc/apps/blockchain-node/src:/opt/aitbc/apps/blockchain-node/scripts
|
||||
ExecStart=
|
||||
ExecStart=/opt/aitbc/apps/blockchain-node/.venv/bin/python3 -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 8005
|
||||
```
|
||||
|
||||
This runs the FastAPI app on port 8005. The `aitbc_chain.app` module provides the RPC API.
|
||||
|
||||
---
|
||||
|
||||
## 🔑 Coordinator API Configuration
|
||||
|
||||
**File**: `/opt/aitbc/apps/coordinator-api/.env`
|
||||
|
||||
```ini
|
||||
MINER_API_KEYS=["your_key_here"]
|
||||
DATABASE_URL=sqlite:///./aitbc_coordinator.db
|
||||
LOG_LEVEL=INFO
|
||||
ENVIRONMENT=development
|
||||
API_HOST=0.0.0.0
|
||||
API_PORT=8000
|
||||
WORKERS=2
|
||||
# Note: No miner service needed (CPU-only)
|
||||
```
|
||||
|
||||
Important: `MINER_API_KEYS` must be a JSON array string, not comma-separated list.
|
||||
|
||||
---
|
||||
|
||||
## 💰 Wallet Files
|
||||
|
||||
Brother chain wallet for aitbc1 (pre-allocated):
|
||||
|
||||
```
|
||||
/opt/aitbc/.aitbc/wallets/aitbc1.json
|
||||
```
|
||||
|
||||
Contents (example):
|
||||
```json
|
||||
{
|
||||
"name": "aitbc1",
|
||||
"address": "aitbc1aitbc1_simple",
|
||||
"balance": 500.0,
|
||||
"type": "simple",
|
||||
"created_at": "2026-03-13T12:00:00Z",
|
||||
"transactions": [ ... ]
|
||||
}
|
||||
```
|
||||
|
||||
Main chain wallet (separate):
|
||||
|
||||
```
|
||||
/opt/aitbc/.aitbc/wallets/aitbc1_main.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📦 Genesis Configuration
|
||||
|
||||
**File**: `/opt/aitbc/genesis_brother_chain_*.yaml`
|
||||
|
||||
Key properties:
|
||||
- `chain_id`: `aitbc-brother-chain`
|
||||
- `chain_type`: `topic`
|
||||
- `purpose`: `brother-connection`
|
||||
- `privacy.visibility`: `private`
|
||||
- `consensus.algorithm`: `poa`
|
||||
- `block_time`: 3 seconds
|
||||
- `accounts`: includes `aitbc1aitbc1_simple` with 500 AITBC
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Validation Steps
|
||||
|
||||
1. **Coordinator health**:
|
||||
```bash
|
||||
curl http://localhost:8000/health
|
||||
# Expected: {"status":"ok",...}
|
||||
```
|
||||
|
||||
2. **Wallet balance** (once wallet daemon is up and wallet file present):
|
||||
```bash
|
||||
# Coordinator forwards to wallet daemon
|
||||
curl http://localhost:8000/v1/agent-identity/identities/.../wallets/<chain_id>/balance
|
||||
```
|
||||
|
||||
3. **Blockchain node health**:
|
||||
```bash
|
||||
curl http://localhost:8005/health
|
||||
# Or if using uvicorn default: /health
|
||||
```
|
||||
|
||||
4. **Chain head**:
|
||||
```bash
|
||||
curl http://localhost:8005/rpc/head
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Peer Connection
|
||||
|
||||
Once brother chain node (aitbc1) is running on port 8005 (or 18001 if they choose), add peer:
|
||||
|
||||
On aitbc main chain node, probably need to call a method to add static peer or rely on gossip.
|
||||
|
||||
If using memory gossip backend, they need to be directly addressable. Configure:
|
||||
|
||||
- aitbc1 node: `--host 0.0.0.0 --port 18001` (or 8005)
|
||||
- aitbc node: set `GOSSIP_BROADCAST_URL` or add peer manually via admin API if available.
|
||||
|
||||
Alternatively, just have aitbc1 connect to aitbc as a peer by adding our address to their trusted proposers or peer list.
|
||||
|
||||
---
|
||||
|
||||
## 📝 Notes
|
||||
|
||||
- Both hosts are root in incus containers, no sudo required for systemd commands.
|
||||
- Network: aitbc (10.1.223.93), aitbc1 (10.1.223.40) — reachable via internal IPs.
|
||||
- Ports: 8000 (coordinator), 8002 (wallet), 8005 (blockchain), 8006 (maybe blockchain RPC or sync).
|
||||
- The blockchain node is scaffolded but functional; it's a FastAPI app providing RPC endpoints, not a full production blockchain node but sufficient for devnet.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Dependencies Installation
|
||||
|
||||
For each app under `/opt/aitbc/apps/*`:
|
||||
|
||||
```bash
|
||||
cd /opt/aitbc/apps/<app-name>
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -e . # if setup.py/pyproject.toml exists
|
||||
# or pip install -r requirements.txt
|
||||
```
|
||||
|
||||
For coordinator-api and wallet, they may share dependencies. The wallet daemon appears to be a separate entrypoint but uses the same codebase as coordinator-api in this repo structure (see `aitbc-wallet.service` pointing to `app.main:app` with `SERVICE_TYPE=wallet`).
|
||||
|
||||
---
|
||||
|
||||
**Status**: Coordinator and wallet up on my side. Blockchain node running. Ready to peer.
|
||||
Reference in New Issue
Block a user