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:
AITBC System
2026-03-18 20:17:23 +01:00
parent 175a3165d2
commit dda703de10
272 changed files with 5152 additions and 190 deletions

View File

@@ -0,0 +1,23 @@
# Blockchain Node Documentation
Run a blockchain node: validate transactions, produce blocks, maintain the AITBC ledger.
## Reading Order
| # | File | What you learn |
|---|------|----------------|
| 1 | [1_quick-start.md](./1_quick-start.md) | Get a node running in 10 minutes |
| 2 | [2_configuration.md](./2_configuration.md) | Node, RPC, P2P, mempool settings |
| 3 | [3_operations.md](./3_operations.md) | Start/stop, sync, peers, backups |
| 4 | [4_consensus.md](./4_consensus.md) | PoA consensus mechanism |
| 5 | [5_validator.md](./5_validator.md) | Become a validator, duties, rewards |
| 6 | [6_networking.md](./6_networking.md) | Firewall, NAT, bootstrap nodes |
| 7 | [7_monitoring.md](./7_monitoring.md) | Prometheus, dashboards, alerts |
| 8 | [8_troubleshooting.md](./8_troubleshooting.md) | Common issues and fixes |
| 9 | [9_upgrades.md](./9_upgrades.md) | Version upgrades, rollback |
| 10 | [10_api-blockchain.md](./10_api-blockchain.md) | RPC and WebSocket API reference |
## Related
- [Installation](../0_getting_started/2_installation.md) — Install all components
- [CLI Guide](../0_getting_started/3_cli.md) — `aitbc blockchain` commands

View File

@@ -0,0 +1,202 @@
# Blockchain API Reference
Complete API reference for blockchain node operations.
## RPC Endpoints
### Get Block
```
GET /rpc/block/{height}
```
**Response:**
```json
{
"block": {
"header": {
"height": 100,
"timestamp": "2026-02-13T10:00:00Z",
"proposer": "ait-devnet-proposer-1",
"parent_hash": "0xabc123...",
"state_root": "0xdef456...",
"tx_root": "0xghi789..."
},
"transactions": [...],
"receipts": [...]
},
"block_id": "0xjkl012..."
}
```
### Get Transaction
```
GET /rpc/tx/{tx_hash}
```
**Response:**
```json
{
"tx": {
"hash": "0xabc123...",
"type": "transfer",
"from": "0x1234...",
"to": "0x5678...",
"value": 100,
"gas": 21000,
"data": "0x..."
},
"height": 100,
"index": 0
}
```
### Submit Transaction
```
POST /rpc/broadcast_tx_commit
```
**Request Body:**
```json
{
"tx": "0xabc123...",
"type": "transfer",
"from": "0x1234...",
"to": "0x5678...",
"value": 100,
"data": "0x..."
}
```
**Response:**
```json
{
"tx_response": {
"code": 0,
"data": "0x...",
"log": "success",
"hash": "0xabc123..."
},
"height": 100,
"index": 0
}
```
### Get Status
```
GET /rpc/status
```
**Response:**
```json
{
"node_info": {
"protocol_version": "v0.1.0",
"network": "ait-devnet",
"node_id": "12D3KooW...",
"listen_addr": "tcp://0.0.0.0:7070"
},
"sync_info": {
"latest_block_height": 1000,
"catching_up": false,
"earliest_block_height": 1
},
"validator_info": {
"voting_power": 1000,
"proposer": true
}
}
```
### Get Mempool
```
GET /rpc/mempool
```
**Response:**
```json
{
"size": 50,
"txs": [
{
"hash": "0xabc123...",
"fee": 0.001,
"size": 200
}
]
}
```
## WebSocket Endpoints
### Subscribe to Blocks
```
WS /rpc/block
```
**Message:**
```json
{
"type": "new_block",
"data": {
"height": 1001,
"hash": "0x...",
"proposer": "ait-devnet-proposer-1"
}
}
```
### Subscribe to Transactions
```
WS /rpc/tx
```
**Message:**
```json
{
"type": "new_tx",
"data": {
"hash": "0xabc123...",
"type": "transfer",
"from": "0x1234...",
"to": "0x5678...",
"value": 100
}
}
```
## Error Codes
| Code | Description |
|------|-------------|
| 0 | Success |
| 1 | Internal error |
| 2 | Invalid transaction |
| 3 | Invalid request |
| 4 | Not found |
| 5 | Conflict |
## Rate Limits
- 1000 requests/minute for RPC
- 100 requests/minute for writes
- 10 connections per IP
## Next
- [Quick Start](./1_quick-start.md) — Get started
- [Configuration](./2_configuration.md) - Configure your node
- [Operations](./3_operations.md) — Day-to-day ops

