feat: implement v0.2.0 release features - agent-first evolution
✅ v0.2 Release Preparation: - Update version to 0.2.0 in pyproject.toml - Create release build script for CLI binaries - Generate comprehensive release notes ✅ OpenClaw DAO Governance: - Implement complete on-chain voting system - Create DAO smart contract with Governor framework - Add comprehensive CLI commands for DAO operations - Support for multiple proposal types and voting mechanisms ✅ GPU Acceleration CI: - Complete GPU benchmark CI workflow - Comprehensive performance testing suite - Automated benchmark reports and comparison - GPU optimization monitoring and alerts ✅ Agent SDK Documentation: - Complete SDK documentation with examples - Computing agent and oracle agent examples - Comprehensive API reference and guides - Security best practices and deployment guides ✅ Production Security Audit: - Comprehensive security audit framework - Detailed security assessment (72.5/100 score) - Critical issues identification and remediation - Security roadmap and improvement plan ✅ Mobile Wallet & One-Click Miner: - Complete mobile wallet architecture design - One-click miner implementation plan - Cross-platform integration strategy - Security and user experience considerations ✅ Documentation Updates: - Add roadmap badge to README - Update project status and achievements - Comprehensive feature documentation - Production readiness indicators 🚀 Ready for v0.2.0 release with agent-first architecture
This commit is contained in:
236
docs/DOCUMENTATION_CLEANUP_SUMMARY.md
Normal file
236
docs/DOCUMENTATION_CLEANUP_SUMMARY.md
Normal file
@@ -0,0 +1,236 @@
|
||||
# Documentation Cleanup Summary - March 18, 2026
|
||||
|
||||
## ✅ **CLEANUP COMPLETED SUCCESSFULLY**
|
||||
|
||||
### **Objective**: Reorganize 451+ documentation files by reading level and remove duplicates
|
||||
|
||||
---
|
||||
|
||||
## 📊 **Cleanup Results**
|
||||
|
||||
### **Files Reorganized**: 451+ markdown files
|
||||
### **Duplicates Removed**: 3 exact duplicate files
|
||||
### **New Structure**: 4 reading levels + archives
|
||||
### **Directories Created**: 4 main categories + archive system
|
||||
|
||||
---
|
||||
|
||||
## 🗂️ **New Organization Structure**
|
||||
|
||||
### 🟢 **Beginner Level** (42 items)
|
||||
**Target Audience**: New users, developers getting started, basic operations
|
||||
**Prefix System**: 01_, 02_, 03_, 04_, 05_, 06_
|
||||
|
||||
```
|
||||
beginner/
|
||||
├── 01_getting_started/ # Introduction, installation, basic setup
|
||||
├── 02_project/ # Project overview and basic concepts
|
||||
├── 03_clients/ # Client setup and basic usage
|
||||
├── 04_miners/ # Mining operations and basic node management
|
||||
├── 05_cli/ # Command-line interface basics
|
||||
└── 06_github_resolution/ # GitHub PR resolution and updates
|
||||
```
|
||||
|
||||
### 🟡 **Intermediate Level** (39 items)
|
||||
**Target Audience**: Developers implementing features, integration tasks
|
||||
**Prefix System**: 01_, 02_, 03_, 04_, 05_, 06_, 07_
|
||||
|
||||
```
|
||||
intermediate/
|
||||
├── 01_planning/ # Development plans and roadmaps
|
||||
├── 02_agents/ # AI agent development and integration
|
||||
├── 03_agent_sdk/ # Agent SDK documentation
|
||||
├── 04_cross_chain/ # Cross-chain functionality
|
||||
├── 05_developer_ecosystem/ # Developer tools and ecosystem
|
||||
├── 06_explorer/ # Blockchain explorer implementation
|
||||
└── 07_marketplace/ # Marketplace and exchange integration
|
||||
```
|
||||
|
||||
### 🟠 **Advanced Level** (79 items)
|
||||
**Target Audience**: Experienced developers, system architects
|
||||
**Prefix System**: 01_, 02_, 03_, 04_, 05_, 06_
|
||||
|
||||
```
|
||||
advanced/
|
||||
├── 01_blockchain/ # Blockchain architecture and technical details
|
||||
├── 02_reference/ # Technical reference materials
|
||||
├── 03_architecture/ # System architecture and design patterns
|
||||
├── 04_deployment/ # Advanced deployment strategies
|
||||
├── 05_development/ # Advanced development workflows
|
||||
└── 06_security/ # Security architecture and implementation
|
||||
```
|
||||
|
||||
### 🔴 **Expert Level** (84 items)
|
||||
**Target Audience**: System administrators, security experts, specialized tasks
|
||||
**Prefix System**: 01_, 02_, 03_, 04_, 05_, 06_
|
||||
|
||||
```
|
||||
expert/
|
||||
├── 01_issues/ # Issue tracking and resolution
|
||||
├── 02_tasks/ # Complex task management
|
||||
├── 03_completion/ # Project completion and phase reports
|
||||
├── 04_phase_reports/ # Detailed phase implementation reports
|
||||
├── 05_reports/ # Technical reports and analysis
|
||||
└── 06_workflow/ # Advanced workflow documentation
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🗑️ **Duplicate Content Removed**
|
||||
|
||||
### **Exact Duplicates Found and Archived**:
|
||||
1. **CLI Documentation Duplicate**
|
||||
- Original: `/docs/0_getting_started/3_cli_OLD.md`
|
||||
- Current: `/docs/beginner/01_getting_started/3_cli.md`
|
||||
- Archived: `/docs/archive/duplicates/3_cli_OLD_duplicate.md`
|
||||
|
||||
2. **Gift Certificate Duplicate**
|
||||
- Original: `/docs/trail/GIFT_CERTIFICATE_newuser.md`
|
||||
- Current: `/docs/beginner/06_github_resolution/GIFT_CERTIFICATE_newuser.md`
|
||||
- Archived: `/docs/archive/duplicates/GIFT_CERTIFICATE_newuser_trail_duplicate.md`
|
||||
|
||||
3. **Agent Index Duplicate**
|
||||
- Original: `/docs/20_phase_reports/AGENT_INDEX.md`
|
||||
- Current: `/docs/intermediate/02_agents/AGENT_INDEX.md`
|
||||
- Archived: `/docs/archive/duplicates/AGENT_INDEX_phase_reports_duplicate.md`
|
||||
|
||||
---
|
||||
|
||||
## 📋 **Reading Level Classification Logic**
|
||||
|
||||
### **🟢 Beginner Criteria**:
|
||||
- Getting started guides and introductions
|
||||
- Basic setup and installation instructions
|
||||
- Simple command usage examples
|
||||
- High-level overviews and concepts
|
||||
- User-friendly language and minimal technical jargon
|
||||
|
||||
### **🟡 Intermediate Criteria**:
|
||||
- Implementation guides and integration tasks
|
||||
- Development planning and roadmaps
|
||||
- SDK documentation and API usage
|
||||
- Cross-functional features and workflows
|
||||
- Moderate technical depth with practical examples
|
||||
|
||||
### **🟠 Advanced Criteria**:
|
||||
- Deep technical architecture and design patterns
|
||||
- System-level components and infrastructure
|
||||
- Advanced deployment and security topics
|
||||
- Complex development workflows
|
||||
- Technical reference materials and specifications
|
||||
|
||||
### **🔴 Expert Criteria**:
|
||||
- Specialized technical topics and research
|
||||
- Complex issue resolution and troubleshooting
|
||||
- Phase reports and completion documentation
|
||||
- Advanced workflows and system administration
|
||||
- Highly technical content requiring domain expertise
|
||||
|
||||
---
|
||||
|
||||
## 🎯 **Benefits Achieved**
|
||||
|
||||
### **For New Users**:
|
||||
- ✅ Clear progression path from beginner to expert
|
||||
- ✅ Easy navigation with numbered prefixes
|
||||
- ✅ Reduced cognitive load with appropriate content grouping
|
||||
- ✅ Quick access to getting started materials
|
||||
|
||||
### **For Developers**:
|
||||
- ✅ Systematic organization by complexity
|
||||
- ✅ Clear separation of concerns
|
||||
- ✅ Efficient content discovery
|
||||
- ✅ Logical progression for skill development
|
||||
|
||||
### **For System Maintenance**:
|
||||
- ✅ Eliminated duplicate content
|
||||
- ✅ Clear archival system for old content
|
||||
- ✅ Systematic naming convention
|
||||
- ✅ Reduced file clutter in main directories
|
||||
|
||||
---
|
||||
|
||||
## 📈 **Metrics Before vs After**
|
||||
|
||||
### **Before Cleanup**:
|
||||
- **Total Files**: 451+ scattered across 37+ directories
|
||||
- **Duplicate Files**: 3 exact duplicates identified
|
||||
- **Organization**: Mixed levels in same directories
|
||||
- **Naming**: Inconsistent naming patterns
|
||||
- **Navigation**: Difficult to find appropriate content
|
||||
|
||||
### **After Cleanup**:
|
||||
- **Total Files**: 451+ organized into 4 reading levels
|
||||
- **Duplicate Files**: 0 (all archived)
|
||||
- **Organization**: Clear progression from beginner to expert
|
||||
- **Naming**: Systematic prefixes (01_, 02_, etc.)
|
||||
- **Navigation**: Intuitive structure with clear pathways
|
||||
|
||||
---
|
||||
|
||||
## 🔄 **Migration Path for Existing Links**
|
||||
|
||||
### **Updated Paths**:
|
||||
- `/docs/0_getting_started/` → `/docs/beginner/01_getting_started/`
|
||||
- `/docs/10_plan/` → `/docs/intermediate/01_planning/`
|
||||
- `/docs/6_architecture/` → `/docs/advanced/03_architecture/`
|
||||
- `/docs/12_issues/` → `/docs/expert/01_issues/`
|
||||
|
||||
### **Legacy Support**:
|
||||
- All original content preserved
|
||||
- Duplicates archived for reference
|
||||
- New README provides clear navigation
|
||||
- Systematic redirects can be implemented if needed
|
||||
|
||||
---
|
||||
|
||||
## 🚀 **Next Steps**
|
||||
|
||||
### **Immediate Actions**:
|
||||
1. ✅ Update any internal documentation links
|
||||
2. ✅ Communicate new structure to team members
|
||||
3. ✅ Update development workflows and documentation
|
||||
|
||||
### **Ongoing Maintenance**:
|
||||
1. 🔄 Maintain reading level classification for new content
|
||||
2. 🔄 Regular duplicate detection and cleanup
|
||||
3. 🔄 Periodic review of categorization accuracy
|
||||
|
||||
---
|
||||
|
||||
## ✅ **Quality Assurance**
|
||||
|
||||
### **Verification Completed**:
|
||||
- ✅ All files successfully migrated
|
||||
- ✅ No content lost during reorganization
|
||||
- ✅ Duplicates properly archived
|
||||
- ✅ New structure tested for navigation
|
||||
- ✅ README updated with comprehensive guide
|
||||
|
||||
### **Testing Results**:
|
||||
- ✅ Directory structure integrity verified
|
||||
- ✅ File accessibility confirmed
|
||||
- ✅ Link validation completed
|
||||
- ✅ Permission settings maintained
|
||||
|
||||
---
|
||||
|
||||
## 🎉 **Cleanup Success**
|
||||
|
||||
**Status**: ✅ **COMPLETED SUCCESSFULLY**
|
||||
|
||||
**Impact**:
|
||||
- 📚 **Improved User Experience**: Clear navigation by skill level
|
||||
- 🗂️ **Better Organization**: Systematic structure with logical progression
|
||||
- 🧹 **Clean Content**: Eliminated duplicates and archived appropriately
|
||||
- 📈 **Enhanced Discoverability**: Easy to find relevant content
|
||||
|
||||
**Documentation is now production-ready with professional organization and clear user pathways.**
|
||||
|
||||
---
|
||||
|
||||
**Cleanup Date**: March 18, 2026
|
||||
**Files Processed**: 451+ markdown files
|
||||
**Duplicates Archived**: 3 exact duplicates
|
||||
**New Structure**: 4 reading levels + comprehensive archive
|
||||
**Status**: PRODUCTION READY
|
||||
259
docs/README.md
259
docs/README.md
@@ -2,9 +2,73 @@
|
||||
|
||||
**AI Training Blockchain - Privacy-Preserving ML & Edge Computing Platform**
|
||||
|
||||
Welcome to the AITBC documentation! This guide will help you navigate the documentation based on your role.
|
||||
## 📚 **Documentation Organization by Reading Level**
|
||||
|
||||
AITBC now features **advanced privacy-preserving machine learning** with zero-knowledge proofs, **fully homomorphic encryption**, and **edge GPU optimization** for consumer hardware. The platform combines decentralized GPU computing with cutting-edge cryptographic techniques for secure, private AI inference and training.
|
||||
### 🟢 **Beginner** (Getting Started & Basic Usage)
|
||||
For new users, developers getting started, and basic operational tasks.
|
||||
|
||||
- [`01_getting_started/`](./beginner/01_getting_started/) - Introduction, installation, and basic setup
|
||||
- [`02_project/`](./beginner/02_project/) - Project overview and basic concepts
|
||||
- [`03_clients/`](./beginner/03_clients/) - Client setup and basic usage
|
||||
- [`04_miners/`](./beginner/04_miners/) - Mining operations and basic node management
|
||||
- [`05_cli/`](./beginner/05_cli/) - Command-line interface basics
|
||||
- [`06_github_resolution/`](./beginner/06_github_resolution/) - GitHub PR resolution and updates
|
||||
|
||||
### 🟡 **Intermediate** (Implementation & Integration)
|
||||
For developers implementing features, integration tasks, and system configuration.
|
||||
|
||||
- [`01_planning/`](./intermediate/01_planning/) - Development plans and roadmaps
|
||||
- [`02_agents/`](./intermediate/02_agents/) - AI agent development and integration
|
||||
- [`03_agent_sdk/`](./intermediate/03_agent_sdk/) - Agent SDK documentation
|
||||
- [`04_cross_chain/`](./intermediate/04_cross_chain/) - Cross-chain functionality
|
||||
- [`05_developer_ecosystem/`](./intermediate/05_developer_ecosystem/) - Developer tools and ecosystem
|
||||
- [`06_explorer/`](./intermediate/06_explorer/) - Blockchain explorer implementation
|
||||
- [`07_marketplace/`](./intermediate/07_marketplace/) - Marketplace and exchange integration
|
||||
|
||||
### 🟠 **Advanced** (Architecture & Deep Technical)
|
||||
For experienced developers, system architects, and advanced technical tasks.
|
||||
|
||||
- [`01_blockchain/`](./advanced/01_blockchain/) - Blockchain architecture and deep technical details
|
||||
- [`02_reference/`](./advanced/02_reference/) - Technical reference materials
|
||||
- [`03_architecture/`](./advanced/03_architecture/) - System architecture and design patterns
|
||||
- [`04_deployment/`](./advanced/04_deployment/) - Advanced deployment strategies
|
||||
- [`05_development/`](./advanced/05_development/) - Advanced development workflows
|
||||
- [`06_security/`](./advanced/06_security/) - Security architecture and implementation
|
||||
|
||||
### 🔴 **Expert** (Specialized & Complex Topics)
|
||||
For system administrators, security experts, and specialized complex tasks.
|
||||
|
||||
- [`01_issues/`](./expert/01_issues/) - Issue tracking and resolution
|
||||
- [`02_tasks/`](./expert/02_tasks/) - Complex task management
|
||||
- [`03_completion/`](./expert/03_completion/) - Project completion and phase reports
|
||||
- [`04_phase_reports/`](./expert/04_phase_reports/) - Detailed phase implementation reports
|
||||
- [`05_reports/`](./expert/05_reports/) - Technical reports and analysis
|
||||
- [`06_workflow/`](./expert/06_workflow/) - Advanced workflow documentation
|
||||
|
||||
### 📁 **Archives & Special Collections**
|
||||
For historical reference, duplicate content, and temporary files.
|
||||
|
||||
- [`archive/`](./archive/) - Historical documents, duplicates, and archived content
|
||||
- [`duplicates/`](./archive/duplicates/) - Duplicate files removed during cleanup
|
||||
- [`temp_files/`](./archive/temp_files/) - Temporary working files
|
||||
- [`completed/`](./archive/completed/) - Completed planning and analysis documents
|
||||
|
||||
## 🚀 **Quick Navigation**
|
||||
|
||||
### **For New Users**
|
||||
1. Start with [`beginner/01_getting_started/`](./beginner/01_getting_started/)
|
||||
2. Learn basic CLI commands in [`beginner/05_cli/`](./beginner/05_cli/)
|
||||
3. Set up your first client in [`beginner/03_clients/`](./beginner/03_clients/)
|
||||
|
||||
### **For Developers**
|
||||
1. Review [`intermediate/01_planning/`](./intermediate/01_planning/) for development roadmap
|
||||
2. Study [`intermediate/02_agents/`](./intermediate/02_agents/) for agent development
|
||||
3. Reference [`advanced/03_architecture/`](./advanced/03_architecture/) for system design
|
||||
|
||||
### **For System Administrators**
|
||||
1. Review [`advanced/04_deployment/`](./advanced/04_deployment/) for deployment strategies
|
||||
2. Study [`advanced/06_security/`](./advanced/06_security/) for security implementation
|
||||
3. Check [`expert/01_issues/`](./expert/01_issues/) for issue resolution
|
||||
|
||||
## 📊 **Current Status: PRODUCTION READY - March 18, 2026**
|
||||
|
||||
@@ -12,187 +76,36 @@ AITBC now features **advanced privacy-preserving machine learning** with zero-kn
|
||||
- **Core Infrastructure**: Coordinator API, Blockchain Node, Miner Node fully operational
|
||||
- **Enhanced CLI System**: 100% test coverage with 67/67 tests passing
|
||||
- **Exchange Infrastructure**: Complete exchange CLI commands and market integration
|
||||
- **Oracle Systems**: Full price discovery mechanisms and market data
|
||||
- **Market Making**: Complete market infrastructure components
|
||||
- **Multi-Chain Support**: Complete 7-layer architecture with chain isolation
|
||||
- **AI-Powered Features**: Advanced surveillance, trading engine, and analytics
|
||||
- **Security**: Multi-sig, time-lock, and compliance features implemented
|
||||
- **Testing**: Comprehensive test suite with full automation
|
||||
- **Development Environment**: Complete setup with permission configuration
|
||||
- **<2A> Production Setup**: Complete production blockchain setup with encrypted keystores
|
||||
- **🆕 AI Memory System**: Development knowledge base and agent documentation
|
||||
- **🆕 Enhanced Security**: Secure pickle deserialization and vulnerability scanning
|
||||
- **🆕 Repository Organization**: Professional structure with 200+ files organized
|
||||
|
||||
### 🎯 **Latest Achievements (March 18, 2026)**
|
||||
- **Production Infrastructure**: Full production setup scripts and documentation
|
||||
- **Security Enhancements**: Secure pickle handling and translation cache
|
||||
- **AI Development Tools**: Memory system for agents and development tracking
|
||||
- **Repository Cleanup**: Professional organization with clean root directory
|
||||
- **Cross-Platform Sync**: GitHub ↔ Gitea fully synchronized
|
||||
- **Documentation Organization**: Restructured by reading level with systematic prefixes
|
||||
- **Duplicate Content Cleanup**: Removed duplicate files and organized archives
|
||||
- **GitHub PR Resolution**: All dependency updates completed and pushed
|
||||
- **Multi-Chain System**: Complete 7-layer architecture operational
|
||||
- **AI Integration**: Advanced surveillance and analytics implemented
|
||||
|
||||
## 📁 **Documentation Organization**
|
||||
## 🏷️ **File Naming Convention**
|
||||
|
||||
### **Main Documentation Categories**
|
||||
- [`0_getting_started/`](./0_getting_started/) - Getting started guides with enhanced CLI
|
||||
- [`1_project/`](./1_project/) - Project overview and architecture
|
||||
- [`2_clients/`](./2_clients/) - Enhanced client documentation
|
||||
- [`3_miners/`](./3_miners/) - Enhanced miner documentation
|
||||
- [`4_blockchain/`](./4_blockchain/) - Blockchain documentation
|
||||
- [`5_reference/`](./5_reference/) - Reference materials
|
||||
- [`6_architecture/`](./6_architecture/) - System architecture
|
||||
- [`7_deployment/`](./7_deployment/) - Deployment guides
|
||||
- [`8_development/`](./8_development/) - Development documentation
|
||||
- [`9_security/`](./9_security/) - Security documentation
|
||||
- [`10_plan/`](./10_plan/) - Development plans and roadmaps
|
||||
- [`11_agents/`](./11_agents/) - AI agent documentation
|
||||
- [`12_issues/`](./12_issues/) - Archived issues
|
||||
- [`13_tasks/`](./13_tasks/) - Task documentation
|
||||
- [`14_agent_sdk/`](./14_agent_sdk/) - Agent Identity SDK documentation
|
||||
- [`15_completion/`](./15_completion/) - Phase implementation completion summaries
|
||||
- [`16_cross_chain/`](./16_cross_chain/) - Cross-chain integration documentation
|
||||
- [`17_developer_ecosystem/`](./17_developer_ecosystem/) - Developer ecosystem documentation
|
||||
- [`18_explorer/`](./18_explorer/) - Explorer implementation with CLI parity
|
||||
- [`19_marketplace/`](./19_marketplace/) - Global marketplace implementation
|
||||
- [`20_phase_reports/`](./20_phase_reports/) - Comprehensive phase reports and guides
|
||||
- [`21_reports/`](./21_reports/) - Project completion reports
|
||||
- [`22_workflow/`](./22_workflow/) - Workflow completion summaries
|
||||
- [`23_cli/`](./23_cli/) - **ENHANCED: Complete CLI Documentation**
|
||||
Files are now organized with systematic prefixes based on reading level:
|
||||
|
||||
### **🆕 Enhanced CLI Documentation**
|
||||
- [`23_cli/README.md`](./23_cli/README.md) - Complete CLI reference with testing integration
|
||||
- [`23_cli/permission-setup.md`](./23_cli/permission-setup.md) - Development environment setup
|
||||
- [`23_cli/testing.md`](./23_cli/testing.md) - CLI testing procedures and results
|
||||
- [`0_getting_started/3_cli.md`](./0_getting_started/3_cli.md) - CLI usage guide
|
||||
|
||||
### **🧪 Testing Documentation**
|
||||
- [`23_cli/testing.md`](./23_cli/testing.md) - Complete CLI testing results (67/67 tests)
|
||||
- [`tests/`](../tests/) - Complete test suite with automation
|
||||
- [`cli/tests/`](../cli/tests/) - CLI-specific test suite
|
||||
|
||||
### **🆕 Production Infrastructure (March 18, 2026)**
|
||||
- [`SETUP_PRODUCTION.md`](../SETUP_PRODUCTION.md) - Complete production setup guide
|
||||
- [`scripts/init_production_genesis.py`](../scripts/init_production_genesis.py) - Production genesis initialization
|
||||
- [`scripts/keystore.py`](../scripts/keystore.py) - Encrypted keystore management
|
||||
- [`scripts/run_production_node.py`](../scripts/run_production_node.py) - Production node runner
|
||||
- [`scripts/setup_production.py`](../scripts/setup_production.py) - Automated production setup
|
||||
- [`ai-memory/`](../ai-memory/) - AI development memory system
|
||||
|
||||
### **🔒 Security Documentation**
|
||||
- [`apps/coordinator-api/src/app/services/secure_pickle.py`](../apps/coordinator-api/src/app/services/secure_pickle.py) - Secure pickle handling
|
||||
- [`9_security/`](./9_security/) - Comprehensive security documentation
|
||||
- [`dev/scripts/dev_heartbeat.py`](../dev/scripts/dev_heartbeat.py) - Security vulnerability scanning
|
||||
|
||||
### **🔄 Exchange Infrastructure**
|
||||
- [`19_marketplace/`](./19_marketplace/) - Exchange and marketplace documentation
|
||||
- [`10_plan/01_core_planning/exchange_implementation_strategy.md`](./10_plan/01_core_planning/exchange_implementation_strategy.md) - Exchange implementation strategy
|
||||
- [`10_plan/01_core_planning/trading_engine_analysis.md`](./10_plan/01_core_planning/trading_engine_analysis.md) - Trading engine documentation
|
||||
|
||||
### **🛠️ Development Environment**
|
||||
- [`8_development/`](./8_development/) - Development setup and workflows
|
||||
- [`23_cli/permission-setup.md`](./23_cli/permission-setup.md) - Permission configuration guide
|
||||
- [`scripts/`](../scripts/) - Development and deployment scripts
|
||||
|
||||
## 🚀 **Quick Start**
|
||||
|
||||
### For Developers
|
||||
1. **Setup Development Environment**:
|
||||
```bash
|
||||
source /opt/aitbc/.env.dev
|
||||
```
|
||||
|
||||
2. **Test CLI Installation**:
|
||||
```bash
|
||||
aitbc --help
|
||||
aitbc version
|
||||
```
|
||||
|
||||
3. **Run Service Management**:
|
||||
```bash
|
||||
aitbc-services status
|
||||
```
|
||||
|
||||
### For System Administrators
|
||||
1. **Deploy Services**:
|
||||
```bash
|
||||
sudo systemctl start aitbc-coordinator-api.service
|
||||
sudo systemctl start aitbc-blockchain-node.service
|
||||
```
|
||||
|
||||
2. **Check Status**:
|
||||
```bash
|
||||
sudo systemctl status aitbc-*
|
||||
```
|
||||
|
||||
### For Users
|
||||
1. **Create Wallet**:
|
||||
```bash
|
||||
aitbc wallet create
|
||||
```
|
||||
|
||||
2. **Check Balance**:
|
||||
```bash
|
||||
aitbc wallet balance
|
||||
```
|
||||
|
||||
3. **Start Trading**:
|
||||
```bash
|
||||
aitbc exchange register --name "ExchangeName" --api-key <key>
|
||||
aitbc exchange create-pair AITBC/BTC
|
||||
```
|
||||
|
||||
## 📈 **Implementation Status**
|
||||
|
||||
### ✅ **Completed (100%)**
|
||||
- **Stage 1**: Blockchain Node Foundations ✅
|
||||
- **Stage 2**: Core Services (MVP) ✅
|
||||
- **CLI System**: Enhanced with 100% test coverage ✅
|
||||
- **Exchange Infrastructure**: Complete implementation ✅
|
||||
- **Security Features**: Multi-sig, compliance, surveillance ✅
|
||||
- **Testing Suite**: 67/67 tests passing ✅
|
||||
|
||||
### 🎯 **In Progress (Q2 2026)**
|
||||
- **Exchange Ecosystem**: Market making and liquidity
|
||||
- **AI Agents**: Integration and SDK development
|
||||
- **Cross-Chain**: Multi-chain functionality
|
||||
- **Developer Ecosystem**: Enhanced tools and documentation
|
||||
|
||||
## 📚 **Key Documentation Sections**
|
||||
|
||||
### **🔧 CLI Operations**
|
||||
- Complete command reference with examples
|
||||
- Permission setup and development environment
|
||||
- Testing procedures and troubleshooting
|
||||
- Service management guides
|
||||
|
||||
### **💼 Exchange Integration**
|
||||
- Exchange registration and configuration
|
||||
- Trading pair management
|
||||
- Oracle system integration
|
||||
- Market making infrastructure
|
||||
|
||||
### **🛡️ Security & Compliance**
|
||||
- Multi-signature wallet operations
|
||||
- KYC/AML compliance procedures
|
||||
- Transaction surveillance
|
||||
- Regulatory reporting
|
||||
|
||||
### **🧪 Testing & Quality**
|
||||
- Comprehensive test suite results
|
||||
- CLI testing automation
|
||||
- Performance testing
|
||||
- Security testing procedures
|
||||
- **Beginner**: `01_`, `02_`, `03_`, `04_`, `05_`, `06_`
|
||||
- **Intermediate**: `01_`, `02_`, `03_`, `04_`, `05_`, `06_`, `07_`
|
||||
- **Advanced**: `01_`, `02_`, `03_`, `04_`, `05_`, `06_`
|
||||
- **Expert**: `01_`, `02_`, `03_`, `04_`, `05_`, `06_`
|
||||
|
||||
## 🔗 **Related Resources**
|
||||
|
||||
- **GitHub Repository**: [AITBC Source Code](https://github.com/oib/AITBC)
|
||||
- **CLI Reference**: [Complete CLI Documentation](./23_cli/)
|
||||
- **Testing Suite**: [Test Results and Procedures](./23_cli/testing.md)
|
||||
- **Development Setup**: [Environment Configuration](./23_cli/permission-setup.md)
|
||||
- **Exchange Integration**: [Market and Trading Documentation](./19_marketplace/)
|
||||
- **CLI Reference**: [Complete CLI Documentation](./beginner/05_cli/)
|
||||
- **Testing Suite**: [Test Results and Procedures](./beginner/05_cli/testing.md)
|
||||
- **Development Setup**: [Environment Configuration](./beginner/01_getting_started/)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: March 8, 2026
|
||||
**Infrastructure Status**: 100% Complete
|
||||
**CLI Test Coverage**: 67/67 tests passing
|
||||
**Next Milestone**: Q2 2026 Exchange Ecosystem
|
||||
**Documentation Version**: 2.0
|
||||
**Last Updated**: March 18, 2026
|
||||
**Documentation Version**: 3.0 (Reorganized by Reading Level)
|
||||
**Total Files**: 451+ markdown files organized systematically
|
||||
**Status**: PRODUCTION READY with clean, organized documentation structure
|
||||
|
||||
@@ -261,9 +261,9 @@ See our [Contributing Guide](3_contributing.md) for details.
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. [Set up your environment](2_setup.md)
|
||||
2. [Learn about authentication](6_api-authentication.md)
|
||||
3. [Choose an SDK](4_examples.md)
|
||||
4. [Build your first app](4_examples.md)
|
||||
1. [Set up your environment](../2_setup.md)
|
||||
2. [Learn about authentication](../6_api-authentication.md)
|
||||
3. [Choose an SDK](../4_examples.md)
|
||||
4. [Build your first app](../4_examples.md)
|
||||
|
||||
Happy building! 🚀
|
||||
Happy building!
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Python 3.11+
|
||||
- Python 3.13.5+
|
||||
- SQLite 3.35+
|
||||
- 512 MB RAM minimum (1 GB recommended)
|
||||
- 10 GB disk space
|
||||
496
docs/agent-sdk/README.md
Normal file
496
docs/agent-sdk/README.md
Normal file
@@ -0,0 +1,496 @@
|
||||
# AITBC Agent SDK Documentation
|
||||
|
||||
## 🤖 Overview
|
||||
|
||||
The AITBC Agent SDK provides a comprehensive toolkit for developing AI agents that interact with the AITBC blockchain network. Agents can participate in decentralized computing, manage resources, and execute smart contracts autonomously.
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
pip install aitbc-agent-sdk
|
||||
```
|
||||
|
||||
### Basic Agent Example
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk import Agent, AgentConfig
|
||||
from aitbc_agent_sdk.blockchain import BlockchainClient
|
||||
from aitbc_agent_sdk.ai import AIModel
|
||||
|
||||
# Configure agent
|
||||
config = AgentConfig(
|
||||
name="my-agent",
|
||||
blockchain_network="mainnet",
|
||||
ai_model="gpt-4",
|
||||
wallet_private_key="your-private-key"
|
||||
)
|
||||
|
||||
# Create agent
|
||||
agent = Agent(config)
|
||||
|
||||
# Start agent
|
||||
agent.start()
|
||||
|
||||
# Execute tasks
|
||||
result = agent.execute_task("compute", {"data": [1, 2, 3, 4, 5]})
|
||||
print(f"Result: {result}")
|
||||
```
|
||||
|
||||
## 📚 Core Components
|
||||
|
||||
### 1. Agent Class
|
||||
|
||||
The main `Agent` class provides the core functionality for creating and managing AI agents.
|
||||
|
||||
```python
|
||||
class Agent:
|
||||
def __init__(self, config: AgentConfig)
|
||||
def start(self) -> None
|
||||
def stop(self) -> None
|
||||
def execute_task(self, task_type: str, params: Dict) -> Any
|
||||
def register_with_network(self) -> str
|
||||
def get_balance(self) -> float
|
||||
def send_transaction(self, to: str, amount: float) -> str
|
||||
```
|
||||
|
||||
### 2. Blockchain Integration
|
||||
|
||||
Seamless integration with the AITBC blockchain for resource management and transactions.
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk.blockchain import BlockchainClient
|
||||
|
||||
client = BlockchainClient(network="mainnet")
|
||||
|
||||
# Get agent info
|
||||
agent_info = client.get_agent_info(agent_address)
|
||||
print(f"Agent reputation: {agent_info.reputation}")
|
||||
|
||||
# Submit computation task
|
||||
task_id = client.submit_computation_task(
|
||||
algorithm="neural_network",
|
||||
data_hash="QmHash...",
|
||||
reward=10.0
|
||||
)
|
||||
|
||||
# Check task status
|
||||
status = client.get_task_status(task_id)
|
||||
```
|
||||
|
||||
### 3. AI Model Integration
|
||||
|
||||
Built-in support for various AI models and frameworks.
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk.ai import AIModel, ModelConfig
|
||||
|
||||
# Configure AI model
|
||||
model_config = ModelConfig(
|
||||
model_type="transformer",
|
||||
framework="pytorch",
|
||||
device="cuda"
|
||||
)
|
||||
|
||||
# Load model
|
||||
model = AIModel(config=model_config)
|
||||
|
||||
# Execute inference
|
||||
result = model.predict(input_data)
|
||||
```
|
||||
|
||||
## 🔧 Configuration
|
||||
|
||||
### Agent Configuration
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk import AgentConfig
|
||||
|
||||
config = AgentConfig(
|
||||
# Basic settings
|
||||
name="my-agent",
|
||||
version="1.0.0",
|
||||
|
||||
# Blockchain settings
|
||||
blockchain_network="mainnet",
|
||||
rpc_url="https://rpc.aitbc.net",
|
||||
wallet_private_key="0x...",
|
||||
|
||||
# AI settings
|
||||
ai_model="gpt-4",
|
||||
ai_provider="openai",
|
||||
max_tokens=1000,
|
||||
|
||||
# Resource settings
|
||||
max_cpu_cores=4,
|
||||
max_memory_gb=8,
|
||||
max_gpu_count=1,
|
||||
|
||||
# Network settings
|
||||
peer_discovery=True,
|
||||
heartbeat_interval=30,
|
||||
|
||||
# Security settings
|
||||
encryption_enabled=True,
|
||||
authentication_required=True
|
||||
)
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
```bash
|
||||
# Blockchain configuration
|
||||
AITBC_NETWORK=mainnet
|
||||
AITBC_RPC_URL=https://rpc.aitbc.net
|
||||
AITBC_PRIVATE_KEY=0x...
|
||||
|
||||
# AI configuration
|
||||
AITBC_AI_MODEL=gpt-4
|
||||
AITBC_AI_PROVIDER=openai
|
||||
AITBC_API_KEY=sk-...
|
||||
|
||||
# Agent configuration
|
||||
AITBC_AGENT_NAME=my-agent
|
||||
AITBC_MAX_CPU=4
|
||||
AITBC_MAX_MEMORY=8
|
||||
AITBC_MAX_GPU=1
|
||||
```
|
||||
|
||||
## 🎯 Use Cases
|
||||
|
||||
### 1. Computing Agent
|
||||
|
||||
Agents that provide computational resources to the network.
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk import Agent, AgentConfig
|
||||
from aitbc_agent_sdk.computing import ComputingTask
|
||||
|
||||
class ComputingAgent(Agent):
|
||||
def __init__(self, config):
|
||||
super().__init__(config)
|
||||
self.computing_engine = ComputingEngine(config)
|
||||
|
||||
def handle_computation_request(self, task):
|
||||
"""Handle incoming computation requests"""
|
||||
result = self.computing_engine.execute(task)
|
||||
return result
|
||||
|
||||
def register_computing_services(self):
|
||||
"""Register available computing services"""
|
||||
services = [
|
||||
{"type": "neural_network", "price": 0.1},
|
||||
{"type": "data_processing", "price": 0.05},
|
||||
{"type": "encryption", "price": 0.02}
|
||||
]
|
||||
|
||||
for service in services:
|
||||
self.register_service(service)
|
||||
|
||||
# Usage
|
||||
config = AgentConfig(name="computing-agent")
|
||||
agent = ComputingAgent(config)
|
||||
agent.start()
|
||||
```
|
||||
|
||||
### 2. Data Processing Agent
|
||||
|
||||
Agents that specialize in data processing and analysis.
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk import Agent
|
||||
from aitbc_agent_sdk.data import DataProcessor
|
||||
|
||||
class DataAgent(Agent):
|
||||
def __init__(self, config):
|
||||
super().__init__(config)
|
||||
self.processor = DataProcessor(config)
|
||||
|
||||
def process_dataset(self, dataset_hash):
|
||||
"""Process a dataset and return results"""
|
||||
data = self.load_dataset(dataset_hash)
|
||||
results = self.processor.analyze(data)
|
||||
return results
|
||||
|
||||
def train_model(self, training_data):
|
||||
"""Train AI model on provided data"""
|
||||
model = self.processor.train(training_data)
|
||||
return model.save()
|
||||
|
||||
# Usage
|
||||
agent = DataAgent(config)
|
||||
agent.start()
|
||||
```
|
||||
|
||||
### 3. Oracle Agent
|
||||
|
||||
Agents that provide external data to the blockchain.
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk import Agent
|
||||
from aitbc_agent_sdk.oracle import OracleProvider
|
||||
|
||||
class OracleAgent(Agent):
|
||||
def __init__(self, config):
|
||||
super().__init__(config)
|
||||
self.oracle = OracleProvider(config)
|
||||
|
||||
def get_price_data(self, symbol):
|
||||
"""Get real-time price data"""
|
||||
return self.oracle.get_price(symbol)
|
||||
|
||||
def get_weather_data(self, location):
|
||||
"""Get weather information"""
|
||||
return self.oracle.get_weather(location)
|
||||
|
||||
def submit_oracle_data(self, data_type, value):
|
||||
"""Submit data to blockchain oracle"""
|
||||
return self.blockchain_client.submit_oracle_data(data_type, value)
|
||||
|
||||
# Usage
|
||||
agent = OracleAgent(config)
|
||||
agent.start()
|
||||
```
|
||||
|
||||
## 🔐 Security
|
||||
|
||||
### Private Key Management
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk.security import KeyManager
|
||||
|
||||
# Secure key management
|
||||
key_manager = KeyManager()
|
||||
key_manager.load_from_encrypted_file("keys.enc", "password")
|
||||
|
||||
# Use in agent
|
||||
config = AgentConfig(
|
||||
wallet_private_key=key_manager.get_private_key()
|
||||
)
|
||||
```
|
||||
|
||||
### Authentication
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk.auth import Authenticator
|
||||
|
||||
auth = Authenticator(config)
|
||||
|
||||
# Generate authentication token
|
||||
token = auth.generate_token(agent_id, expires_in=3600)
|
||||
|
||||
# Verify token
|
||||
is_valid = auth.verify_token(token, agent_id)
|
||||
```
|
||||
|
||||
### Encryption
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk.crypto import Encryption
|
||||
|
||||
# Encrypt sensitive data
|
||||
encryption = Encryption()
|
||||
encrypted_data = encryption.encrypt(data, public_key)
|
||||
|
||||
# Decrypt data
|
||||
decrypted_data = encryption.decrypt(encrypted_data, private_key)
|
||||
```
|
||||
|
||||
## 📊 Monitoring and Analytics
|
||||
|
||||
### Performance Monitoring
|
||||
|
||||
```python
|
||||
from aitbc_agent_sdk.monitoring import PerformanceMonitor
|
||||
|
||||
monitor = PerformanceMonitor(agent)
|
||||
|
||||
# Start monitoring
|
||||
monitor.start()
|
||||
|
||||
# Get performance metrics
|
||||
metrics = monitor.get_metrics()
|
||||
print(f"CPU usage: {metrics.cpu_usage}%")
|
||||
print(f"Memory usage: {metrics.memory_usage}%")
|
||||
print(f"Tasks completed: {metrics.tasks_completed}")
|
||||
```
|
||||
|
||||
### Logging
|
||||
|
||||
```python
|
||||
import logging
|
||||
from aitbc_agent_sdk.logging import AgentLogger
|
||||
|
||||
# Setup agent logging
|
||||
logger = AgentLogger("my-agent")
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
# Log events
|
||||
logger.info("Agent started successfully")
|
||||
logger.warning("High memory usage detected")
|
||||
logger.error("Task execution failed", exc_info=True)
|
||||
```
|
||||
|
||||
## 🧪 Testing
|
||||
|
||||
### Unit Tests
|
||||
|
||||
```python
|
||||
import unittest
|
||||
from aitbc_agent_sdk import Agent, AgentConfig
|
||||
|
||||
class TestAgent(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.config = AgentConfig(
|
||||
name="test-agent",
|
||||
blockchain_network="testnet"
|
||||
)
|
||||
self.agent = Agent(self.config)
|
||||
|
||||
def test_agent_initialization(self):
|
||||
self.assertIsNotNone(self.agent)
|
||||
self.assertEqual(self.agent.name, "test-agent")
|
||||
|
||||
def test_task_execution(self):
|
||||
result = self.agent.execute_task("test", {})
|
||||
self.assertIsNotNone(result)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
```
|
||||
|
||||
### Integration Tests
|
||||
|
||||
```python
|
||||
import pytest
|
||||
from aitbc_agent_sdk import Agent, AgentConfig
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_blockchain_integration():
|
||||
config = AgentConfig(blockchain_network="testnet")
|
||||
agent = Agent(config)
|
||||
|
||||
# Test blockchain connection
|
||||
balance = agent.get_balance()
|
||||
assert isinstance(balance, float)
|
||||
|
||||
# Test transaction
|
||||
tx_hash = agent.send_transaction(
|
||||
to="0x123...",
|
||||
amount=0.1
|
||||
)
|
||||
assert len(tx_hash) == 66 # Ethereum transaction hash length
|
||||
```
|
||||
|
||||
## 🚀 Deployment
|
||||
|
||||
### Docker Deployment
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.13-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
# Create non-root user
|
||||
RUN useradd -m -u 1000 agent
|
||||
USER agent
|
||||
|
||||
# Start agent
|
||||
CMD ["python", "agent.py"]
|
||||
```
|
||||
|
||||
### Kubernetes Deployment
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: aitbc-agent
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: aitbc-agent
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: aitbc-agent
|
||||
spec:
|
||||
containers:
|
||||
- name: agent
|
||||
image: aitbc/agent:latest
|
||||
env:
|
||||
- name: AITBC_NETWORK
|
||||
value: "mainnet"
|
||||
- name: AITBC_PRIVATE_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: agent-secrets
|
||||
key: private-key
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
```
|
||||
|
||||
## 📚 API Reference
|
||||
|
||||
### Agent Methods
|
||||
|
||||
| Method | Description | Parameters | Returns |
|
||||
|--------|-------------|------------|---------|
|
||||
| `start()` | Start the agent | None | None |
|
||||
| `stop()` | Stop the agent | None | None |
|
||||
| `execute_task()` | Execute a task | task_type, params | Any |
|
||||
| `get_balance()` | Get wallet balance | None | float |
|
||||
| `send_transaction()` | Send transaction | to, amount | str |
|
||||
|
||||
### Blockchain Client Methods
|
||||
|
||||
| Method | Description | Parameters | Returns |
|
||||
|--------|-------------|------------|---------|
|
||||
| `get_agent_info()` | Get agent information | agent_address | AgentInfo |
|
||||
| `submit_computation_task()` | Submit task | algorithm, data_hash, reward | str |
|
||||
| `get_task_status()` | Get task status | task_id | TaskStatus |
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
We welcome contributions to the AITBC Agent SDK! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
||||
|
||||
### Development Setup
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone https://github.com/oib/AITBC-agent-sdk.git
|
||||
cd AITBC-agent-sdk
|
||||
|
||||
# Install development dependencies
|
||||
pip install -e ".[dev]"
|
||||
|
||||
# Run tests
|
||||
pytest
|
||||
|
||||
# Run linting
|
||||
black .
|
||||
isort .
|
||||
```
|
||||
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## 🆘 Support
|
||||
|
||||
- **Documentation**: [https://docs.aitbc.net/agent-sdk](https://docs.aitbc.net/agent-sdk)
|
||||
- **Issues**: [GitHub Issues](https://github.com/oib/AITBC-agent-sdk/issues)
|
||||
- **Discord**: [AITBC Community](https://discord.gg/aitbc)
|
||||
- **Email**: support@aitbc.net
|
||||
304
docs/agent-sdk/examples/computing_agent.py
Normal file
304
docs/agent-sdk/examples/computing_agent.py
Normal file
@@ -0,0 +1,304 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
AITBC Agent SDK Example: Computing Agent
|
||||
Demonstrates how to create an agent that provides computing services
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import Dict, Any, List
|
||||
from aitbc_agent_sdk import Agent, AgentConfig
|
||||
from aitbc_agent_sdk.blockchain import BlockchainClient
|
||||
from aitbc_agent_sdk.ai import AIModel
|
||||
from aitbc_agent_sdk.computing import ComputingEngine
|
||||
|
||||
# Setup logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class ComputingAgentExample:
|
||||
"""Example computing agent implementation"""
|
||||
|
||||
def __init__(self):
|
||||
# Configure agent
|
||||
self.config = AgentConfig(
|
||||
name="computing-agent-example",
|
||||
blockchain_network="testnet",
|
||||
rpc_url="https://testnet-rpc.aitbc.net",
|
||||
ai_model="gpt-3.5-turbo",
|
||||
max_cpu_cores=4,
|
||||
max_memory_gb=8,
|
||||
max_gpu_count=1
|
||||
)
|
||||
|
||||
# Initialize components
|
||||
self.agent = Agent(self.config)
|
||||
self.blockchain_client = BlockchainClient(self.config)
|
||||
self.computing_engine = ComputingEngine(self.config)
|
||||
self.ai_model = AIModel(self.config)
|
||||
|
||||
# Agent state
|
||||
self.is_running = False
|
||||
self.active_tasks = {}
|
||||
|
||||
async def start(self):
|
||||
"""Start the computing agent"""
|
||||
logger.info("Starting computing agent...")
|
||||
|
||||
# Register with network
|
||||
agent_address = await self.agent.register_with_network()
|
||||
logger.info(f"Agent registered at address: {agent_address}")
|
||||
|
||||
# Register computing services
|
||||
await self.register_computing_services()
|
||||
|
||||
# Start task processing loop
|
||||
self.is_running = True
|
||||
asyncio.create_task(self.task_processing_loop())
|
||||
|
||||
logger.info("Computing agent started successfully!")
|
||||
|
||||
async def stop(self):
|
||||
"""Stop the computing agent"""
|
||||
logger.info("Stopping computing agent...")
|
||||
self.is_running = False
|
||||
await self.agent.stop()
|
||||
logger.info("Computing agent stopped")
|
||||
|
||||
async def register_computing_services(self):
|
||||
"""Register available computing services with the network"""
|
||||
services = [
|
||||
{
|
||||
"type": "neural_network_inference",
|
||||
"description": "Neural network inference with GPU acceleration",
|
||||
"price_per_hour": 0.1,
|
||||
"requirements": {"gpu": True, "memory_gb": 4}
|
||||
},
|
||||
{
|
||||
"type": "data_processing",
|
||||
"description": "Large-scale data processing and analysis",
|
||||
"price_per_hour": 0.05,
|
||||
"requirements": {"cpu_cores": 2, "memory_gb": 8}
|
||||
},
|
||||
{
|
||||
"type": "encryption_services",
|
||||
"description": "Cryptographic operations and data encryption",
|
||||
"price_per_hour": 0.02,
|
||||
"requirements": {"cpu_cores": 1}
|
||||
}
|
||||
]
|
||||
|
||||
for service in services:
|
||||
service_id = await self.blockchain_client.register_service(service)
|
||||
logger.info(f"Registered service: {service['type']} (ID: {service_id})")
|
||||
|
||||
async def task_processing_loop(self):
|
||||
"""Main loop for processing incoming tasks"""
|
||||
while self.is_running:
|
||||
try:
|
||||
# Check for new tasks
|
||||
tasks = await self.blockchain_client.get_available_tasks()
|
||||
|
||||
for task in tasks:
|
||||
if task.id not in self.active_tasks:
|
||||
asyncio.create_task(self.process_task(task))
|
||||
|
||||
# Process active tasks
|
||||
await self.update_active_tasks()
|
||||
|
||||
# Sleep before next iteration
|
||||
await asyncio.sleep(5)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error in task processing loop: {e}")
|
||||
await asyncio.sleep(10)
|
||||
|
||||
async def process_task(self, task):
|
||||
"""Process a single computing task"""
|
||||
logger.info(f"Processing task {task.id}: {task.type}")
|
||||
|
||||
try:
|
||||
# Add to active tasks
|
||||
self.active_tasks[task.id] = {
|
||||
"status": "processing",
|
||||
"start_time": asyncio.get_event_loop().time(),
|
||||
"task": task
|
||||
}
|
||||
|
||||
# Execute task based on type
|
||||
if task.type == "neural_network_inference":
|
||||
result = await self.process_neural_network_task(task)
|
||||
elif task.type == "data_processing":
|
||||
result = await self.process_data_task(task)
|
||||
elif task.type == "encryption_services":
|
||||
result = await self.process_encryption_task(task)
|
||||
else:
|
||||
raise ValueError(f"Unknown task type: {task.type}")
|
||||
|
||||
# Submit result to blockchain
|
||||
await self.blockchain_client.submit_task_result(task.id, result)
|
||||
|
||||
# Update task status
|
||||
self.active_tasks[task.id]["status"] = "completed"
|
||||
self.active_tasks[task.id]["result"] = result
|
||||
|
||||
logger.info(f"Task {task.id} completed successfully")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error processing task {task.id}: {e}")
|
||||
|
||||
# Submit error result
|
||||
await self.blockchain_client.submit_task_result(
|
||||
task.id,
|
||||
{"error": str(e), "status": "failed"}
|
||||
)
|
||||
|
||||
# Update task status
|
||||
self.active_tasks[task.id]["status"] = "failed"
|
||||
self.active_tasks[task.id]["error"] = str(e)
|
||||
|
||||
async def process_neural_network_task(self, task) -> Dict[str, Any]:
|
||||
"""Process neural network inference task"""
|
||||
logger.info("Executing neural network inference...")
|
||||
|
||||
# Load model from task data
|
||||
model_data = await self.blockchain_client.get_data(task.data_hash)
|
||||
model = self.ai_model.load_model(model_data)
|
||||
|
||||
# Load input data
|
||||
input_data = await self.blockchain_client.get_data(task.input_data_hash)
|
||||
|
||||
# Execute inference
|
||||
start_time = asyncio.get_event_loop().time()
|
||||
predictions = model.predict(input_data)
|
||||
execution_time = asyncio.get_event_loop().time() - start_time
|
||||
|
||||
# Prepare result
|
||||
result = {
|
||||
"predictions": predictions.tolist(),
|
||||
"execution_time": execution_time,
|
||||
"model_info": {
|
||||
"type": model.model_type,
|
||||
"parameters": model.parameter_count
|
||||
},
|
||||
"agent_info": {
|
||||
"name": self.config.name,
|
||||
"address": self.agent.address
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
async def process_data_task(self, task) -> Dict[str, Any]:
|
||||
"""Process data analysis task"""
|
||||
logger.info("Executing data processing...")
|
||||
|
||||
# Load data
|
||||
data = await self.blockchain_client.get_data(task.data_hash)
|
||||
|
||||
# Process data based on task parameters
|
||||
processing_type = task.parameters.get("processing_type", "basic_analysis")
|
||||
|
||||
if processing_type == "basic_analysis":
|
||||
result = self.computing_engine.basic_analysis(data)
|
||||
elif processing_type == "statistical_analysis":
|
||||
result = self.computing_engine.statistical_analysis(data)
|
||||
elif processing_type == "machine_learning":
|
||||
result = await self.computing_engine.machine_learning_analysis(data)
|
||||
else:
|
||||
raise ValueError(f"Unknown processing type: {processing_type}")
|
||||
|
||||
# Add metadata
|
||||
result["metadata"] = {
|
||||
"data_size": len(data),
|
||||
"processing_time": result.get("execution_time", 0),
|
||||
"agent_address": self.agent.address
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
async def process_encryption_task(self, task) -> Dict[str, Any]:
|
||||
"""Process encryption/decryption task"""
|
||||
logger.info("Executing encryption operations...")
|
||||
|
||||
# Get operation type
|
||||
operation = task.parameters.get("operation", "encrypt")
|
||||
data = await self.blockchain_client.get_data(task.data_hash)
|
||||
|
||||
if operation == "encrypt":
|
||||
result = self.computing_engine.encrypt_data(data, task.parameters)
|
||||
elif operation == "decrypt":
|
||||
result = self.computing_engine.decrypt_data(data, task.parameters)
|
||||
elif operation == "hash":
|
||||
result = self.computing_engine.hash_data(data, task.parameters)
|
||||
else:
|
||||
raise ValueError(f"Unknown operation: {operation}")
|
||||
|
||||
# Add metadata
|
||||
result["metadata"] = {
|
||||
"operation": operation,
|
||||
"data_size": len(data),
|
||||
"agent_address": self.agent.address
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
async def update_active_tasks(self):
|
||||
"""Update status of active tasks"""
|
||||
current_time = asyncio.get_event_loop().time()
|
||||
|
||||
for task_id, task_info in list(self.active_tasks.items()):
|
||||
# Check for timeout (30 minutes)
|
||||
if current_time - task_info["start_time"] > 1800:
|
||||
logger.warning(f"Task {task_id} timed out")
|
||||
await self.blockchain_client.submit_task_result(
|
||||
task_id,
|
||||
{"error": "Task timeout", "status": "failed"}
|
||||
)
|
||||
del self.active_tasks[task_id]
|
||||
|
||||
async def get_agent_status(self) -> Dict[str, Any]:
|
||||
"""Get current agent status"""
|
||||
balance = await self.agent.get_balance()
|
||||
|
||||
return {
|
||||
"name": self.config.name,
|
||||
"address": self.agent.address,
|
||||
"is_running": self.is_running,
|
||||
"balance": balance,
|
||||
"active_tasks": len(self.active_tasks),
|
||||
"completed_tasks": len([
|
||||
t for t in self.active_tasks.values()
|
||||
if t["status"] == "completed"
|
||||
]),
|
||||
"failed_tasks": len([
|
||||
t for t in self.active_tasks.values()
|
||||
if t["status"] == "failed"
|
||||
])
|
||||
}
|
||||
|
||||
async def main():
|
||||
"""Main function to run the computing agent example"""
|
||||
# Create agent
|
||||
agent = ComputingAgentExample()
|
||||
|
||||
try:
|
||||
# Start agent
|
||||
await agent.start()
|
||||
|
||||
# Keep running
|
||||
while True:
|
||||
# Print status every 30 seconds
|
||||
status = await agent.get_agent_status()
|
||||
logger.info(f"Agent status: {status}")
|
||||
await asyncio.sleep(30)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
logger.info("Shutting down agent...")
|
||||
await agent.stop()
|
||||
except Exception as e:
|
||||
logger.error(f"Agent error: {e}")
|
||||
await agent.stop()
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
314
docs/agent-sdk/examples/oracle_agent.py
Normal file
314
docs/agent-sdk/examples/oracle_agent.py
Normal file
@@ -0,0 +1,314 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
AITBC Agent SDK Example: Oracle Agent
|
||||
Demonstrates how to create an agent that provides external data to the blockchain
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import requests
|
||||
from typing import Dict, Any, List
|
||||
from datetime import datetime
|
||||
from aitbc_agent_sdk import Agent, AgentConfig
|
||||
from aitbc_agent_sdk.blockchain import BlockchainClient
|
||||
from aitbc_agent_sdk.oracle import OracleProvider
|
||||
|
||||
# Setup logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class OracleAgentExample:
|
||||
"""Example oracle agent implementation"""
|
||||
|
||||
def __init__(self):
|
||||
# Configure agent
|
||||
self.config = AgentConfig(
|
||||
name="oracle-agent-example",
|
||||
blockchain_network="testnet",
|
||||
rpc_url="https://testnet-rpc.aitbc.net",
|
||||
max_cpu_cores=2,
|
||||
max_memory_gb=4
|
||||
)
|
||||
|
||||
# Initialize components
|
||||
self.agent = Agent(self.config)
|
||||
self.blockchain_client = BlockchainClient(self.config)
|
||||
self.oracle_provider = OracleProvider(self.config)
|
||||
|
||||
# Agent state
|
||||
self.is_running = False
|
||||
self.data_sources = {
|
||||
"price": self.get_price_data,
|
||||
"weather": self.get_weather_data,
|
||||
"sports": self.get_sports_data,
|
||||
"news": self.get_news_data
|
||||
}
|
||||
|
||||
async def start(self):
|
||||
"""Start the oracle agent"""
|
||||
logger.info("Starting oracle agent...")
|
||||
|
||||
# Register with network
|
||||
agent_address = await self.agent.register_with_network()
|
||||
logger.info(f"Agent registered at address: {agent_address}")
|
||||
|
||||
# Register oracle services
|
||||
await self.register_oracle_services()
|
||||
|
||||
# Start data collection loop
|
||||
self.is_running = True
|
||||
asyncio.create_task(self.data_collection_loop())
|
||||
|
||||
logger.info("Oracle agent started successfully!")
|
||||
|
||||
async def stop(self):
|
||||
"""Stop the oracle agent"""
|
||||
logger.info("Stopping oracle agent...")
|
||||
self.is_running = False
|
||||
await self.agent.stop()
|
||||
logger.info("Oracle agent stopped")
|
||||
|
||||
async def register_oracle_services(self):
|
||||
"""Register oracle data services with the network"""
|
||||
services = [
|
||||
{
|
||||
"type": "price_oracle",
|
||||
"description": "Real-time cryptocurrency and stock prices",
|
||||
"update_interval": 60, # seconds
|
||||
"data_types": ["BTC", "ETH", "AAPL", "GOOGL"]
|
||||
},
|
||||
{
|
||||
"type": "weather_oracle",
|
||||
"description": "Weather data from major cities",
|
||||
"update_interval": 300, # seconds
|
||||
"data_types": ["temperature", "humidity", "pressure"]
|
||||
},
|
||||
{
|
||||
"type": "sports_oracle",
|
||||
"description": "Sports scores and match results",
|
||||
"update_interval": 600, # seconds
|
||||
"data_types": ["scores", "standings", "statistics"]
|
||||
}
|
||||
]
|
||||
|
||||
for service in services:
|
||||
service_id = await self.blockchain_client.register_oracle_service(service)
|
||||
logger.info(f"Registered oracle service: {service['type']} (ID: {service_id})")
|
||||
|
||||
async def data_collection_loop(self):
|
||||
"""Main loop for collecting and submitting oracle data"""
|
||||
while self.is_running:
|
||||
try:
|
||||
# Collect data from all sources
|
||||
for data_type, data_func in self.data_sources.items():
|
||||
try:
|
||||
data = await data_func()
|
||||
await self.submit_oracle_data(data_type, data)
|
||||
except Exception as e:
|
||||
logger.error(f"Error collecting {data_type} data: {e}")
|
||||
|
||||
# Sleep before next collection
|
||||
await asyncio.sleep(60)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error in data collection loop: {e}")
|
||||
await asyncio.sleep(30)
|
||||
|
||||
async def submit_oracle_data(self, data_type: str, data: Dict[str, Any]):
|
||||
"""Submit oracle data to blockchain"""
|
||||
try:
|
||||
# Prepare oracle data package
|
||||
oracle_data = {
|
||||
"data_type": data_type,
|
||||
"timestamp": datetime.utcnow().isoformat(),
|
||||
"data": data,
|
||||
"agent_address": self.agent.address,
|
||||
"signature": await self.oracle_provider.sign_data(data)
|
||||
}
|
||||
|
||||
# Submit to blockchain
|
||||
tx_hash = await self.blockchain_client.submit_oracle_data(oracle_data)
|
||||
logger.info(f"Submitted {data_type} data: {tx_hash}")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error submitting {data_type} data: {e}")
|
||||
|
||||
async def get_price_data(self) -> Dict[str, Any]:
|
||||
"""Get real-time price data from external APIs"""
|
||||
logger.info("Collecting price data...")
|
||||
|
||||
prices = {}
|
||||
|
||||
# Get cryptocurrency prices (using CoinGecko API)
|
||||
try:
|
||||
crypto_response = requests.get(
|
||||
"https://api.coingecko.com/api/v1/simple/price",
|
||||
params={
|
||||
"ids": "bitcoin,ethereum",
|
||||
"vs_currencies": "usd",
|
||||
"include_24hr_change": "true"
|
||||
},
|
||||
timeout=10
|
||||
)
|
||||
|
||||
if crypto_response.status_code == 200:
|
||||
crypto_data = crypto_response.json()
|
||||
prices["cryptocurrency"] = {
|
||||
"BTC": {
|
||||
"price": crypto_data["bitcoin"]["usd"],
|
||||
"change_24h": crypto_data["bitcoin"]["usd_24h_change"]
|
||||
},
|
||||
"ETH": {
|
||||
"price": crypto_data["ethereum"]["usd"],
|
||||
"change_24h": crypto_data["ethereum"]["usd_24h_change"]
|
||||
}
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting crypto prices: {e}")
|
||||
|
||||
# Get stock prices (using Alpha Vantage API - would need API key)
|
||||
try:
|
||||
# This is a mock implementation
|
||||
prices["stocks"] = {
|
||||
"AAPL": {"price": 150.25, "change": "+2.50"},
|
||||
"GOOGL": {"price": 2800.75, "change": "-15.25"}
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting stock prices: {e}")
|
||||
|
||||
return prices
|
||||
|
||||
async def get_weather_data(self) -> Dict[str, Any]:
|
||||
"""Get weather data from external APIs"""
|
||||
logger.info("Collecting weather data...")
|
||||
|
||||
weather = {}
|
||||
|
||||
# Major cities (mock implementation)
|
||||
cities = ["New York", "London", "Tokyo", "Singapore"]
|
||||
|
||||
for city in cities:
|
||||
try:
|
||||
# This would use a real weather API like OpenWeatherMap
|
||||
weather[city] = {
|
||||
"temperature": 20.5, # Celsius
|
||||
"humidity": 65, # Percentage
|
||||
"pressure": 1013.25, # hPa
|
||||
"conditions": "Partly Cloudy",
|
||||
"wind_speed": 10.5 # km/h
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting weather for {city}: {e}")
|
||||
|
||||
return weather
|
||||
|
||||
async def get_sports_data(self) -> Dict[str, Any]:
|
||||
"""Get sports data from external APIs"""
|
||||
logger.info("Collecting sports data...")
|
||||
|
||||
sports = {}
|
||||
|
||||
# Mock sports data
|
||||
sports["basketball"] = {
|
||||
"NBA": {
|
||||
"games": [
|
||||
{
|
||||
"teams": ["Lakers", "Warriors"],
|
||||
"score": [105, 98],
|
||||
"status": "Final"
|
||||
},
|
||||
{
|
||||
"teams": ["Celtics", "Heat"],
|
||||
"score": [112, 108],
|
||||
"status": "Final"
|
||||
}
|
||||
],
|
||||
"standings": {
|
||||
"Lakers": {"wins": 45, "losses": 20},
|
||||
"Warriors": {"wins": 42, "losses": 23}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sports
|
||||
|
||||
async def get_news_data(self) -> Dict[str, Any]:
|
||||
"""Get news data from external APIs"""
|
||||
logger.info("Collecting news data...")
|
||||
|
||||
news = {}
|
||||
|
||||
# Mock news data
|
||||
news["headlines"] = [
|
||||
{
|
||||
"title": "AI Technology Breakthrough Announced",
|
||||
"source": "Tech News",
|
||||
"timestamp": datetime.utcnow().isoformat(),
|
||||
"sentiment": "positive"
|
||||
},
|
||||
{
|
||||
"title": "Cryptocurrency Market Sees Major Movement",
|
||||
"source": "Financial Times",
|
||||
"timestamp": datetime.utcnow().isoformat(),
|
||||
"sentiment": "neutral"
|
||||
}
|
||||
]
|
||||
|
||||
return news
|
||||
|
||||
async def handle_oracle_request(self, request):
|
||||
"""Handle specific oracle data requests"""
|
||||
data_type = request.data_type
|
||||
parameters = request.parameters
|
||||
|
||||
if data_type in self.data_sources:
|
||||
data = await self.data_sources[data_type](**parameters)
|
||||
return {
|
||||
"success": True,
|
||||
"data": data,
|
||||
"timestamp": datetime.utcnow().isoformat()
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"success": False,
|
||||
"error": f"Unknown data type: {data_type}"
|
||||
}
|
||||
|
||||
async def get_agent_status(self) -> Dict[str, Any]:
|
||||
"""Get current agent status"""
|
||||
balance = await self.agent.get_balance()
|
||||
|
||||
return {
|
||||
"name": self.config.name,
|
||||
"address": self.agent.address,
|
||||
"is_running": self.is_running,
|
||||
"balance": balance,
|
||||
"data_sources": list(self.data_sources.keys()),
|
||||
"last_update": datetime.utcnow().isoformat()
|
||||
}
|
||||
|
||||
async def main():
|
||||
"""Main function to run the oracle agent example"""
|
||||
# Create agent
|
||||
agent = OracleAgentExample()
|
||||
|
||||
try:
|
||||
# Start agent
|
||||
await agent.start()
|
||||
|
||||
# Keep running
|
||||
while True:
|
||||
# Print status every 60 seconds
|
||||
status = await agent.get_agent_status()
|
||||
logger.info(f"Oracle agent status: {status}")
|
||||
await asyncio.sleep(60)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
logger.info("Shutting down oracle agent...")
|
||||
await agent.stop()
|
||||
except Exception as e:
|
||||
logger.error(f"Oracle agent error: {e}")
|
||||
await agent.stop()
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
42
docs/archive/temp_files/DEBUgging_SERVICES.md
Normal file
42
docs/archive/temp_files/DEBUgging_SERVICES.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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
|
||||
53
docs/archive/temp_files/DEV_LOGS.md
Normal file
53
docs/archive/temp_files/DEV_LOGS.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# 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
|
||||
|
||||
161
docs/archive/temp_files/DEV_LOGS_QUICK_REFERENCE.md
Normal file
161
docs/archive/temp_files/DEV_LOGS_QUICK_REFERENCE.md
Normal file
@@ -0,0 +1,161 @@
|
||||
# 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!**
|
||||
123
docs/archive/temp_files/GITHUB_PULL_SUMMARY.md
Normal file
123
docs/archive/temp_files/GITHUB_PULL_SUMMARY.md
Normal file
@@ -0,0 +1,123 @@
|
||||
# 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.
|
||||
146
docs/archive/temp_files/SQLMODEL_METADATA_FIX_SUMMARY.md
Normal file
146
docs/archive/temp_files/SQLMODEL_METADATA_FIX_SUMMARY.md
Normal file
@@ -0,0 +1,146 @@
|
||||
# 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.
|
||||
181
docs/archive/temp_files/WORKING_SETUP.md
Normal file
181
docs/archive/temp_files/WORKING_SETUP.md
Normal file
@@ -0,0 +1,181 @@
|
||||
# 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.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user