View File

@@ -0,0 +1,54 @@
# Node Quick Start
**10 minutes** — Install, configure, and sync a blockchain node.
## Prerequisites
| Resource | Minimum |
|----------|---------|
| CPU | 4 cores |
| RAM | 16 GB |
| Storage | 100 GB SSD |
| Network | 100 Mbps stable |
## 1. Install
```bash
cd /home/oib/windsurf/aitbc
python -m venv .venv && source .venv/bin/activate
pip install -e .
```
## 2. Initialize & Configure
```bash
aitbc-chain init --name my-node --network ait-devnet
```
Edit `~/.aitbc/chain.yaml`:
```yaml
node:
name: my-node
data_dir: ./data
rpc:
bind_host: 0.0.0.0
bind_port: 8080
p2p:
bind_port: 7070
bootstrap_nodes:
- /dns4/node-1.aitbc.com/tcp/7070/p2p/...
```
## 3. Start & Verify
```bash
aitbc-chain start
aitbc-chain status # node info + sync progress
curl http://localhost:8080/rpc/health # RPC health check
```
## Next
- [2_configuration.md](./2_configuration.md) — Full config reference
- [3_operations.md](./3_operations.md) — Day-to-day ops
- [7_monitoring.md](./7_monitoring.md) — Prometheus + dashboards

View File

@@ -0,0 +1,87 @@
# Blockchain Node Configuration
Configure your blockchain node for optimal performance.
## Configuration File
Location: `~/.aitbc/chain.yaml`
## Node Configuration
```yaml
node:
name: my-node
network: ait-devnet # or ait-mainnet
data_dir: /opt/blockchain-node/data
log_level: info
```
## RPC Configuration
```yaml
rpc:
enabled: true
bind_host: 0.0.0.0
bind_port: 8080
cors_origins:
- http://localhost:8009
- http://localhost:8000
rate_limit: 1000 # requests per minute
```
## P2P Configuration
```yaml
p2p:
enabled: true
bind_host: 0.0.0.0
bind_port: 7070
bootstrap_nodes:
- /dns4/node-1.aitbc.com/tcp/7070/p2p/...
max_peers: 50
min_peers: 5
```
## Mempool Configuration
```yaml
mempool:
backend: database # or memory
max_size: 10000
min_fee: 0
eviction_interval: 60
```
## Database Configuration
```yaml
database:
adapter: postgresql # or sqlite
url: postgresql://user:pass@localhost/aitbc_chain
pool_size: 10
max_overflow: 20
```
## Validator Configuration
```yaml
validator:
enabled: true
key: <VALIDATOR_PRIVATE_KEY>
block_time: 2 # seconds
max_block_size: 1000000 # bytes
max_txs_per_block: 500
```
## Environment Variables
```bash
export AITBC_CHAIN_DATA_DIR=/opt/blockchain-node/data
export AITBC_CHAIN_RPC_PORT=8080
export AITBC_CHAIN_P2P_PORT=7070
```
## Next
- [Quick Start](./1_quick-start.md) — Get started
- [Operations](./3_operations.md) — Day-to-day ops
- [Consensus](./4_consensus.md) — Consensus mechanism

View File

@@ -0,0 +1,347 @@
# Node Operations
Day-to-day operations for blockchain nodes using the enhanced AITBC CLI.
## Enhanced CLI Blockchain Commands
The enhanced AITBC CLI provides comprehensive blockchain management capabilities:
```bash
# Blockchain status and synchronization
aitbc blockchain status
aitbc blockchain sync
aitbc blockchain info
# Network information
aitbc blockchain peers
aitbc blockchain blocks --limit 10
aitbc blockchain validators
# Transaction operations
aitbc blockchain transaction <TX_ID>
```
## Starting the Node
```bash
# Enhanced CLI node management
aitbc blockchain node start
# Start with custom configuration
aitbc blockchain node start --config /path/to/config.yaml
# Start as daemon
aitbc blockchain node start --daemon
# Legacy commands (still supported)
aitbc-chain start
aitbc-chain start --daemon
```
## Stopping the Node
```bash
# Enhanced CLI graceful shutdown
aitbc blockchain node stop
# Force stop
aitbc blockchain node stop --force
# Legacy commands
aitbc-chain stop
aitbc-chain stop --force
```
## Node Status
```bash
# Enhanced CLI status with more details
aitbc blockchain status
# Detailed node information
aitbc blockchain info
# Network status
aitbc blockchain peers
# Legacy command
aitbc-chain status
```
Shows:
- Block height
- Peers connected
- Mempool size
- Last block time
- Network health
- Validator status
## Checking Sync Status
```bash
# Enhanced CLI sync status
aitbc blockchain sync
# Detailed sync information
aitbc blockchain sync --verbose
# Progress monitoring
aitbc blockchain sync --watch
# Legacy command
aitbc-chain sync-status
```
Shows:
- Current height
- Target height
- Sync progress percentage
- Estimated time to sync
- Network difficulty
- Block production rate
## Managing Peers
### List Peers
```bash
# Enhanced CLI peer management
aitbc blockchain peers
# Detailed peer information
aitbc blockchain peers --detailed
# Filter by status
aitbc blockchain peers --status connected
# Legacy command
aitbc-chain peers list
```
### Add Peer
```bash
# Enhanced CLI peer addition
aitbc blockchain peers add /dns4/new-node.example.com/tcp/7070/p2p/...
# Add with validation
aitbc blockchain peers add --peer <MULTIADDR> --validate
# Legacy command
aitbc-chain peers add /dns4/new-node.example.com/tcp/7070/p2p/...
```
### Remove Peer
```bash
# Enhanced CLI peer removal
aitbc blockchain peers remove <PEER_ID>
# Remove with confirmation
aitbc blockchain peers remove <PEER_ID> --confirm
# Legacy command
aitbc-chain peers remove <PEER_ID>
```
## Validator Operations
```bash
# Enhanced CLI validator management
aitbc blockchain validators
# Validator status
aitbc blockchain validators --status active
# Validator rewards
aitbc blockchain validators --rewards
# Become a validator
aitbc blockchain validators register --stake 1000
# Legacy equivalent
aitbc-validator status
```
## Backup & Restore
### Backup Data
```bash
# Enhanced CLI backup with more options
aitbc blockchain backup --output /backup/chain-backup.tar.gz
# Compressed backup
aitbc blockchain backup --compress --output /backup/chain-backup.tar.gz
# Incremental backup
aitbc blockchain backup --incremental --output /backup/incremental.tar.gz
# Legacy command
aitbc-chain backup --output /backup/chain-backup.tar.gz
```
### Restore Data
```bash
# Enhanced CLI restore with validation
aitbc blockchain restore --input /backup/chain-backup.tar.gz
# Restore with verification
aitbc blockchain restore --input /backup/chain-backup.tar.gz --verify
# Legacy command
aitbc-chain restore --input /backup/chain-backup.tar.gz
```
## Log Management
```bash
# Enhanced CLI log management
aitbc blockchain logs --tail 100
# Filter by level and component
aitbc blockchain logs --level error --component consensus
# Real-time monitoring
aitbc blockchain logs --follow
# Export logs with formatting
aitbc blockchain logs --export /var/log/aitbc-chain.log --format json
# Legacy commands
aitbc-chain logs --tail 100
aitbc-chain logs --level error
```
## Advanced Operations
### Network Diagnostics
```bash
# Enhanced CLI network diagnostics
aitbc blockchain diagnose --network
# Full system diagnostics
aitbc blockchain diagnose --full
# Connectivity test
aitbc blockchain test-connectivity
```
### Performance Monitoring
```bash
# Enhanced CLI performance metrics
aitbc blockchain metrics
# Resource usage
aitbc blockchain metrics --resource
# Historical performance
aitbc blockchain metrics --history 24h
```
### Configuration Management
```bash
# Enhanced CLI configuration
aitbc blockchain config show
# Update configuration
aitbc blockchain config set key value
# Validate configuration
aitbc blockchain config validate
# Reset to defaults
aitbc blockchain config reset
```
## Troubleshooting with Enhanced CLI
### Node Won't Start
```bash
# Enhanced CLI diagnostics
aitbc blockchain diagnose --startup
# Check configuration
aitbc blockchain config validate
# View detailed logs
aitbc blockchain logs --level error --follow
# Reset database if needed
aitbc blockchain reset --hard
```
### Sync Issues
```bash
# Enhanced CLI sync diagnostics
aitbc blockchain diagnose --sync
# Force resync
aitbc blockchain sync --force
# Check peer connectivity
aitbc blockchain peers --status connected
# Network health check
aitbc blockchain diagnose --network
```
### Performance Issues
```bash
# Enhanced CLI performance analysis
aitbc blockchain metrics --detailed
# Resource monitoring
aitbc blockchain metrics --resource --follow
# Bottleneck analysis
aitbc blockchain diagnose --performance
```
## Integration with Monitoring
```bash
# Enhanced CLI monitoring integration
aitbc monitor dashboard --component blockchain
# Set up alerts
aitbc monitor alerts create --type blockchain_sync --threshold 90%
# Export metrics for Prometheus
aitbc blockchain metrics --export prometheus
```
## Best Practices
1. **Use enhanced CLI commands** for better functionality
2. **Monitor regularly** with `aitbc blockchain status`
3. **Backup frequently** using enhanced backup options
4. **Validate configuration** before starting node
5. **Use diagnostic tools** for troubleshooting
6. **Integrate with monitoring** for production deployments
## Migration from Legacy Commands
If you're migrating from legacy commands:
```bash
# Old → New
aitbc-chain start → aitbc blockchain node start
aitbc-chain status → aitbc blockchain status
aitbc-chain peers list → aitbc blockchain peers
aitbc-chain backup → aitbc blockchain backup
```
## Next
- [Quick Start](./1_quick-start.md) — Get started
- [Configuration](./2_configuration.md) - Configure your node
- [Consensus](./4_consensus.md) — Consensus mechanism
- [Enhanced CLI](../23_cli/README.md) — Complete CLI reference

View File

@@ -0,0 +1,65 @@
# Consensus Mechanism
Understand AITBC's proof-of-authority consensus mechanism.
## Overview
AITBC uses a Proof-of-Authority (PoA) consensus mechanism with:
- Fixed block time: 2 seconds
- Authority set of validated proposers
- Transaction finality on each block
## Block Production
### Proposer Selection
Proposers take turns producing blocks in a round-robin fashion. Each proposer gets a fixed time slot.
### Block Structure
```json
{
"header": {
"height": 100,
"timestamp": "2026-02-13T10:00:00Z",
"proposer": "ait-devnet-proposer-1",
"parent_hash": "0xabc123...",
"state_root": "0xdef456...",
"tx_root": "0xghi789..."
},
"transactions": [...],
"receipts": [...]
}
```
## Consensus Rules
1. **Block Time**: 2 seconds minimum
2. **Block Size**: 1 MB maximum
3. **Transactions**: 500 maximum per block
4. **Fee**: Minimum 0 (configurable)
## Validator Requirements
| Requirement | Value |
|-------------|-------|
| Uptime | 99% minimum |
| Latency | < 100ms to peers |
| Stake | 1000 AITBC |
## Fork Selection
Longest chain rule applies:
- Validators always extend the longest known chain
- Reorgs occur only on conflicting blocks within the last 10 blocks
## Finality
Blocks are considered final after:
- 1 confirmation for normal transactions
- 3 confirmations for high-value transactions
## Next
- [Quick Start](./1_quick-start.md) Get started
- [Validator Operations](./5_validator.md) - Validator guide
- [Networking](./6_networking.md) - P2P networking

View File

@@ -0,0 +1,95 @@
# Validator Operations
Guide for running a validator node in the AITBC network.
## Becoming a Validator
### Requirements
| Requirement | Value |
|-------------|-------|
| Stake | 1000 AITBC |
| Node uptime | 99%+ |
| Technical capability | Must run node 24/7 |
| Geographic distribution | One per region preferred |
### Registration
```bash
aitbc-chain validator register --stake 1000
```
### Activate Validator Status
```bash
aitbc-chain validator activate
```
## Validator Duties
### Block Production
Validators take turns producing blocks:
- Round-robin selection
- Fixed 2-second block time
- Missed blocks result in reduced rewards
### Transaction Validation
- Verify transaction signatures
- Check sender balance
- Validate smart contract execution
### Network Participation
- Maintain P2P connections
- Propagate blocks to peers
- Participate in consensus votes
## Validator Rewards
### Block Rewards
| Block Position | Reward |
|----------------|--------|
| Proposer | 1 AITBC |
| Validator (any) | 0.1 AITBC |
### Performance Bonuses
- 100% uptime: 1.5x multiplier
- 99-100% uptime: 1.2x multiplier
- <99% uptime: 1.0x multiplier
## Validator Monitoring
```bash
# Check validator status
aitbc-chain validator status
# View performance metrics
aitbc-chain validator metrics
# Check missed blocks
aitbc-chain validator missed-blocks
```
## Validator Slashing
### Slashing Conditions
| Violation | Penalty |
|-----------|---------|
| Double signing | 5% stake |
| Extended downtime | 1% stake |
| Invalid block | 2% stake |
### Recovery
- Partial slashing can be recovered
- Full slashing requires re-registration
## Next
- [Quick Start](./1_quick-start.md) Get started
- [Consensus](./4_consensus.md) Consensus mechanism
- [Monitoring](./7_monitoring.md) Monitoring

View File

@@ -0,0 +1,107 @@
# Networking Configuration
Configure P2P networking for your blockchain node.
## Network Settings
### Firewall Configuration
```bash
# Allow P2P port
sudo ufw allow 7070/tcp
# Allow RPC port
sudo ufw allow 8080/tcp
# Allow from specific IPs
sudo ufw allow from 10.0.0.0/8 to any port 8080
```
### Port Forwarding
If behind a NAT, configure port forwarding:
- External port 7070 → Internal IP:7070
- External port 8080 → Internal IP:8080
## Bootstrap Nodes
### Default Bootstrap Nodes
```yaml
p2p:
bootstrap_nodes:
- /dns4/node-1.aitbc.com/tcp/7070/p2p/12D3KooW...
- /dns4/node-2.aitbc.com/tcp/7070/p2p/12D3KooW...
- /dns4/node-3.aitbc.com/tcp/7070/p2p/12D3KooW...
```
### Adding Custom Bootstrap Nodes
```bash
aitbc-chain p2p add-bootstrap /dns4/my-node.example.com/tcp/7070/p2p/...
```
## Peer Management
### Connection Limits
```yaml
p2p:
max_peers: 50
min_peers: 5
outbound_peers: 10
inbound_peers: 40
```
### Peer Scoring
Nodes are scored based on:
- Latency
- Availability
- Protocol compliance
- Block propagation speed
## NAT Traversal
### Supported Methods
| Method | Description |
|--------|-------------|
| AutoNAT | Automatic NAT detection |
| Hole Punching | UDP hole punching |
| Relay | TURN relay fallback |
### Configuration
```yaml
p2p:
nat:
enabled: true
method: auto # auto, hole_punching, relay
external_ip: 203.0.113.1
```
## Troubleshooting
### Check Connectivity
```bash
aitbc-chain p2p check-connectivity
```
### List Active Connections
```bash
aitbc-chain p2p connections
```
### Debug Mode
```bash
aitbc-chain start --log-level debug
```
## Next
- [Quick Start](./1_quick-start.md) — Get started
- [Configuration](./2_configuration.md) - Configure your node
- [Operations](./3_operations.md) — Day-to-day ops

View File

@@ -0,0 +1,89 @@
# Node Monitoring
Monitor your blockchain node performance and health.
## Dashboard
```bash
aitbc-chain dashboard
```
Shows:
- Block height
- Peers connected
- Mempool size
- CPU/Memory/GPU usage
- Network traffic
## Prometheus Metrics
```bash
# Enable metrics
aitbc-chain metrics --port 9090
```
Available metrics:
- `aitbc_block_height` - Current block height
- `aitbc_peers_count` - Number of connected peers
- `aitbc_mempool_size` - Transactions in mempool
- `aitbc_block_production_time` - Block production time
- `aitbc_cpu_usage` - CPU utilization
- `aitbc_memory_usage` - Memory utilization
## Alert Configuration
### Set Alerts
```bash
# Low peers alert
aitbc-chain alert --metric peers --threshold 3 --action notify
# High mempool alert
aitbc-chain alert --metric mempool --threshold 5000 --action notify
# Sync delay alert
aitbc-chain alert --metric sync_delay --threshold 100 --action notify
```
### Alert Actions
| Action | Description |
|--------|-------------|
| notify | Send notification |
| restart | Restart node |
| pause | Pause block production |
## Log Monitoring
```bash
# Real-time logs
aitbc-chain logs --tail
# Search logs
aitbc-chain logs --grep "error" --since "1h"
# Export logs
aitbc-chain logs --export /var/log/aitbc-chain/
```
## Health Checks
```bash
# Run health check
aitbc-chain health
# Detailed report
aitbc-chain health --detailed
```
Checks:
- Disk space
- Memory
- P2P connectivity
- RPC availability
- Database sync
## Next
- [Quick Start](./1_quick-start.md) — Get started
- [Configuration](./2_configuration.md) - Configure your node
- [Operations](./3_operations.md) — Day-to-day ops

View File

@@ -0,0 +1,396 @@
# Troubleshooting
Common issues and solutions for blockchain nodes using the enhanced AITBC CLI.
## Enhanced CLI Diagnostics
The enhanced AITBC CLI provides comprehensive diagnostic tools:
```bash
# Full system diagnostics
aitbc blockchain diagnose --full
# Network diagnostics
aitbc blockchain diagnose --network
# Sync diagnostics
aitbc blockchain diagnose --sync
# Performance diagnostics
aitbc blockchain diagnose --performance
# Startup diagnostics
aitbc blockchain diagnose --startup
```
## Common Issues
### Node Won't Start
```bash
# Enhanced CLI diagnostics
aitbc blockchain diagnose --startup
# Check configuration
aitbc blockchain config validate
# View detailed logs
aitbc blockchain logs --level error --follow
# Check port usage
aitbc blockchain diagnose --network
# Common causes:
# - Port already in use
# - Corrupted database
# - Invalid configuration
```
**Solutions:**
```bash
# Enhanced CLI port check
aitbc blockchain diagnose --network --check-ports
# Kill existing process (if needed)
sudo lsof -i :8080
sudo kill $(sudo lsof -t -i :8080)
# Reset database with enhanced CLI
aitbc blockchain reset --hard
# Validate and fix configuration
aitbc blockchain config validate
aitbc blockchain config fix
# Legacy approach
tail -f ~/.aitbc/logs/chain.log
rm -rf ~/.aitbc/data/chain.db
aitbc-chain init
```
### Sync Stuck
```bash
# Enhanced CLI sync diagnostics
aitbc blockchain diagnose --sync
# Check sync status with details
aitbc blockchain sync --verbose
# Force resync
aitbc blockchain sync --force
# Check peer connectivity
aitbc blockchain peers --status connected
# Network health check
aitbc blockchain diagnose --network
# Monitor sync progress
aitbc blockchain sync --watch
```
**Solutions:**
```bash
# Enhanced CLI peer management
aitbc blockchain peers add --peer <MULTIADDR> --validate
# Add more bootstrap peers
aitbc blockchain peers add --bootstrap /dns4/new-peer.example.com/tcp/7070/p2p/...
# Clear peer database
aitbc blockchain peers clear
# Reset and resync
aitbc blockchain reset --sync
aitbc blockchain sync --force
# Check network connectivity
aitbc blockchain test-connectivity
```
### High CPU/Memory Usage
```bash
# Enhanced CLI performance diagnostics
aitbc blockchain diagnose --performance
# Monitor resource usage
aitbc blockchain metrics --resource --follow
# Check for bottlenecks
aitbc blockchain metrics --detailed
# Historical performance data
aitbc blockchain metrics --history 24h
```
**Solutions:**
```bash
# Optimize configuration
aitbc blockchain config set max_peers 50
aitbc blockchain config set cache_size 1GB
# Enable performance mode
aitbc blockchain optimize --performance
# Monitor improvements
aitbc blockchain metrics --resource --follow
```
### Peer Connection Issues
```bash
# Enhanced CLI peer diagnostics
aitbc blockchain diagnose --network
# Check peer status
aitbc blockchain peers --detailed
# Test connectivity
aitbc blockchain test-connectivity
# Network diagnostics
aitbc blockchain diagnose --network --full
```
**Solutions:**
```bash
# Add reliable peers
aitbc blockchain peers add --bootstrap <MULTIADDR>
# Update peer configuration
aitbc blockchain config set bootstrap_nodes <NODES>
# Reset peer database
aitbc blockchain peers reset
# Check firewall settings
aitbc blockchain diagnose --network --firewall
```
### Validator Issues
```bash
# Enhanced CLI validator diagnostics
aitbc blockchain validators --diagnose
# Check validator status
aitbc blockchain validators --status active
# Validator rewards tracking
aitbc blockchain validators --rewards
# Performance metrics
aitbc blockchain validators --metrics
```
**Solutions:**
```bash
# Re-register as validator
aitbc blockchain validators register --stake 1000
# Check stake requirements
aitbc blockchain validators --requirements
# Monitor validator performance
aitbc blockchain validators --monitor
```
## Advanced Troubleshooting
### Database Corruption
```bash
# Enhanced CLI database diagnostics
aitbc blockchain diagnose --database
# Database integrity check
aitbc blockchain database check
# Repair database
aitbc blockchain database repair
# Rebuild database
aitbc blockchain database rebuild
```
### Configuration Issues
```bash
# Enhanced CLI configuration diagnostics
aitbc blockchain config diagnose
# Validate configuration
aitbc blockchain config validate
# Reset to defaults
aitbc blockchain config reset
# Generate new configuration
aitbc blockchain config generate
```
### Network Issues
```bash
# Enhanced CLI network diagnostics
aitbc blockchain diagnose --network --full
# Test all network endpoints
aitbc blockchain test-connectivity --all
# Check DNS resolution
aitbc blockchain diagnose --network --dns
# Firewall diagnostics
aitbc blockchain diagnose --network --firewall
```
## Monitoring and Alerting
### Real-time Monitoring
```bash
# Enhanced CLI monitoring
aitbc monitor dashboard --component blockchain
# Set up alerts
aitbc monitor alerts create --type blockchain_sync --threshold 90%
# Resource monitoring
aitbc blockchain metrics --resource --follow
# Export metrics
aitbc blockchain metrics --export prometheus
```
### Log Analysis
```bash
# Enhanced CLI log analysis
aitbc blockchain logs --analyze --level error
# Export logs for analysis
aitbc blockchain logs --export /tmp/blockchain-logs.json --format json
# Filter by time range
aitbc blockchain logs --since "1 hour ago" --level error
# Real-time log monitoring
aitbc blockchain logs --follow --level warn
```
## Recovery Procedures
### Complete Node Recovery
```bash
# Enhanced CLI recovery sequence
aitbc blockchain backup --emergency
# Stop node safely
aitbc blockchain node stop --force
# Reset everything
aitbc blockchain reset --hard
# Restore from backup
aitbc blockchain restore --input /backup/emergency-backup.tar.gz --verify
# Start node
aitbc blockchain node start
# Monitor recovery
aitbc blockchain sync --watch
```
### Emergency Procedures
```bash
# Emergency stop
aitbc blockchain node stop --emergency
# Emergency backup
aitbc blockchain backup --emergency --compress
# Emergency reset
aitbc blockchain reset --emergency
# Emergency recovery
aitbc blockchain recover --from-backup /backup/emergency.tar.gz
```
## Best Practices
### Prevention
1. **Regular monitoring** with enhanced CLI tools
2. **Automated backups** using enhanced backup options
3. **Configuration validation** before changes
4. **Performance monitoring** for early detection
5. **Network diagnostics** for connectivity issues
### Maintenance
1. **Weekly diagnostics** with `aitbc blockchain diagnose --full`
2. **Monthly backups** with verification
3. **Quarterly performance reviews**
4. **Configuration audits**
5. **Security scans**
### Troubleshooting Workflow
1. **Run diagnostics**: `aitbc blockchain diagnose --full`
2. **Check logs**: `aitbc blockchain logs --level error --follow`
3. **Verify configuration**: `aitbc blockchain config validate`
4. **Test connectivity**: `aitbc blockchain test-connectivity`
5. **Apply fixes**: Use enhanced CLI commands
6. **Monitor recovery**: `aitbc blockchain status --watch`
## Integration with Support
### Export Diagnostic Data
```bash
# Export full diagnostic report
aitbc blockchain diagnose --full --export /tmp/diagnostic-report.json
# Export logs for support
aitbc blockchain logs --export /tmp/support-logs.tar.gz --compress
# Export configuration
aitbc blockchain config export --output /tmp/config-backup.yaml
```
### Support Commands
```bash
# Generate support bundle
aitbc blockchain support-bundle --output /tmp/support-bundle.tar.gz
# System information
aitbc blockchain system-info --export /tmp/system-info.json
# Performance report
aitbc blockchain metrics --report --output /tmp/performance-report.json
```
## Legacy Command Equivalents
For users transitioning from legacy commands:
```bash
# Old → New
tail -f ~/.aitbc/logs/chain.log → aitbc blockchain logs --follow
aitbc-chain validate-config → aitbc blockchain config validate
aitbc-chain reset --hard → aitbc blockchain reset --hard
aitbc-chain p2p connections → aitbc blockchain peers --status connected
```
## Next
- [Operations](./3_operations.md) — Day-to-day operations
- [Configuration](./2_configuration.md) — Node configuration
- [Enhanced CLI](../23_cli/README.md) — Complete CLI reference
- [Monitoring](./7_monitoring.md) — Monitoring and alerting

View File

@@ -0,0 +1,77 @@
# Node Upgrades
Guide for upgrading your blockchain node.
## Upgrade Process
### Check Current Version
```bash
aitbc-chain version
```
### Check for Updates
```bash
aitbc-chain check-update
```
### Upgrade Steps
```bash
# 1. Backup data
aitbc-chain backup --output /backup/chain-$(date +%Y%m%d).tar.gz
# 2. Stop node gracefully
aitbc-chain stop
# 3. Upgrade software
pip install --upgrade aitbc-chain
# 4. Review migration notes
cat CHANGELOG.md
# 5. Start node
aitbc-chain start
```
## Version-Specific Upgrades
### v0.1.0 → v0.2.0
```bash
# Database migration required
aitbc-chain migrate --from v0.1.0
```
### v0.2.0 → v0.3.0
```bash
# Configuration changes
aitbc-chain migrate-config --from v0.2.0
```
## Rollback Procedure
```bash
# If issues occur, rollback
pip install aitbc-chain==0.1.0
# Restore from backup
aitbc-chain restore --input /backup/chain-YYYYMMDD.tar.gz
# Start old version
aitbc-chain start
```
## Upgrade Notifications
```bash
# Enable upgrade alerts
aitbc-chain alert --metric upgrade_available --action notify
```
## Next
- [Quick Start](./1_quick-start.md) — Get started
- [Operations](./3_operations.md) — Day-to-day ops
- [Monitoring](./7_monitoring.md) — Monitoring

File diff suppressed because it is too large Load Diff