Implement RECEIPT_CLAIM transaction type
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Successful in 4s
Documentation Validation / validate-docs (push) Successful in 12s
Documentation Validation / validate-policies-strict (push) Successful in 3s
Integration Tests / test-service-integration (push) Failing after 12s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 3s
P2P Network Verification / p2p-verification (push) Successful in 2s
Python Tests / test-python (push) Successful in 10s
Security Scanning / security-scan (push) Successful in 31s
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Successful in 4s
Documentation Validation / validate-docs (push) Successful in 12s
Documentation Validation / validate-policies-strict (push) Successful in 3s
Integration Tests / test-service-integration (push) Failing after 12s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 3s
P2P Network Verification / p2p-verification (push) Successful in 2s
Python Tests / test-python (push) Successful in 10s
Security Scanning / security-scan (push) Successful in 31s
- Add status fields to Receipt model (status, claimed_at, claimed_by) - Add RECEIPT_CLAIM handling to state_transition.py with validation and reward minting - Add type field to Transaction model for reliable transaction type storage - Update router to use TransactionRequest model to preserve type field - Update poa.py to extract type from mempool transaction content and store only original payload - Add RECEIPT_CLAIM to GasType enum with gas schedule
This commit is contained in:
@@ -1,5 +1,25 @@
|
||||
# AITBC AI Operations Reference
|
||||
|
||||
This reference guide covers AI operations in the AITBC blockchain network, including job submission, resource allocation, marketplace interactions, agent coordination, and blockchain integration.
|
||||
|
||||
## Table of Contents
|
||||
- [AI Job Types and Parameters](#ai-job-types-and-parameters)
|
||||
- [Ollama Integration](#ollama-integration)
|
||||
- [Resource Allocation](#resource-allocation)
|
||||
- [Marketplace Operations](#marketplace-operations)
|
||||
- [GPU Provider Marketplace](#gpu-provider-marketplace)
|
||||
- [Agent AI Workflows](#agent-ai-workflows)
|
||||
- [OpenClaw Agent Coordination](#openclaw-agent-coordination)
|
||||
- [Cross-Node AI Coordination](#cross-node-ai-coordination)
|
||||
- [Blockchain Integration](#blockchain-integration)
|
||||
- [AI Economics and Pricing](#ai-economics-and-pricing)
|
||||
- [AI Monitoring and Analytics](#ai-monitoring-and-analytics)
|
||||
- [API Endpoints](#api-endpoints)
|
||||
- [AI Security and Compliance](#ai-security-and-compliance)
|
||||
- [Troubleshooting AI Operations](#troubleshooting-ai-operations)
|
||||
- [Best Practices](#best-practices)
|
||||
- [Real-World Workflows](#real-world-workflows)
|
||||
|
||||
## AI Job Types and Parameters
|
||||
|
||||
### Inference Jobs
|
||||
@@ -30,6 +50,56 @@
|
||||
|
||||
# Audio processing
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type multimodal --prompt "Transcribe audio" --audio-path "/path/to/audio.wav" --payment 150
|
||||
|
||||
# Video analysis
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type multimodal --prompt "Analyze video content" --video-path "/path/to/video.mp4" --payment 300
|
||||
```
|
||||
|
||||
### Streaming Jobs
|
||||
```bash
|
||||
# Real-time inference streaming
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type inference --prompt "Generate story" --stream true --payment 150
|
||||
|
||||
# Continuous monitoring
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type monitoring --target "network" --interval 60 --payment 200
|
||||
```
|
||||
|
||||
## Ollama Integration
|
||||
|
||||
### Ollama Model Operations
|
||||
```bash
|
||||
# List available Ollama models
|
||||
python3 /opt/aitbc/plugins/ollama/client_plugin.py --list-models
|
||||
|
||||
# Run inference with Ollama
|
||||
python3 /opt/aitbc/plugins/ollama/client_plugin.py --model llama2 --prompt "Generate code for REST API"
|
||||
|
||||
# Submit Ollama job via CLI
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type ollama --model "llama2:7b" --prompt "Analyze this data" --payment 50
|
||||
|
||||
# Use custom Ollama endpoint
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type ollama --endpoint "http://localhost:11434" --model "mistral" --prompt "Generate summary" --payment 75
|
||||
```
|
||||
|
||||
### Ollama GPU Provider Integration
|
||||
```bash
|
||||
# Register as Ollama GPU provider
|
||||
./aitbc-cli gpu provider register --type ollama --models "llama2,mistral,codellama" --gpu-count 1 --price 0.05
|
||||
|
||||
# Submit Ollama job to specific provider
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type ollama --provider "provider_123" --model "llama2" --prompt "Generate text" --payment 50
|
||||
|
||||
# Monitor Ollama provider status
|
||||
./aitbc-cli gpu provider status --provider-id "provider_123"
|
||||
```
|
||||
|
||||
### Ollama Batch Operations
|
||||
```bash
|
||||
# Batch inference
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type ollama --model "llama2" --batch-file "prompts.json" --payment 200
|
||||
|
||||
# Parallel Ollama jobs
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type ollama --model "mistral" --parallel 4 --prompts "prompt1,prompt2,prompt3,prompt4" --payment 150
|
||||
```
|
||||
|
||||
## Resource Allocation
|
||||
@@ -57,6 +127,18 @@
|
||||
|
||||
## Marketplace Operations
|
||||
|
||||
### Service Provider Registration
|
||||
```bash
|
||||
# Register as AI service provider
|
||||
./aitbc-cli market provider register --name "AI-Service-Pro" --wallet genesis-ops --verification full
|
||||
|
||||
# Update service listing
|
||||
./aitbc-cli market service update --service-id "service_123" --price 60 --description "Updated description"
|
||||
|
||||
# Deactivate service
|
||||
./aitbc-cli market service deactivate --service-id "service_123"
|
||||
```
|
||||
|
||||
### Creating AI Services
|
||||
```bash
|
||||
# Image generation service
|
||||
@@ -84,6 +166,59 @@
|
||||
./aitbc-cli market order execute --service-id "service_123" --job-data "prompt:Generate landscape image"
|
||||
```
|
||||
|
||||
## GPU Provider Marketplace
|
||||
|
||||
### GPU Provider Registration
|
||||
```bash
|
||||
# Register as GPU provider
|
||||
./aitbc-cli gpu provider register --name "GPU-Provider-1" --wallet genesis-ops --gpu-model "RTX4090" --gpu-count 4 --price 0.10
|
||||
|
||||
# Register Ollama-specific provider
|
||||
./aitbc-cli gpu provider register --name "Ollama-Node" --type ollama --models "llama2,mistral" --gpu-count 2 --price 0.05
|
||||
|
||||
# Update provider capacity
|
||||
./aitbc-cli gpu provider update --provider-id "provider_123" --gpu-count 8 --price 0.08
|
||||
```
|
||||
|
||||
### GPU Provider Operations
|
||||
```bash
|
||||
# List available GPU providers
|
||||
./aitbc-cli gpu provider list
|
||||
|
||||
# Search for specific GPU models
|
||||
./aitbc-cli gpu provider search --model "RTX4090"
|
||||
|
||||
# Check provider availability
|
||||
./aitbc-cli gpu provider availability --provider-id "provider_123"
|
||||
|
||||
# Get provider pricing
|
||||
./aitbc-cli gpu provider pricing --provider-id "provider_123"
|
||||
```
|
||||
|
||||
### GPU Allocation from Providers
|
||||
```bash
|
||||
# Allocate from specific provider
|
||||
./aitbc-cli resource allocate --provider-id "provider_123" --gpu 2 --memory 16384 --duration 3600
|
||||
|
||||
# Auto-select best provider
|
||||
./aitbc-cli resource allocate --auto-select --gpu 1 --memory 8192 --duration 1800 --criteria price
|
||||
|
||||
# Allocate with provider preferences
|
||||
./aitbc-cli resource allocate --preferred-providers "provider_123,provider_456" --gpu 1 --memory 8192 --duration 3600
|
||||
```
|
||||
|
||||
### GPU Provider Earnings
|
||||
```bash
|
||||
# Check provider earnings
|
||||
./aitbc-cli gpu provider earnings --provider-id "provider_123" --period "7d"
|
||||
|
||||
# Withdraw earnings
|
||||
./aitbc-cli gpu provider withdraw --provider-id "provider_123" --wallet genesis-ops --amount 1000
|
||||
|
||||
# Provider utilization report
|
||||
./aitbc-cli gpu provider utilization --provider-id "provider_123" --period "24h"
|
||||
```
|
||||
|
||||
## Agent AI Workflows
|
||||
|
||||
### Creating AI Agents
|
||||
@@ -110,6 +245,44 @@
|
||||
./aitbc-cli agent execute --name "ai-coordinator" --wallet genesis-ops --priority high
|
||||
```
|
||||
|
||||
## OpenClaw Agent Coordination
|
||||
|
||||
### OpenClaw AI Agent Setup
|
||||
```bash
|
||||
# Initialize OpenClaw AI agent
|
||||
openclaw agent init --name ai-inference-agent --type ai-worker
|
||||
|
||||
# Configure agent for AI operations
|
||||
openclaw agent configure --name ai-inference-agent --ai-model "llama2" --gpu-requirement 1
|
||||
|
||||
# Deploy agent to node
|
||||
openclaw agent deploy --name ai-inference-agent --target-node aitbc1
|
||||
```
|
||||
|
||||
### OpenClaw AI Workflows
|
||||
```bash
|
||||
# Execute AI workflow via OpenClaw
|
||||
openclaw execute --agent AI-InferenceAgent --task run_inference --prompt "Generate image" --model "stable-diffusion"
|
||||
|
||||
# Coordinate multi-agent AI pipeline
|
||||
openclaw execute --agent CoordinatorAgent --task ai_pipeline --workflow "preprocess->inference->postprocess"
|
||||
|
||||
# Monitor agent AI performance
|
||||
openclaw monitor --agent AI-InferenceAgent --metrics gpu,throughput,errors
|
||||
```
|
||||
|
||||
### Cross-Agent Communication
|
||||
```bash
|
||||
# Send AI job result to another agent
|
||||
openclaw message --from AI-InferenceAgent --to Data-ProcessingAgent --payload "job_id:123,result:image.png"
|
||||
|
||||
# Request resources from coordinator
|
||||
openclaw message --from AI-TrainingAgent --to Resource-CoordinatorAgent --payload "request:gpu,count:2,duration:3600"
|
||||
|
||||
# Broadcast job completion
|
||||
openclaw broadcast --from AI-InferenceAgent --channel ai-jobs --payload "job_123:completed"
|
||||
```
|
||||
|
||||
## Cross-Node AI Coordination
|
||||
|
||||
### Multi-Node Job Submission
|
||||
@@ -130,6 +303,56 @@ ssh aitbc1 'cd /opt/aitbc && source venv/bin/activate && ./aitbc-cli resource al
|
||||
./aitbc-cli ai job status --multi-node
|
||||
```
|
||||
|
||||
## Blockchain Integration
|
||||
|
||||
### AI Job on Blockchain
|
||||
```bash
|
||||
# Submit AI job with blockchain recording
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type inference --prompt "Generate image" --payment 100 --record-on-chain
|
||||
|
||||
# Verify AI job on blockchain
|
||||
./aitbc-cli blockchain verify --job-id "job_123" --check-integrity
|
||||
|
||||
# Get AI job transaction hash
|
||||
./aitbc-cli ai job tx-hash --job-id "job_123"
|
||||
```
|
||||
|
||||
### AI Payments via Blockchain
|
||||
```bash
|
||||
# Pay for AI job with blockchain transaction
|
||||
./aitbc-cli ai payment pay --job-id "job_123" --wallet genesis-ops --amount 100 --on-chain
|
||||
|
||||
# Check payment status on blockchain
|
||||
./aitbc-cli blockchain tx-status --tx-hash "0x123...abc"
|
||||
|
||||
# Get AI payment history
|
||||
./aitbc-cli ai payment history --wallet genesis-ops --on-chain
|
||||
```
|
||||
|
||||
### AI Smart Contract Integration
|
||||
```bash
|
||||
# Deploy AI service smart contract
|
||||
./aitbc-cli contract deploy --type ai-service --name "AI-Inference-Service" --wallet genesis-ops
|
||||
|
||||
# Interact with AI smart contract
|
||||
./aitbc-cli contract call --contract "0x123...abc" --method submitJob --params "prompt:Generate image,payment:100"
|
||||
|
||||
# Query AI smart contract state
|
||||
./aitbc-cli contract query --contract "0x123...abc" --method getJobStatus --params "job_id:123"
|
||||
```
|
||||
|
||||
### AI Data Verification
|
||||
```bash
|
||||
# Verify AI output integrity
|
||||
./aitbc-cli ai verify --job-id "job_123" --check-hash --check-signature
|
||||
|
||||
# Generate AI output proof
|
||||
./aitbc-cli ai proof --job-id "job_123" --output-path "/path/to/output.png"
|
||||
|
||||
# Store AI result on blockchain
|
||||
./aitbc-cli ai store --job-id "job_123" --ipfs --on-chain
|
||||
```
|
||||
|
||||
## AI Economics and Pricing
|
||||
|
||||
### Job Cost Estimation
|
||||
@@ -152,6 +375,33 @@ ssh aitbc1 'cd /opt/aitbc && source venv/bin/activate && ./aitbc-cli resource al
|
||||
|
||||
## AI Monitoring and Analytics
|
||||
|
||||
### Advanced Metrics
|
||||
```bash
|
||||
# Detailed job metrics
|
||||
./aitbc-cli ai metrics detailed --job-id "job_123" --include gpu,memory,network,io
|
||||
|
||||
# Agent performance comparison
|
||||
./aitbc-cli ai metrics compare --agents "agent1,agent2,agent3" --period "24h"
|
||||
|
||||
# Cost analysis
|
||||
./aitbc-cli ai metrics cost --wallet genesis-ops --period "30d" --breakdown job_type,provider
|
||||
|
||||
# Error analysis
|
||||
./aitbc-cli ai metrics errors --period "7d" --group-by error_type
|
||||
```
|
||||
|
||||
### Real-time Monitoring
|
||||
```bash
|
||||
# Stream live metrics
|
||||
./aitbc-cli ai monitor live --job-id "job_123"
|
||||
|
||||
# Monitor multiple jobs
|
||||
./aitbc-cli ai monitor multi --job-ids "job1,job2,job3"
|
||||
|
||||
# Set up alerts
|
||||
./aitbc-cli ai alert create --condition "job_duration > 3600" --action notify --email admin@example.com
|
||||
```
|
||||
|
||||
### Job Monitoring
|
||||
```bash
|
||||
# Monitor specific job
|
||||
@@ -176,6 +426,63 @@ ssh aitbc1 'cd /opt/aitbc && source venv/bin/activate && ./aitbc-cli resource al
|
||||
./aitbc-cli ai metrics throughput --nodes "aitbc,aitbc1" --period "24h"
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### AI Job API
|
||||
```bash
|
||||
# Submit AI job via API
|
||||
curl -X POST http://localhost:8006/api/ai/job/submit \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"wallet":"genesis-ops","type":"inference","prompt":"Generate image","payment":100}'
|
||||
|
||||
# Get job status
|
||||
curl http://localhost:8006/api/ai/job/status?job_id=job_123
|
||||
|
||||
# List all jobs
|
||||
curl http://localhost:8006/api/ai/jobs
|
||||
```
|
||||
|
||||
### Resource API
|
||||
```bash
|
||||
# Allocate resources via API
|
||||
curl -X POST http://localhost:8006/api/resource/allocate \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"agent_id":"ai-agent","gpu":1,"memory":8192,"duration":3600}'
|
||||
|
||||
# Get resource utilization
|
||||
curl http://localhost:8006/api/resource/utilization?type=gpu&period=1h
|
||||
```
|
||||
|
||||
### Marketplace API
|
||||
```bash
|
||||
# List services
|
||||
curl http://localhost:8006/api/market/services
|
||||
|
||||
# Create service
|
||||
curl -X POST http://localhost:8006/api/market/service/create \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"name":"AI Service","type":"inference","price":50,"wallet":"genesis-ops"}'
|
||||
|
||||
# Bid on service
|
||||
curl -X POST http://localhost:8006/api/market/order/bid \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"service_id":"service_123","amount":60,"wallet":"genesis-ops"}'
|
||||
```
|
||||
|
||||
### GPU Provider API
|
||||
```bash
|
||||
# Register provider
|
||||
curl -X POST http://localhost:8006/api/gpu/provider/register \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"name":"GPU Provider","gpu_model":"RTX4090","gpu_count":4,"price":0.10}'
|
||||
|
||||
# Get provider status
|
||||
curl http://localhost:8006/api/gpu/provider/status?provider_id=provider_123
|
||||
|
||||
# List providers
|
||||
curl http://localhost:8006/api/gpu/providers
|
||||
```
|
||||
|
||||
## AI Security and Compliance
|
||||
|
||||
### Secure AI Operations
|
||||
@@ -198,11 +505,71 @@ ssh aitbc1 'cd /opt/aitbc && source venv/bin/activate && ./aitbc-cli resource al
|
||||
|
||||
## Troubleshooting AI Operations
|
||||
|
||||
### Common Issues
|
||||
1. **Job Not Starting**: Check resource allocation and wallet balance
|
||||
2. **GPU Allocation Failed**: Verify GPU availability and driver installation
|
||||
3. **High Latency**: Check network connectivity and resource utilization
|
||||
4. **Payment Failed**: Verify wallet has sufficient AIT balance
|
||||
### Common Issues and Solutions
|
||||
|
||||
#### Job Submission Failures
|
||||
```bash
|
||||
# Check wallet balance
|
||||
./aitbc-cli wallet balance --name genesis-ops
|
||||
|
||||
# Verify network connectivity
|
||||
./aitbc-cli network status
|
||||
|
||||
# Check AI service availability
|
||||
./aitbc-cli ai service status
|
||||
|
||||
# Verify job parameters
|
||||
./aitbc-cli ai job validate --type inference --prompt "test" --payment 50
|
||||
```
|
||||
|
||||
#### GPU Allocation Issues
|
||||
```bash
|
||||
# Check GPU availability
|
||||
nvidia-smi
|
||||
./aitbc-cli resource available --type gpu
|
||||
|
||||
# Verify GPU provider status
|
||||
./aitbc-cli gpu provider status --provider-id "provider_123"
|
||||
|
||||
# Check resource locks
|
||||
./aitbc-cli resource locks --list
|
||||
|
||||
# Release stuck resources
|
||||
./aitbc-cli resource release --allocation-id "alloc_123" --force
|
||||
```
|
||||
|
||||
#### Performance Issues
|
||||
```bash
|
||||
# Check system resources
|
||||
htop
|
||||
iostat -x 1
|
||||
|
||||
# Monitor GPU usage
|
||||
nvidia-smi dmon
|
||||
./aitbc-cli resource utilization --type gpu --live
|
||||
|
||||
# Check network latency
|
||||
ping aitbc1
|
||||
./aitbc-cli network latency --target aitbc1
|
||||
|
||||
# Analyze job logs
|
||||
./aitbc-cli ai job logs --job-id "job_123" --tail 100
|
||||
```
|
||||
|
||||
#### Payment Issues
|
||||
```bash
|
||||
# Check transaction status
|
||||
./aitbc-cli blockchain tx-status --tx-hash "0x123...abc"
|
||||
|
||||
# Verify wallet state
|
||||
./aitbc-cli wallet info --name genesis-ops
|
||||
|
||||
# Check payment queue
|
||||
./aitbc-cli ai payment queue --wallet genesis-ops
|
||||
|
||||
# Retry failed payment
|
||||
./aitbc-cli ai payment retry --job-id "job_123"
|
||||
```
|
||||
|
||||
### Debug Commands
|
||||
```bash
|
||||
@@ -220,6 +587,100 @@ ping aitbc1
|
||||
curl -s http://localhost:8006/health
|
||||
```
|
||||
|
||||
## Real-World Workflows
|
||||
|
||||
### Workflow 1: Batch Image Generation
|
||||
```bash
|
||||
# 1. Allocate GPU resources
|
||||
./aitbc-cli resource allocate --agent-id batch-gen --gpu 2 --memory 16384 --duration 7200
|
||||
|
||||
# 2. Submit batch job
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type inference --batch-file "prompts.json" --parallel 4 --payment 400
|
||||
|
||||
# 3. Monitor progress
|
||||
./aitbc-cli ai job status --job-id "job_123" --watch
|
||||
|
||||
# 4. Verify results
|
||||
./aitbc-cli ai job verify --job-id "job_123" --check-integrity
|
||||
|
||||
# 5. Release resources
|
||||
./aitbc-cli resource release --agent-id batch-gen
|
||||
```
|
||||
|
||||
### Workflow 2: Distributed Model Training
|
||||
```bash
|
||||
# 1. Register GPU providers on multiple nodes
|
||||
ssh aitbc1 './aitbc-cli gpu provider register --name "GPU-1" --gpu-count 2 --price 0.10'
|
||||
ssh aitbc2 './aitbc-cli gpu provider register --name "GPU-2" --gpu-count 4 --price 0.08'
|
||||
|
||||
# 2. Submit distributed training job
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type training --model "distributed-model" \
|
||||
--nodes "aitbc,aitbc1,aitbc2" --dataset "training.json" --payment 1000
|
||||
|
||||
# 3. Monitor training across nodes
|
||||
./aitbc-cli ai job status --job-id "job_456" --multi-node
|
||||
|
||||
# 4. Collect training metrics
|
||||
./aitbc-cli ai metrics training --job-id "job_456" --nodes "aitbc,aitbc1,aitbc2"
|
||||
```
|
||||
|
||||
### Workflow 3: Ollama GPU Provider Service
|
||||
```bash
|
||||
# 1. Set up Ollama on node
|
||||
ssh gitea-runner 'ollama serve &'
|
||||
ssh gitea-runner 'ollama pull llama2'
|
||||
ssh gitea-runner 'ollama pull mistral'
|
||||
|
||||
# 2. Register as Ollama provider
|
||||
./aitbc-cli gpu provider register --name "Ollama-Provider" --type ollama \
|
||||
--models "llama2,mistral" --gpu-count 1 --price 0.05
|
||||
|
||||
# 3. Submit Ollama jobs
|
||||
./aitbc-cli ai job submit --wallet genesis-ops --type ollama --provider "Ollama-Provider" \
|
||||
--model "llama2" --prompt "Analyze text" --payment 50
|
||||
|
||||
# 4. Monitor provider earnings
|
||||
./aitbc-cli gpu provider earnings --provider-id "provider_789" --period "7d"
|
||||
```
|
||||
|
||||
### Workflow 4: AI Service Marketplace
|
||||
```bash
|
||||
# 1. Create AI service
|
||||
./aitbc-cli market service create --name "Premium Image Gen" --type ai-inference \
|
||||
--price 100 --wallet genesis-ops --description "High-quality image generation"
|
||||
|
||||
# 2. Register as provider
|
||||
./aitbc-cli market provider register --name "AI-Service-Pro" --wallet genesis-ops
|
||||
|
||||
# 3. Customer bids on service
|
||||
./aitbc-cli market order bid --service-id "service_123" --amount 110 --wallet customer-wallet
|
||||
|
||||
# 4. Execute service
|
||||
./aitbc-cli market order execute --service-id "service_123" --job-data "prompt:Generate landscape"
|
||||
|
||||
# 5. Verify completion
|
||||
./aitbc-cli market order status --order-id "order_456"
|
||||
```
|
||||
|
||||
### Workflow 5: OpenClaw Multi-Agent Pipeline
|
||||
```bash
|
||||
# 1. Initialize agents
|
||||
openclaw agent init --name Data-Preprocessor --type data-worker
|
||||
openclaw agent init --name AI-Inference --type ai-worker
|
||||
openclaw agent init --name Result-Postprocessor --type data-worker
|
||||
|
||||
# 2. Configure agents
|
||||
openclaw agent configure --name AI-Inference --ai-model "llama2" --gpu-requirement 1
|
||||
|
||||
# 3. Execute pipeline
|
||||
openclaw execute --agent CoordinatorAgent --task run_pipeline \
|
||||
--workflow "Data-Preprocessor->AI-Inference->Result-Postprocessor" \
|
||||
--input "data.json" --output "results.json"
|
||||
|
||||
# 4. Monitor pipeline
|
||||
openclaw monitor --pipeline pipeline_123 --realtime
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Resource Management
|
||||
@@ -239,6 +700,10 @@ curl -s http://localhost:8006/health
|
||||
- Verify job integrity regularly
|
||||
- Monitor audit logs
|
||||
- Implement access controls
|
||||
- Use blockchain verification for critical jobs
|
||||
- Keep AI models and data isolated
|
||||
- Regular security audits of AI services
|
||||
- Implement rate limiting for API endpoints
|
||||
|
||||
### Performance
|
||||
- Use appropriate job types
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic AITBC AI operations testing with deterministic job submission and validation
|
||||
title: aitbc-ai-operations-skill
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# AITBC AI Operations Skill
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic AITBC AI job operations with deterministic monitoring and optimization
|
||||
title: aitbc-ai-operator
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# AITBC AI Operator
|
||||
@@ -17,15 +17,21 @@ Trigger when user requests AI operations: job submission, status monitoring, res
|
||||
{
|
||||
"operation": "submit|status|results|list|optimize|cancel",
|
||||
"wallet": "string (for submit/optimize)",
|
||||
"job_type": "inference|parallel|ensemble|multimodal|resource-allocation|performance-tuning|economic-modeling|marketplace-strategy|investment-strategy",
|
||||
"job_type": "inference|training|multimodal|ollama|streaming|monitoring",
|
||||
"prompt": "string (for submit)",
|
||||
"payment": "number (for submit)",
|
||||
"job_id": "string (for status/results/cancel)",
|
||||
"agent_id": "string (for optimize)",
|
||||
"cpu": "number (for optimize)",
|
||||
"memory": "number (for optimize)",
|
||||
"gpu": "number (for optimize)",
|
||||
"duration": "number (for optimize)",
|
||||
"limit": "number (optional for list)"
|
||||
"limit": "number (optional for list)",
|
||||
"model": "string (optional for ollama jobs, e.g., llama2, mistral)",
|
||||
"provider_id": "string (optional for GPU provider selection)",
|
||||
"endpoint": "string (optional for custom Ollama endpoint)",
|
||||
"batch_file": "string (optional for batch operations)",
|
||||
"parallel": "number (optional for parallel job count)"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -91,9 +97,13 @@ Trigger when user requests AI operations: job submission, status monitoring, res
|
||||
## Environment Assumptions
|
||||
- AITBC CLI accessible at `/opt/aitbc/aitbc-cli`
|
||||
- AI services operational (Ollama, exchange, coordinator)
|
||||
- Ollama endpoint accessible at `http://localhost:11434` or custom endpoint
|
||||
- GPU provider marketplace operational for resource allocation
|
||||
- Sufficient wallet balance for job payments
|
||||
- Resource allocation system operational
|
||||
- Job queue processing functional
|
||||
- Ollama models available: llama2, mistral, codellama, etc.
|
||||
- GPU providers registered with unique p2p_node_id for P2P connectivity
|
||||
|
||||
## Error Handling
|
||||
- Insufficient balance → Return error with required amount
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic AITBC blockchain analytics and performance metrics with deterministic outputs
|
||||
title: aitbc-analytics-analyzer
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# AITBC Analytics Analyzer
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic AITBC basic operations testing with deterministic validation and health checks
|
||||
title: aitbc-basic-operations-skill
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# AITBC Basic Operations Skill
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic AITBC marketplace operations with deterministic pricing and listing management
|
||||
title: aitbc-marketplace-participant
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# AITBC Marketplace Participant
|
||||
@@ -15,15 +15,19 @@ Trigger when user requests marketplace operations: listing creation, price optim
|
||||
## Input
|
||||
```json
|
||||
{
|
||||
"operation": "create|list|analyze|optimize|trade|status",
|
||||
"service_type": "ai-inference|ai-training|resource-compute|resource-storage|data-processing",
|
||||
"name": "string (for create)",
|
||||
"operation": "create|list|analyze|optimize|trade|status|gpu-provider-register|gpu-provider-status",
|
||||
"service_type": "ai-inference|ai-training|resource-compute|resource-storage|data-processing|gpu-provider",
|
||||
"name": "string (for create/gpu-provider-register)",
|
||||
"description": "string (for create)",
|
||||
"price": "number (for create/optimize)",
|
||||
"wallet": "string (for create/trade)",
|
||||
"wallet": "string (for create/trade/gpu-provider-register)",
|
||||
"listing_id": "string (for status/trade)",
|
||||
"provider_id": "string (for gpu-provider-status)",
|
||||
"quantity": "number (for create/trade)",
|
||||
"duration": "number (for create, hours)",
|
||||
"gpu_model": "string (for gpu-provider-register)",
|
||||
"gpu_count": "number (for gpu-provider-register)",
|
||||
"models": "array (optional for gpu-provider-register, e.g., [\"llama2\", \"mistral\"])",
|
||||
"competitor_analysis": "boolean (optional for analyze)",
|
||||
"market_trends": "boolean (optional for analyze)"
|
||||
}
|
||||
@@ -33,17 +37,22 @@ Trigger when user requests marketplace operations: listing creation, price optim
|
||||
```json
|
||||
{
|
||||
"summary": "Marketplace operation completed successfully",
|
||||
"operation": "create|list|analyze|optimize|trade|status",
|
||||
"operation": "create|list|analyze|optimize|trade|status|gpu-provider-register|gpu-provider-status",
|
||||
"listing_id": "string (for create/status/trade)",
|
||||
"provider_id": "string (for gpu-provider-register/gpu-provider-status)",
|
||||
"service_type": "string",
|
||||
"name": "string (for create)",
|
||||
"name": "string (for create/gpu-provider-register)",
|
||||
"price": "number",
|
||||
"wallet": "string (for create/trade)",
|
||||
"wallet": "string (for create/trade/gpu-provider-register)",
|
||||
"quantity": "number",
|
||||
"gpu_model": "string (for gpu-provider-register/gpu-provider-status)",
|
||||
"gpu_count": "number (for gpu-provider-register/gpu-provider-status)",
|
||||
"models": "array (for gpu-provider-register/gpu-provider-status)",
|
||||
"market_data": "object (for analyze)",
|
||||
"competitor_analysis": "array (for analyze)",
|
||||
"pricing_recommendations": "array (for optimize)",
|
||||
"trade_details": "object (for trade)",
|
||||
"provider_status": "object (for gpu-provider-status)",
|
||||
"issues": [],
|
||||
"recommendations": [],
|
||||
"confidence": 1.0,
|
||||
@@ -90,8 +99,11 @@ Trigger when user requests marketplace operations: listing creation, price optim
|
||||
- AITBC CLI accessible at `/opt/aitbc/aitbc-cli`
|
||||
- Marketplace service operational
|
||||
- Exchange API accessible for pricing data
|
||||
- GPU provider marketplace operational for resource allocation
|
||||
- Ollama GPU providers can register with model specifications
|
||||
- Sufficient wallet balance for listing fees
|
||||
- Market data available for analysis
|
||||
- GPU providers have unique p2p_node_id for P2P connectivity
|
||||
|
||||
## Error Handling
|
||||
- Invalid service type → Return service type validation error
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic AITBC cross-node coordination and messaging operations with deterministic outputs
|
||||
title: aitbc-node-coordinator
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# AITBC Node Coordinator
|
||||
@@ -134,14 +134,16 @@ Trigger when user requests cross-node operations: synchronization, coordination,
|
||||
- SSH keys located at `/root/.ssh/` for passwordless access
|
||||
- Blockchain nodes operational on both nodes via systemd services
|
||||
- P2P mesh network active on port 7070 with peer configuration
|
||||
- Unique node IDs configured: each node has unique `proposer_id` and `p2p_node_id` in `/etc/aitbc/.env` and `/etc/aitbc/node.env`
|
||||
- Git synchronization configured between nodes at `/opt/aitbc/.git`
|
||||
- CLI accessible on both nodes at `/opt/aitbc/aitbc-cli`
|
||||
- Python venv activated at `/opt/aitbc/venv/bin/python` for CLI operations
|
||||
- Systemd services: `aitbc-blockchain-node.service` on both nodes
|
||||
- Node addresses: genesis (localhost/aitbc), follower (aitbc1)
|
||||
- Systemd services: `aitbc-blockchain-node.service` and `aitbc-blockchain-p2p.service` on both nodes
|
||||
- Node addresses: genesis (localhost/aitbc), follower (aitbc1), gitea-runner
|
||||
- Git remote: `origin` at `http://gitea.bubuit.net:3000/oib/aitbc.git`
|
||||
- Log directory: `/var/log/aitbc/` for service logs
|
||||
- Data directory: `/var/lib/aitbc/` for blockchain data
|
||||
- Node identity utility: `/opt/aitbc/scripts/utils/generate_unique_node_ids.py` for ID generation
|
||||
|
||||
## Error Handling
|
||||
- SSH connectivity failures → Return connection error with affected node, attempt fallback node
|
||||
@@ -150,7 +152,8 @@ Trigger when user requests cross-node operations: synchronization, coordination,
|
||||
- Sync failures → Return partial sync with details, identify which sync type failed
|
||||
- Timeout during operations → Return timeout error with operation details, suggest increasing timeout
|
||||
- Git synchronization conflicts → Return conflict error, suggest manual resolution
|
||||
- P2P network disconnection → Return network error, check mesh network status
|
||||
- P2P network disconnection → Return network error, check mesh network status and node IDs
|
||||
- P2P handshake rejection → Check for duplicate p2p_node_id, run `/opt/aitbc/scripts/utils/generate_unique_node_ids.py`
|
||||
- Service restart failures → Return service error, check systemd logs
|
||||
- Node unreachable → Return unreachable error, verify network connectivity
|
||||
- Invalid target node → Return validation error, suggest valid node names
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
name: aitbc-ripgrep-specialist
|
||||
description: Expert ripgrep (rg) specialist for AITBC system with advanced search patterns, performance optimization, and codebase analysis techniques
|
||||
author: AITBC System Architect
|
||||
version: 1.0.0
|
||||
version: 1.1
|
||||
usage: Use this skill for advanced ripgrep operations, codebase analysis, pattern matching, and performance optimization in AITBC system
|
||||
---
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic AITBC transaction processing with deterministic validation and tracking
|
||||
title: aitbc-transaction-processor
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# AITBC Transaction Processor
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic AITBC wallet management operations with deterministic outputs
|
||||
title: aitbc-wallet-manager
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# AITBC Wallet Manager
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Autonomous AI skill for blockchain troubleshooting and recovery across multi-node AITBC setup
|
||||
title: Blockchain Troubleshoot & Recovery
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# Blockchain Troubleshoot & Recovery Skill
|
||||
@@ -18,13 +18,15 @@ Activate this skill when:
|
||||
- Git synchronization fails
|
||||
- Network latency issues detected
|
||||
- Service health checks fail
|
||||
- P2P handshake rejections (duplicate node IDs)
|
||||
- Nodes with identical p2p_node_id or proposer_id
|
||||
|
||||
## Input Schema
|
||||
```json
|
||||
{
|
||||
"issue_type": {
|
||||
"type": "string",
|
||||
"enum": ["connectivity", "sync_lag", "transaction_timeout", "service_failure", "git_sync_failure", "network_latency", "unknown"],
|
||||
"enum": ["connectivity", "sync_lag", "transaction_timeout", "service_failure", "git_sync_failure", "network_latency", "p2p_identity_conflict", "unknown"],
|
||||
"description": "Type of blockchain communication issue"
|
||||
},
|
||||
"affected_nodes": {
|
||||
@@ -133,6 +135,34 @@ Based on diagnostic data, identify:
|
||||
|
||||
### 3. Execute Recovery Actions
|
||||
|
||||
#### P2P Identity Conflict Recovery
|
||||
```bash
|
||||
# Check current node IDs on all nodes
|
||||
echo "=== aitbc node IDs ==="
|
||||
grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env
|
||||
|
||||
echo "=== aitbc1 node IDs ==="
|
||||
ssh aitbc1 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env'
|
||||
|
||||
echo "=== gitea-runner node IDs ==="
|
||||
ssh gitea-runner 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env'
|
||||
|
||||
# Run unique ID generation on affected nodes
|
||||
python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py
|
||||
ssh aitbc1 'python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py'
|
||||
ssh gitea-runner 'python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py'
|
||||
|
||||
# Restart P2P services on all nodes
|
||||
systemctl restart aitbc-blockchain-p2p
|
||||
ssh aitbc1 'systemctl restart aitbc-blockchain-p2p'
|
||||
ssh gitea-runner 'systemctl restart aitbc-blockchain-p2p'
|
||||
|
||||
# Verify P2P connectivity
|
||||
journalctl -u aitbc-blockchain-p2p -n 30 --no-pager
|
||||
ssh aitbc1 'journalctl -u aitbc-blockchain-p2p -n 30 --no-pager'
|
||||
ssh gitea-runner 'journalctl -u aitbc-blockchain-p2p -n 30 --no-pager'
|
||||
```
|
||||
|
||||
#### Connectivity Recovery
|
||||
```bash
|
||||
# Restart network services
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Autonomous skill for SSH-based investigation of gitea-runner CI logs, runner health, and root-cause-oriented debug guidance
|
||||
title: Gitea Runner Log Debugger
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# Gitea Runner Log Debugger Skill
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic Ollama GPU inference testing with deterministic performance validation and benchmarking
|
||||
title: ollama-gpu-testing-skill
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# Ollama GPU Testing Skill
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic OpenClaw agent communication with deterministic message handling and response validation
|
||||
title: openclaw-agent-communicator
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# OpenClaw Agent Communicator
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic OpenClaw agent testing with deterministic communication validation and performance metrics
|
||||
title: openclaw-agent-testing-skill
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# OpenClaw Agent Testing Skill
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic OpenClaw multi-agent workflow coordination with deterministic outputs
|
||||
title: openclaw-coordination-orchestrator
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# OpenClaw Coordination Orchestrator
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic OpenClaw error detection and recovery procedures with deterministic outputs
|
||||
title: openclaw-error-handler
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# OpenClaw Error Handler
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic OpenClaw agent performance tuning and optimization with deterministic outputs
|
||||
title: openclaw-performance-optimizer
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# OpenClaw Performance Optimizer
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
description: Atomic OpenClaw session management with deterministic context preservation and workflow coordination
|
||||
title: openclaw-session-manager
|
||||
version: 1.0
|
||||
version: 1.1
|
||||
---
|
||||
|
||||
# OpenClaw Session Manager
|
||||
|
||||
@@ -435,7 +435,7 @@ Two-Node AITBC Blockchain:
|
||||
- Added quick reference commands and troubleshooting
|
||||
|
||||
### Previous Versions
|
||||
- **Monolithic Workflow**: `multi-node-blockchain-setup.md` (64KB, 2,098 lines)
|
||||
- **Archived Monolithic Workflow**: `archive/multi-node-blockchain-setup.md` (64KB, 2,098 lines)
|
||||
- **OpenClaw Integration**: `multi-node-blockchain-setup-openclaw.md`
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
@@ -1,275 +0,0 @@
|
||||
---
|
||||
description: Master index for AITBC testing workflows - links to all test modules and provides navigation
|
||||
title: AITBC Testing Workflows - Master Index
|
||||
version: 2.0 (100% Complete)
|
||||
---
|
||||
|
||||
# AITBC Testing Workflows - Master Index
|
||||
|
||||
**Project Status**: ✅ **100% COMPLETED** (v0.3.0 - April 2, 2026)
|
||||
|
||||
This master index provides navigation to all modules in the AITBC testing and debugging documentation. Each module focuses on specific aspects of testing and validation. All test workflows reflect the 100% project completion status with 100% test success rate achieved.
|
||||
|
||||
## 🎉 **Testing Completion Status**
|
||||
|
||||
### **✅ Test Results: 100% Success Rate**
|
||||
- **Production Monitoring Test**: ✅ PASSED
|
||||
- **Type Safety Test**: ✅ PASSED
|
||||
- **JWT Authentication Test**: ✅ PASSED
|
||||
- **Advanced Features Test**: ✅ PASSED
|
||||
- **Overall Success Rate**: 100% (4/4 major test suites)
|
||||
|
||||
### **✅ Test Coverage: All 9 Systems**
|
||||
1. **System Architecture**: ✅ Complete FHS compliance testing
|
||||
2. **Service Management**: ✅ Single marketplace service testing
|
||||
3. **Basic Security**: ✅ Secure keystore implementation testing
|
||||
4. **Agent Systems**: ✅ Multi-agent coordination testing
|
||||
5. **API Functionality**: ✅ 17/17 endpoints testing
|
||||
6. **Test Suite**: ✅ 100% test success rate validation
|
||||
7. **Advanced Security**: ✅ JWT auth and RBAC testing
|
||||
8. **Production Monitoring**: ✅ Prometheus metrics and alerting testing
|
||||
9. **Type Safety**: ✅ MyPy strict checking validation
|
||||
|
||||
---
|
||||
|
||||
## 📚 Test Module Overview
|
||||
|
||||
### 🔧 Basic Testing Module
|
||||
**File**: `test-basic.md`
|
||||
**Purpose**: Core CLI functionality and basic operations testing
|
||||
**Audience**: Developers, system administrators
|
||||
**Prerequisites**: None (base module)
|
||||
|
||||
**Key Topics**:
|
||||
- CLI command testing
|
||||
- Basic blockchain operations
|
||||
- Wallet operations
|
||||
- Service connectivity
|
||||
- Basic troubleshooting
|
||||
|
||||
**Quick Start**:
|
||||
```bash
|
||||
# Run basic CLI tests
|
||||
cd /opt/aitbc
|
||||
source venv/bin/activate
|
||||
python -m pytest cli/tests/ -v
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 🤖 OpenClaw Agent Testing Module
|
||||
**File**: `test-openclaw-agents.md`
|
||||
**Purpose**: OpenClaw agent functionality and coordination testing
|
||||
**Audience**: AI developers, system administrators
|
||||
**Prerequisites**: Basic Testing Module
|
||||
|
||||
**Key Topics**:
|
||||
- Agent communication testing
|
||||
- Multi-agent coordination
|
||||
- Session management
|
||||
- Thinking levels
|
||||
- Agent workflow validation
|
||||
|
||||
**Quick Start**:
|
||||
```bash
|
||||
# Test OpenClaw agents
|
||||
openclaw agent --agent GenesisAgent --session-id test --message "Test message" --thinking low
|
||||
openclaw agent --agent FollowerAgent --session-id test --message "Test response" --thinking low
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 🚀 AI Operations Testing Module
|
||||
**File**: `test-ai-operations.md`
|
||||
**Purpose**: AI job submission, processing, and resource management testing
|
||||
**Audience**: AI developers, system administrators
|
||||
**Prerequisites**: Basic Testing Module
|
||||
|
||||
**Key Topics**:
|
||||
- AI job submission and monitoring
|
||||
- Resource allocation testing
|
||||
- Performance validation
|
||||
- AI service integration
|
||||
- Error handling and recovery
|
||||
|
||||
**Quick Start**:
|
||||
```bash
|
||||
# Test AI operations
|
||||
./aitbc-cli ai submit --wallet genesis-ops --type inference --prompt "Test AI job" --payment 100
|
||||
./aitbc-cli ai status --job-id latest
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 🔄 Advanced AI Testing Module
|
||||
**File**: `test-advanced-ai.md`
|
||||
**Purpose**: Advanced AI capabilities including workflow orchestration and multi-model pipelines
|
||||
**Audience**: AI developers, system administrators
|
||||
**Prerequisites**: Basic Testing + AI Operations Modules
|
||||
|
||||
**Key Topics**:
|
||||
- Advanced AI workflow orchestration
|
||||
- Multi-model AI pipelines
|
||||
- Ensemble management
|
||||
- Multi-modal processing
|
||||
- Performance optimization
|
||||
|
||||
**Quick Start**:
|
||||
```bash
|
||||
# Test advanced AI operations
|
||||
./aitbc-cli ai submit --wallet genesis-ops --type parallel --prompt "Complex pipeline test" --payment 500
|
||||
./aitbc-cli ai submit --wallet genesis-ops --type multimodal --prompt "Multi-modal test" --payment 1000
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 🌐 Cross-Node Testing Module
|
||||
**File**: `test-cross-node.md`
|
||||
**Purpose**: Multi-node coordination, distributed operations, and node synchronization testing
|
||||
**Audience**: System administrators, network engineers
|
||||
**Prerequisites**: Basic Testing + AI Operations Modules
|
||||
|
||||
**Key Topics**:
|
||||
- Cross-node communication
|
||||
- Distributed AI operations
|
||||
- Node synchronization
|
||||
- Multi-node blockchain operations
|
||||
- Network resilience testing
|
||||
|
||||
**Quick Start**:
|
||||
```bash
|
||||
# Test cross-node operations
|
||||
ssh aitbc1 'cd /opt/aitbc && ./aitbc-cli blockchain info'
|
||||
./aitbc-cli resource status
|
||||
ssh aitbc1 'cd /opt/aitbc && ./aitbc-cli resource status'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 📊 Performance Testing Module
|
||||
**File**: `test-performance.md`
|
||||
**Purpose**: System performance, load testing, and optimization validation
|
||||
**Audience**: Performance engineers, system administrators
|
||||
**Prerequisites**: All previous modules
|
||||
|
||||
**Key Topics**:
|
||||
- Load testing
|
||||
- Performance benchmarking
|
||||
- Resource utilization analysis
|
||||
- Scalability testing
|
||||
- Optimization validation
|
||||
|
||||
**Quick Start**:
|
||||
```bash
|
||||
# Run performance tests
|
||||
./aitbc-cli simulate blockchain --blocks 100 --transactions 1000 --delay 0
|
||||
./aitbc-cli resource allocate --agent-id perf-test --cpu 4 --memory 8192 --duration 3600
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 🛠️ Integration Testing Module
|
||||
**File**: `test-integration.md`
|
||||
**Purpose**: End-to-end integration testing across all system components
|
||||
**Audience**: QA engineers, system administrators
|
||||
**Prerequisites**: All previous modules
|
||||
|
||||
**Key Topics**:
|
||||
- End-to-end workflow testing
|
||||
- Service integration validation
|
||||
- Cross-component communication
|
||||
- System resilience testing
|
||||
- Production readiness validation
|
||||
|
||||
**Quick Start**:
|
||||
```bash
|
||||
# Run integration tests
|
||||
cd /opt/aitbc
|
||||
./scripts/workflow-openclaw/06_advanced_ai_workflow_openclaw.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Test Dependencies
|
||||
|
||||
```
|
||||
test-basic.md (foundation)
|
||||
├── test-openclaw-agents.md (depends on basic)
|
||||
├── test-ai-operations.md (depends on basic)
|
||||
├── test-advanced-ai.md (depends on basic + ai-operations)
|
||||
├── test-cross-node.md (depends on basic + ai-operations)
|
||||
├── test-performance.md (depends on all previous)
|
||||
└── test-integration.md (depends on all previous)
|
||||
```
|
||||
|
||||
## 🎯 Testing Strategy
|
||||
|
||||
### Phase 1: Basic Validation
|
||||
1. **Basic Testing Module** - Verify core functionality
|
||||
2. **OpenClaw Agent Testing** - Validate agent operations
|
||||
3. **AI Operations Testing** - Confirm AI job processing
|
||||
|
||||
### Phase 2: Advanced Validation
|
||||
4. **Advanced AI Testing** - Test complex AI workflows
|
||||
5. **Cross-Node Testing** - Validate distributed operations
|
||||
6. **Performance Testing** - Benchmark system performance
|
||||
|
||||
### Phase 3: Production Readiness
|
||||
7. **Integration Testing** - End-to-end validation
|
||||
8. **Production Validation** - Production readiness confirmation
|
||||
|
||||
## 📋 Quick Reference
|
||||
|
||||
### 🚀 Quick Test Commands
|
||||
```bash
|
||||
# Basic functionality test
|
||||
./aitbc-cli --version && ./aitbc-cli blockchain info
|
||||
|
||||
# OpenClaw agent test
|
||||
openclaw agent --agent GenesisAgent --session-id quick-test --message "Quick test" --thinking low
|
||||
|
||||
# AI operations test
|
||||
./aitbc-cli ai submit --wallet genesis-ops --type inference --prompt "Quick test" --payment 50
|
||||
|
||||
# Cross-node test
|
||||
ssh aitbc1 'cd /opt/aitbc && ./aitbc-cli blockchain info'
|
||||
|
||||
# Performance test
|
||||
./aitbc-cli simulate blockchain --blocks 10 --transactions 50 --delay 0
|
||||
```
|
||||
|
||||
### 🔍 Troubleshooting Quick Links
|
||||
- **[Basic Issues](test-basic.md#troubleshooting)** - CLI and service problems
|
||||
- **[Agent Issues](test-openclaw-agents.md#troubleshooting)** - OpenClaw agent problems
|
||||
- **[AI Issues](test-ai-operations.md#troubleshooting)** - AI job processing problems
|
||||
- **[Network Issues](test-cross-node.md#troubleshooting)** - Cross-node communication problems
|
||||
- **[Performance Issues](test-performance.md#troubleshooting)** - System performance problems
|
||||
|
||||
## 📚 Related Documentation
|
||||
|
||||
- **[Multi-Node Blockchain Setup](MULTI_NODE_MASTER_INDEX.md)** - System setup and configuration
|
||||
- **[CLI Documentation](../docs/CLI_DOCUMENTATION.md)** - Complete CLI reference
|
||||
- **[OpenClaw Agent Capabilities](../docs/openclaw/OPENCLAW_AGENT_CAPABILITIES_ADVANCED.md)** - Advanced agent features
|
||||
- **[GitHub Operations](github.md)** - Git operations and multi-node sync
|
||||
|
||||
## 🎯 Success Metrics
|
||||
|
||||
### Test Coverage Targets
|
||||
- **Basic Tests**: 100% core functionality coverage
|
||||
- **Agent Tests**: 95% agent operation coverage
|
||||
- **AI Tests**: 90% AI workflow coverage
|
||||
- **Performance Tests**: 85% performance scenario coverage
|
||||
- **Integration Tests**: 80% end-to-end scenario coverage
|
||||
|
||||
### Quality Gates
|
||||
- **All Tests Pass**: 0 critical failures
|
||||
- **Performance Benchmarks**: Meet or exceed targets
|
||||
- **Resource Utilization**: Within acceptable limits
|
||||
- **Cross-Node Sync**: 100% synchronization success
|
||||
- **AI Operations**: 95%+ success rate
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2026-03-30
|
||||
**Version**: 1.0
|
||||
**Status**: Ready for Implementation
|
||||
@@ -162,6 +162,71 @@ echo "Tracked Runtime Files:"
|
||||
git ls-files | grep -E "(data/|config/|logs/|\.log|\.db)" || echo "✅ No tracked runtime files"
|
||||
```
|
||||
|
||||
#### 2.3 Node Identity Audit
|
||||
```bash
|
||||
# Audit unique node identities across all nodes
|
||||
echo "=== 5.5 NODE IDENTITY AUDIT ==="
|
||||
|
||||
# Check aitbc node IDs
|
||||
echo "aitbc Node IDs:"
|
||||
grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env 2>/dev/null || echo "❌ Node ID files not found"
|
||||
|
||||
# Check aitbc1 node IDs
|
||||
echo "aitbc1 Node IDs:"
|
||||
ssh aitbc1 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env' 2>/dev/null || echo "❌ aitbc1 node ID files not found"
|
||||
|
||||
# Check gitea-runner node IDs
|
||||
echo "gitea-runner Node IDs:"
|
||||
ssh gitea-runner 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env' 2>/dev/null || echo "❌ gitea-runner node ID files not found"
|
||||
|
||||
# Verify uniqueness
|
||||
echo "Uniqueness Verification:"
|
||||
AITBC_P2P=$(grep "^p2p_node_id=" /etc/aitbc/node.env 2>/dev/null | cut -d= -f2)
|
||||
AITBC1_P2P=$(ssh aitbc1 'grep "^p2p_node_id=" /etc/aitbc/node.env' 2>/dev/null | cut -d= -f2)
|
||||
GITEA_P2P=$(ssh gitea-runner 'grep "^p2p_node_id=" /etc/aitbc/node.env' 2>/dev/null | cut -d= -f2)
|
||||
|
||||
DUPLICATE_COUNT=0
|
||||
if [ "$AITBC_P2P" == "$AITBC1_P2P" ] && [ -n "$AITBC_P2P" ]; then
|
||||
echo "❌ Duplicate p2p_node_id between aitbc and aitbc1"
|
||||
DUPLICATE_COUNT=$((DUPLICATE_COUNT + 1))
|
||||
fi
|
||||
if [ "$AITBC_P2P" == "$GITEA_P2P" ] && [ -n "$AITBC_P2P" ] && [ -n "$GITEA_P2P" ]; then
|
||||
echo "❌ Duplicate p2p_node_id between aitbc and gitea-runner"
|
||||
DUPLICATE_COUNT=$((DUPLICATE_COUNT + 1))
|
||||
fi
|
||||
if [ "$AITBC1_P2P" == "$GITEA_P2P" ] && [ -n "$AITBC1_P2P" ] && [ -n "$GITEA_P2P" ]; then
|
||||
echo "❌ Duplicate p2p_node_id between aitbc1 and gitea-runner"
|
||||
DUPLICATE_COUNT=$((DUPLICATE_COUNT + 1))
|
||||
fi
|
||||
|
||||
if [ $DUPLICATE_COUNT -eq 0 ]; then
|
||||
echo "✅ All node IDs are unique"
|
||||
else
|
||||
echo "❌ Found $DUPLICATE_COUNT duplicate node ID(s)"
|
||||
echo "Run remediation: python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py"
|
||||
fi
|
||||
```
|
||||
|
||||
#### 2.4 P2P Network Configuration Audit
|
||||
```bash
|
||||
# Audit P2P network configuration
|
||||
echo "=== 5.6 P2P NETWORK CONFIGURATION AUDIT ==="
|
||||
|
||||
# Check P2P service status
|
||||
echo "P2P Service Status:"
|
||||
systemctl status aitbc-blockchain-p2p.service --no-pager | grep -E "(Active|loaded)" || echo "❌ P2P service not found"
|
||||
ssh aitbc1 'systemctl status aitbc-blockchain-p2p.service --no-pager' | grep -E "(Active|loaded)" || echo "❌ aitbc1 P2P service not found"
|
||||
|
||||
# Check for P2P handshake errors
|
||||
echo "P2P Handshake Errors:"
|
||||
journalctl -u aitbc-blockchain-p2p --no-pager | grep -c "invalid or self node_id" || echo "0 errors on aitbc"
|
||||
ssh aitbc1 'journalctl -u aitbc-blockchain-p2p --no-pager | grep -c "invalid or self node_id"' || echo "0 errors on aitbc1"
|
||||
|
||||
# Verify P2P service uses p2p_node_id
|
||||
echo "P2P Service Configuration:"
|
||||
grep "node-id" /etc/systemd/system/aitbc-blockchain-p2p.service 2>/dev/null || echo "❌ P2P service not configured with node-id"
|
||||
```
|
||||
|
||||
### Phase 3: Path Rewire Operations
|
||||
**Objective**: Automatically rewire incorrect paths to system locations
|
||||
|
||||
|
||||
@@ -215,6 +215,34 @@ ssh aitbc1 'systemctl restart aitbc-blockchain-p2p'
|
||||
./aitbc-cli network status --verbose
|
||||
```
|
||||
|
||||
#### P2P Identity Conflict (Duplicate Node IDs)
|
||||
```bash
|
||||
# Check current node IDs on all nodes
|
||||
echo "=== aitbc node IDs ==="
|
||||
grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env
|
||||
|
||||
echo "=== aitbc1 node IDs ==="
|
||||
ssh aitbc1 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env'
|
||||
|
||||
echo "=== gitea-runner node IDs ==="
|
||||
ssh gitea-runner 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env'
|
||||
|
||||
# Run unique ID generation on affected nodes
|
||||
python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py
|
||||
ssh aitbc1 'python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py'
|
||||
ssh gitea-runner 'python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py'
|
||||
|
||||
# Restart P2P services on all nodes
|
||||
systemctl restart aitbc-blockchain-p2p
|
||||
ssh aitbc1 'systemctl restart aitbc-blockchain-p2p'
|
||||
ssh gitea-runner 'systemctl restart aitbc-blockchain-p2p'
|
||||
|
||||
# Verify P2P connectivity
|
||||
journalctl -u aitbc-blockchain-p2p -n 30 --no-pager
|
||||
ssh aitbc1 'journalctl -u aitbc-blockchain-p2p -n 30 --no-pager'
|
||||
ssh gitea-runner 'journalctl -u aitbc-blockchain-p2p -n 30 --no-pager'
|
||||
```
|
||||
|
||||
## Success Criteria
|
||||
- Both nodes respond to health checks
|
||||
- Block heights match within 2 blocks
|
||||
|
||||
@@ -180,6 +180,70 @@ DATA_SERVICE_ID=$(./aitbc-cli market search --query "data processing" | grep "se
|
||||
./aitbc-cli market settle-payment --service-id $DATA_SERVICE_ID --amount 30 --wallet enterprise-1
|
||||
```
|
||||
|
||||
## Ollama GPU Provider Operations
|
||||
|
||||
### Ollama GPU Provider Registration
|
||||
|
||||
```bash
|
||||
# Register GPU provider with Ollama model support
|
||||
./aitbc-cli market create \
|
||||
--type gpu-provider \
|
||||
--price 100 \
|
||||
--wallet gpu-provider \
|
||||
--description "Ollama GPU inference with llama2, mistral, codellama support"
|
||||
|
||||
# Register with specific model specifications
|
||||
./aitbc-cli provider register \
|
||||
--name ollama-gpu-provider \
|
||||
--gpu-model "NVIDIA RTX 4090" \
|
||||
--gpu-count 1 \
|
||||
--models "llama2,mistral,codellama,llama3.2:latest" \
|
||||
--wallet gpu-provider
|
||||
|
||||
# Verify provider registration
|
||||
./aitbc-cli provider status --provider-id "ollama-gpu-provider"
|
||||
```
|
||||
|
||||
### Ollama GPU Provider Testing
|
||||
|
||||
```bash
|
||||
# Test Ollama GPU inference with specific model
|
||||
./aitbc-cli ai submit --wallet test-wallet --type ollama \
|
||||
--prompt "What is the capital of France?" \
|
||||
--model "llama3.2:latest" \
|
||||
--payment 50 \
|
||||
--provider-id "ollama-gpu-provider"
|
||||
|
||||
# Monitor Ollama job execution
|
||||
./aitbc-cli ai status --job-id "ollama_job_123"
|
||||
|
||||
# Retrieve Ollama results
|
||||
./aitbc-cli ai results --job-id "ollama_job_123"
|
||||
|
||||
# Test streaming Ollama responses
|
||||
./aitbc-cli ai submit --wallet test-wallet --type ollama-streaming \
|
||||
--prompt "Generate a short story" \
|
||||
--model "mistral" \
|
||||
--payment 100 \
|
||||
--provider-id "ollama-gpu-provider"
|
||||
```
|
||||
|
||||
### GPU Provider Marketplace Operations
|
||||
|
||||
```bash
|
||||
# List all registered GPU providers
|
||||
./aitbc-cli provider list --type gpu-provider
|
||||
|
||||
# Check GPU provider availability
|
||||
./aitbc-cli provider availability --provider-id "ollama-gpu-provider"
|
||||
|
||||
# Query GPU provider models
|
||||
./aitbc-cli provider models --provider-id "ollama-gpu-provider"
|
||||
|
||||
# Compare GPU provider pricing
|
||||
./aitbc-cli provider pricing --type gpu-provider
|
||||
```
|
||||
|
||||
## GPU Provider Testing
|
||||
|
||||
### GPU Resource Allocation Testing
|
||||
|
||||
@@ -101,6 +101,65 @@ ping -c 5 aitbc1
|
||||
ssh aitbc1 'ping -c 5 localhost'
|
||||
```
|
||||
|
||||
### Node Identity Verification
|
||||
|
||||
```bash
|
||||
# Verify unique node IDs across all nodes
|
||||
echo "=== aitbc node IDs ==="
|
||||
grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env
|
||||
|
||||
echo "=== aitbc1 node IDs ==="
|
||||
ssh aitbc1 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env'
|
||||
|
||||
echo "=== gitea-runner node IDs ==="
|
||||
ssh gitea-runner 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env'
|
||||
|
||||
# Check for duplicate IDs
|
||||
AITBC_P2P=$(grep "^p2p_node_id=" /etc/aitbc/node.env | cut -d= -f2)
|
||||
AITBC1_P2P=$(ssh aitbc1 'grep "^p2p_node_id=" /etc/aitbc/node.env | cut -d= -f2')
|
||||
|
||||
if [ "$AITBC_P2P" == "$AITBC1_P2P" ]; then
|
||||
echo "WARNING: Duplicate p2p_node_id detected!"
|
||||
echo "Run: python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py"
|
||||
fi
|
||||
```
|
||||
|
||||
### P2P Health Check
|
||||
|
||||
```bash
|
||||
# Check P2P service status on all nodes
|
||||
systemctl status aitbc-blockchain-p2p.service --no-pager
|
||||
ssh aitbc1 'systemctl status aitbc-blockchain-p2p.service --no-pager'
|
||||
ssh gitea-runner 'systemctl status aitbc-blockchain-p2p.service --no-pager'
|
||||
|
||||
# Verify P2P connectivity and peer connections
|
||||
journalctl -u aitbc-blockchain-p2p -n 30 --no-pager | grep -E "(peer|handshake|connected)"
|
||||
ssh aitbc1 'journalctl -u aitbc-blockchain-p2p -n 30 --no-pager | grep -E "(peer|handshake|connected)'
|
||||
|
||||
# Check for P2P handshake rejections (duplicate IDs)
|
||||
journalctl -u aitbc-blockchain-p2p --no-pager | grep "invalid or self node_id"
|
||||
ssh aitbc1 'journalctl -u aitbc-blockchain-p2p --no-pager | grep "invalid or self node_id"
|
||||
```
|
||||
|
||||
### Node Identity Remediation
|
||||
|
||||
```bash
|
||||
# If duplicate IDs detected, run remediation
|
||||
python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py
|
||||
ssh aitbc1 'python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py'
|
||||
ssh gitea-runner 'python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py'
|
||||
|
||||
# Restart P2P services on all nodes
|
||||
systemctl restart aitbc-blockchain-p2p
|
||||
ssh aitbc1 'systemctl restart aitbc-blockchain-p2p'
|
||||
ssh gitea-runner 'systemctl restart aitbc-blockchain-p2p'
|
||||
|
||||
# Verify P2P connectivity after remediation
|
||||
sleep 5
|
||||
journalctl -u aitbc-blockchain-p2p -n 20 --no-pager
|
||||
ssh aitbc1 'journalctl -u aitbc-blockchain-p2p -n 20 --no-pager'
|
||||
```
|
||||
|
||||
## Troubleshooting Common Issues
|
||||
|
||||
### Service Issues
|
||||
|
||||
@@ -46,6 +46,44 @@ The workflow uses the single central `/etc/aitbc/.env` file as the configuration
|
||||
- **Standard Location**: Config moved to `/etc/aitbc/` following system standards
|
||||
- **CLI Integration**: AITBC CLI tool uses this config file by default
|
||||
|
||||
## Unique Node Identity Configuration
|
||||
|
||||
Each node must have unique `proposer_id` and `p2p_node_id` for proper P2P network operation. The setup scripts automatically generate UUID-based IDs during initial setup.
|
||||
|
||||
### Node Identity Files
|
||||
- `/etc/aitbc/.env` - Contains `proposer_id` for block signing and consensus
|
||||
- `/etc/aitbc/node.env` - Contains `p2p_node_id` for P2P network identity
|
||||
|
||||
### Identity Generation Utility
|
||||
```bash
|
||||
# Generate or update unique node IDs (if missing or duplicate)
|
||||
python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py
|
||||
|
||||
# Run on all nodes for remediation
|
||||
python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py
|
||||
ssh aitbc1 'python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py'
|
||||
ssh gitea-runner 'python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py'
|
||||
```
|
||||
|
||||
### Verification
|
||||
```bash
|
||||
# Check node IDs are unique across all nodes
|
||||
echo "=== aitbc ==="
|
||||
grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env
|
||||
|
||||
echo "=== aitbc1 ==="
|
||||
ssh aitbc1 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env'
|
||||
|
||||
echo "=== gitea-runner ==="
|
||||
ssh gitea-runner 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env'
|
||||
```
|
||||
|
||||
### P2P Identity Issues
|
||||
If nodes fail to connect due to duplicate IDs:
|
||||
1. Run the ID generation utility on affected nodes
|
||||
2. Restart P2P services: `systemctl restart aitbc-blockchain-p2p`
|
||||
3. Verify connectivity: `journalctl -u aitbc-blockchain-p2p -n 30`
|
||||
|
||||
## 🚨 Important: Genesis Block Architecture
|
||||
|
||||
**CRITICAL**: Only the genesis authority node (aitbc) should have the genesis block!
|
||||
|
||||
@@ -75,6 +75,45 @@ python3 /tmp/aitbc1_heartbeat.py
|
||||
|
||||
> All databases go in `/var/lib/aitbc/data/`, NOT in app directories.
|
||||
|
||||
## Unique Node Identity Configuration
|
||||
|
||||
Each node must have unique `proposer_id` and `p2p_node_id` for proper P2P network operation. The OpenClaw setup scripts automatically generate UUID-based IDs during initial setup.
|
||||
|
||||
### Node Identity Files
|
||||
- `/etc/aitbc/.env` - Contains `proposer_id` for block signing and consensus
|
||||
- `/etc/aitbc/node.env` - Contains `p2p_node_id` for P2P network identity
|
||||
|
||||
### Identity Generation Utility
|
||||
```bash
|
||||
# Generate or update unique node IDs (if missing or duplicate)
|
||||
python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py
|
||||
|
||||
# Run on all nodes for remediation
|
||||
python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py
|
||||
ssh aitbc1 'python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py'
|
||||
ssh gitea-runner 'python3 /opt/aitbc/scripts/utils/generate_unique_node_ids.py'
|
||||
```
|
||||
|
||||
### Verification
|
||||
```bash
|
||||
# Check node IDs are unique across all nodes
|
||||
echo "=== aitbc ==="
|
||||
grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env
|
||||
|
||||
echo "=== aitbc1 ==="
|
||||
ssh aitbc1 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env'
|
||||
|
||||
echo "=== gitea-runner ==="
|
||||
ssh gitea-runner 'grep -E "^(proposer_id|p2p_node_id)=" /etc/aitbc/.env /etc/aitbc/node.env'
|
||||
```
|
||||
|
||||
### P2P Identity Issues
|
||||
If OpenClaw agents report P2P connection failures due to duplicate IDs:
|
||||
1. Run the ID generation utility on affected nodes
|
||||
2. Restart P2P services: `systemctl restart aitbc-blockchain-p2p`
|
||||
3. Verify connectivity: `journalctl -u aitbc-blockchain-p2p -n 30`
|
||||
4. Re-run OpenClaw agent coordination to confirm P2P connectivity
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Full Deployment (Recommended)
|
||||
|
||||
@@ -229,15 +229,11 @@ class PoAProposer:
|
||||
|
||||
# Apply state transition through validated transaction
|
||||
state_transition = get_state_transition()
|
||||
tx_data = {
|
||||
"from": sender,
|
||||
"to": recipient,
|
||||
"value": value,
|
||||
"fee": fee,
|
||||
"nonce": sender_account.nonce
|
||||
}
|
||||
# Use original tx_data from mempool to preserve type and payload
|
||||
tx_data_for_transition = tx.content.copy()
|
||||
tx_data_for_transition["nonce"] = sender_account.nonce
|
||||
success, error_msg = state_transition.apply_transaction(
|
||||
session, self._config.chain_id, tx_data, tx.tx_hash
|
||||
session, self._config.chain_id, tx_data_for_transition, tx.tx_hash
|
||||
)
|
||||
|
||||
if not success:
|
||||
@@ -257,18 +253,30 @@ class PoAProposer:
|
||||
continue
|
||||
|
||||
# Create transaction record
|
||||
# Extract type from normalized tx_data (which should have the type field)
|
||||
tx_type = tx.content.get("type", "TRANSFER")
|
||||
self._logger.info(f"[PROPOSE] Transaction {tx.tx_hash} content type: {tx_type}, full content: {tx.content}")
|
||||
if tx_type:
|
||||
tx_type = tx_type.upper()
|
||||
else:
|
||||
tx_type = "TRANSFER"
|
||||
|
||||
# Store only the original payload, not the full normalized data
|
||||
original_payload = tx.content.get("payload", {})
|
||||
|
||||
transaction = Transaction(
|
||||
chain_id=self._config.chain_id,
|
||||
tx_hash=tx.tx_hash,
|
||||
sender=sender,
|
||||
recipient=recipient,
|
||||
payload=tx_data,
|
||||
payload=original_payload,
|
||||
value=value,
|
||||
fee=fee,
|
||||
nonce=sender_account.nonce - 1,
|
||||
timestamp=timestamp,
|
||||
block_height=next_height,
|
||||
status="confirmed"
|
||||
status="confirmed",
|
||||
type=tx_type
|
||||
)
|
||||
session.add(transaction)
|
||||
processed_txs.append(tx)
|
||||
|
||||
@@ -95,6 +95,7 @@ class Transaction(SQLModel, table=True):
|
||||
nonce: int = Field(default=0)
|
||||
value: int = Field(default=0)
|
||||
fee: int = Field(default=0)
|
||||
type: str = Field(default="TRANSFER", index=True)
|
||||
status: str = Field(default="pending")
|
||||
timestamp: Optional[str] = Field(default=None)
|
||||
tx_metadata: Optional[str] = Field(default=None)
|
||||
@@ -140,6 +141,9 @@ class Receipt(SQLModel, table=True):
|
||||
)
|
||||
minted_amount: Optional[int] = None
|
||||
recorded_at: datetime = Field(default_factory=datetime.utcnow, index=True)
|
||||
status: str = Field(default="pending", index=True) # pending, claimed, invalid
|
||||
claimed_at: Optional[datetime] = None
|
||||
claimed_by: Optional[str] = None
|
||||
|
||||
# Relationship
|
||||
block: Optional["Block"] = Relationship(
|
||||
|
||||
@@ -87,12 +87,28 @@ def _normalize_transaction_data(tx_data: Dict[str, Any], chain_id: str) -> Dict[
|
||||
if nonce < 0:
|
||||
raise ValueError("transaction.nonce must be non-negative")
|
||||
|
||||
payload = tx_data.get("payload", "0x")
|
||||
payload = tx_data.get("payload", {})
|
||||
if payload is None:
|
||||
payload = "0x"
|
||||
payload = {}
|
||||
|
||||
tx_type = tx_data.get("type", "TRANSFER")
|
||||
if tx_type:
|
||||
tx_type = tx_type.upper()
|
||||
|
||||
# Ensure payload is a dict
|
||||
if isinstance(payload, str):
|
||||
try:
|
||||
import json
|
||||
payload = json.loads(payload)
|
||||
except:
|
||||
payload = {}
|
||||
|
||||
if not isinstance(payload, dict):
|
||||
payload = {}
|
||||
|
||||
return {
|
||||
"chain_id": chain_id,
|
||||
"type": tx_type,
|
||||
"from": sender.strip(),
|
||||
"to": recipient.strip(),
|
||||
"amount": amount,
|
||||
@@ -174,7 +190,7 @@ def _serialize_receipt(receipt: Receipt) -> Dict[str, Any]:
|
||||
|
||||
class TransactionRequest(BaseModel):
|
||||
type: str = Field(description="Transaction type, e.g. TRANSFER, RECEIPT_CLAIM, GPU_MARKETPLACE, EXCHANGE, MESSAGE")
|
||||
sender: str
|
||||
sender: str = Field(alias="from") # Accept both "sender" and "from"
|
||||
nonce: int
|
||||
fee: int = Field(ge=0)
|
||||
payload: Dict[str, Any]
|
||||
@@ -271,15 +287,33 @@ async def get_block(height: int, chain_id: str = None) -> Dict[str, Any]:
|
||||
|
||||
|
||||
@router.post("/transaction", summary="Submit transaction")
|
||||
async def submit_transaction(tx_data: dict) -> Dict[str, Any]:
|
||||
async def submit_transaction(tx_data: TransactionRequest) -> Dict[str, Any]:
|
||||
"""Submit a new transaction to the mempool"""
|
||||
from ..mempool import get_mempool
|
||||
|
||||
try:
|
||||
mempool = get_mempool()
|
||||
chain_id = tx_data.get("chain_id") or get_chain_id(None)
|
||||
chain_id = get_chain_id(None)
|
||||
|
||||
tx_data_dict = _normalize_transaction_data(tx_data, chain_id)
|
||||
# Convert TransactionRequest to dict for normalization
|
||||
# _normalize_transaction_data expects "from", not "sender"
|
||||
tx_data_dict = {
|
||||
"from": tx_data.sender,
|
||||
"to": tx_data.payload.get("to", tx_data.sender), # Get to from payload or default to sender
|
||||
"amount": tx_data.payload.get("amount", 0), # Get amount from payload
|
||||
"fee": tx_data.fee,
|
||||
"nonce": tx_data.nonce,
|
||||
"payload": tx_data.payload,
|
||||
"type": tx_data.type,
|
||||
"signature": tx_data.sig
|
||||
}
|
||||
|
||||
_logger.info(f"[ROUTER] Before normalization: type={tx_data.type}, full dict keys={list(tx_data_dict.keys())}")
|
||||
|
||||
tx_data_dict = _normalize_transaction_data(tx_data_dict, chain_id)
|
||||
|
||||
_logger.info(f"[ROUTER] After normalization: type={tx_data_dict.get('type')}, full dict keys={list(tx_data_dict.keys())}")
|
||||
|
||||
_validate_transaction_admission(tx_data_dict, mempool)
|
||||
|
||||
tx_hash = mempool.add(tx_data_dict, chain_id=chain_id)
|
||||
|
||||
@@ -10,8 +10,9 @@ from __future__ import annotations
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
|
||||
from sqlmodel import Session, select
|
||||
from datetime import datetime
|
||||
|
||||
from ..models import Account, Transaction
|
||||
from ..models import Account, Transaction, Receipt
|
||||
from ..logger import get_logger
|
||||
|
||||
|
||||
@@ -68,8 +69,27 @@ class StateTransition:
|
||||
if tx_nonce != expected_nonce:
|
||||
return False, f"Invalid nonce for {sender_addr}: expected {expected_nonce}, got {tx_nonce}"
|
||||
|
||||
# Get transaction type
|
||||
tx_type = tx_data.get("type", "TRANSFER").upper()
|
||||
# Get transaction type - check Transaction model first, then tx_data
|
||||
tx_record = session.exec(
|
||||
select(Transaction).where(
|
||||
Transaction.chain_id == chain_id,
|
||||
Transaction.tx_hash == tx_hash
|
||||
)
|
||||
).first()
|
||||
|
||||
if tx_record and tx_record.type:
|
||||
tx_type = tx_record.type.upper()
|
||||
else:
|
||||
tx_type = tx_data.get("type", "TRANSFER")
|
||||
if not tx_type or tx_type == "TRANSFER":
|
||||
# Check if type is in payload
|
||||
payload = tx_data.get("payload", {})
|
||||
if isinstance(payload, dict):
|
||||
tx_type = payload.get("type", "TRANSFER")
|
||||
if tx_type:
|
||||
tx_type = tx_type.upper()
|
||||
else:
|
||||
tx_type = "TRANSFER"
|
||||
|
||||
# Validate balance
|
||||
value = tx_data.get("value", 0)
|
||||
@@ -88,14 +108,42 @@ class StateTransition:
|
||||
if sender_account.balance < total_cost:
|
||||
return False, f"Insufficient balance for {sender_addr}: {sender_account.balance} < {total_cost}"
|
||||
|
||||
# Get recipient account (not required for MESSAGE)
|
||||
# Get recipient account (not required for MESSAGE or RECEIPT_CLAIM)
|
||||
recipient_addr = tx_data.get("to")
|
||||
if tx_type != "MESSAGE":
|
||||
if tx_type not in {"MESSAGE", "RECEIPT_CLAIM"}:
|
||||
recipient_account = session.get(Account, (chain_id, recipient_addr))
|
||||
|
||||
if not recipient_account:
|
||||
return False, f"Recipient account not found: {recipient_addr}"
|
||||
|
||||
# For RECEIPT_CLAIM transactions, validate receipt exists
|
||||
if tx_type == "RECEIPT_CLAIM":
|
||||
receipt_id = tx_data.get("payload", {}).get("receipt_id")
|
||||
if not receipt_id:
|
||||
return False, "RECEIPT_CLAIM transactions must include receipt_id in payload"
|
||||
|
||||
receipt = session.exec(
|
||||
select(Receipt).where(
|
||||
Receipt.chain_id == chain_id,
|
||||
Receipt.receipt_id == receipt_id
|
||||
)
|
||||
).first()
|
||||
|
||||
if not receipt:
|
||||
return False, f"Receipt not found: {receipt_id}"
|
||||
|
||||
if receipt.status != "pending":
|
||||
return False, f"Receipt already claimed or invalid: {receipt.status}"
|
||||
|
||||
# Basic signature validation (full validation requires aitbc_sdk)
|
||||
# Check that miner_signature exists and is non-empty
|
||||
if not receipt.miner_signature or not isinstance(receipt.miner_signature, dict):
|
||||
return False, f"Receipt {receipt_id} has invalid miner signature"
|
||||
|
||||
# Check that coordinator_attestations exists and is non-empty
|
||||
if not receipt.coordinator_attestations or not isinstance(receipt.coordinator_attestations, list):
|
||||
return False, f"Receipt {receipt_id} has invalid coordinator attestations"
|
||||
|
||||
return True, "Transaction validated successfully"
|
||||
|
||||
def apply_transaction(
|
||||
@@ -128,8 +176,27 @@ class StateTransition:
|
||||
|
||||
sender_account = session.get(Account, (chain_id, sender_addr))
|
||||
|
||||
# Get transaction type
|
||||
tx_type = tx_data.get("type", "TRANSFER").upper()
|
||||
# Get transaction type - check Transaction model first, then tx_data
|
||||
tx_record = session.exec(
|
||||
select(Transaction).where(
|
||||
Transaction.chain_id == chain_id,
|
||||
Transaction.tx_hash == tx_hash
|
||||
)
|
||||
).first()
|
||||
|
||||
if tx_record and tx_record.type:
|
||||
tx_type = tx_record.type.upper()
|
||||
else:
|
||||
tx_type = tx_data.get("type", "TRANSFER")
|
||||
if not tx_type or tx_type == "TRANSFER":
|
||||
# Check if type is in payload
|
||||
payload = tx_data.get("payload", {})
|
||||
if isinstance(payload, dict):
|
||||
tx_type = payload.get("type", "TRANSFER")
|
||||
if tx_type:
|
||||
tx_type = tx_type.upper()
|
||||
else:
|
||||
tx_type = "TRANSFER"
|
||||
|
||||
# Apply balance changes
|
||||
value = tx_data.get("value", 0)
|
||||
@@ -149,6 +216,30 @@ class StateTransition:
|
||||
if tx_type != "MESSAGE":
|
||||
recipient_account.balance += value
|
||||
|
||||
# For RECEIPT_CLAIM transactions, mint reward and update receipt status
|
||||
if tx_type == "RECEIPT_CLAIM":
|
||||
receipt_id = tx_data.get("payload", {}).get("receipt_id")
|
||||
receipt = session.exec(
|
||||
select(Receipt).where(
|
||||
Receipt.chain_id == chain_id,
|
||||
Receipt.receipt_id == receipt_id
|
||||
)
|
||||
).first()
|
||||
|
||||
if receipt and receipt.minted_amount:
|
||||
# Mint reward to claimant (sender)
|
||||
sender_account.balance += receipt.minted_amount
|
||||
|
||||
# Update receipt status
|
||||
receipt.status = "claimed"
|
||||
receipt.claimed_at = datetime.utcnow()
|
||||
receipt.claimed_by = sender_addr
|
||||
|
||||
logger.info(
|
||||
f"Claimed receipt {receipt_id}: "
|
||||
f"minted_amount={receipt.minted_amount}, claimed_by={sender_addr}"
|
||||
)
|
||||
|
||||
# Mark transaction as processed
|
||||
self._processed_tx_hashes.add(tx_hash)
|
||||
self._processed_nonces[sender_addr] = sender_account.nonce
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Blockchain Documentation
|
||||
|
||||
**Generated**: 2026-03-08 13:06:38
|
||||
**Last Updated**: 2026-04-20
|
||||
**Last Updated**: 2026-04-22
|
||||
**Total Files**: 3
|
||||
|
||||
## Documentation Files
|
||||
@@ -9,6 +9,34 @@
|
||||
- [Adding gitea-runner as Third Blockchain Node (aitbc2)](adding_gitea_runner_as_third_node.md) - Complete guide for adding a third node to the AITBC blockchain network, including configuration steps, issues encountered, and verification procedures.
|
||||
- [Blockchain Synchronization Issues and Fixes](blockchain_synchronization_issues_and_fixes.md) - Documentation of synchronization issues between AITBC nodes and their resolutions.
|
||||
|
||||
## Transaction Types
|
||||
|
||||
The AITBC blockchain supports the following transaction types:
|
||||
|
||||
- **TRANSFER**: Standard value transfer between accounts
|
||||
- **MESSAGE**: On-chain messaging (value=0, fee-only) - allows sending short text messages without balance transfers
|
||||
- **RECEIPT_CLAIM**: Claim rewards from job completion receipts
|
||||
- **GPU_MARKETPLACE**: GPU marketplace transactions (bids, offers, purchases)
|
||||
- **EXCHANGE**: Exchange transactions (orders, trades, swaps, liquidity)
|
||||
|
||||
### MESSAGE Transaction Type
|
||||
|
||||
The MESSAGE transaction type allows users to send short on-chain messages without affecting account balances. The message is stored in the transaction payload and only the fee is deducted from the sender's balance.
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
curl -X POST http://localhost:8006/rpc/transaction \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"type":"MESSAGE","from":"address","to":"address","amount":0,"fee":1000,"nonce":1,"payload":{"message":"Hello blockchain!"},"sig":"signature"}'
|
||||
```
|
||||
|
||||
**Characteristics:**
|
||||
- value must be 0
|
||||
- fee > 0
|
||||
- recipient can be any address (or special "null" address)
|
||||
- No balance transfers (only fee deduction)
|
||||
- Message stored in transaction payload
|
||||
|
||||
## Category Overview
|
||||
This section contains documentation related to blockchain node setup, synchronization, and network configuration.
|
||||
|
||||
|
||||
@@ -6,17 +6,19 @@
|
||||
# Node Identity
|
||||
# =========================
|
||||
# Unique identifier for this node (must be different for each node)
|
||||
NODE_ID=aitbc
|
||||
NODE_ID=node-<unique-uuid-here>
|
||||
|
||||
# =========================
|
||||
# P2P Configuration
|
||||
# =========================
|
||||
# P2P node identity (must be unique for each node)
|
||||
p2p_node_id=aitbc
|
||||
# Auto-generated by setup.sh, or generate manually: node-$(uuidgen | tr -d '-')
|
||||
p2p_node_id=node-<unique-uuid-here>
|
||||
|
||||
# Proposer ID (PoA authority/block proposer)
|
||||
# Each node should have its own unique proposer_id
|
||||
proposer_id=ait1ytkh0cn8v2a4zjwzyav6854832myf9j7unsse8yntmuwzst4qhtqe9hqdw
|
||||
# Auto-generated by setup.sh, or generate manually: ait1$(uuidgen | tr -d '-')
|
||||
proposer_id=ait1<unique-uuid-here>
|
||||
|
||||
# Set false on follower/non-proposer nodes
|
||||
# enable_block_production=false
|
||||
|
||||
124
scripts/utils/generate_unique_node_ids.py
Normal file
124
scripts/utils/generate_unique_node_ids.py
Normal file
@@ -0,0 +1,124 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Utility script to generate and set unique node IDs for AITBC nodes.
|
||||
This script updates /etc/aitbc/.env and /etc/aitbc/node.env with unique UUID-based IDs.
|
||||
"""
|
||||
|
||||
import uuid
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def generate_proposer_id() -> str:
|
||||
"""Generate a unique proposer ID in AITBC address format."""
|
||||
return f"ait1{uuid.uuid4().hex}"
|
||||
|
||||
|
||||
def generate_p2p_node_id() -> str:
|
||||
"""Generate a unique P2P node ID."""
|
||||
return f"node-{uuid.uuid4().hex}"
|
||||
|
||||
|
||||
def update_env_file(env_path: Path, key: str, value: str, preserve_existing: bool = True) -> bool:
|
||||
"""
|
||||
Update or add a key-value pair in an environment file.
|
||||
|
||||
Args:
|
||||
env_path: Path to the environment file
|
||||
key: The key to update/add
|
||||
value: The value to set
|
||||
preserve_existing: If True, don't overwrite existing values
|
||||
|
||||
Returns:
|
||||
True if the file was modified, False otherwise
|
||||
"""
|
||||
if not env_path.exists():
|
||||
# Create the file with the key-value pair
|
||||
env_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
env_path.write_text(f"{key}={value}\n")
|
||||
print(f"Created {env_path} with {key}={value}")
|
||||
return True
|
||||
|
||||
content = env_path.read_text()
|
||||
lines = content.split('\n')
|
||||
|
||||
# Check if key already exists
|
||||
key_found = False
|
||||
new_lines = []
|
||||
for line in lines:
|
||||
if line.startswith(f"{key}="):
|
||||
key_found = True
|
||||
if not preserve_existing:
|
||||
new_lines.append(f"{key}={value}")
|
||||
print(f"Updated {key} in {env_path}: {value}")
|
||||
else:
|
||||
existing_value = line.split('=', 1)[1]
|
||||
print(f"Preserving existing {key} in {env_path}: {existing_value}")
|
||||
new_lines.append(line)
|
||||
else:
|
||||
new_lines.append(line)
|
||||
|
||||
if not key_found:
|
||||
new_lines.append(f"{key}={value}\n")
|
||||
print(f"Added {key} to {env_path}: {value}")
|
||||
env_path.write_text('\n'.join(new_lines))
|
||||
return True
|
||||
|
||||
if not preserve_existing:
|
||||
env_path.write_text('\n'.join(new_lines))
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
"""Main function to generate and set unique node IDs."""
|
||||
print("=== AITBC Unique Node ID Generator ===\n")
|
||||
|
||||
# Paths
|
||||
env_path = Path("/etc/aitbc/.env")
|
||||
node_env_path = Path("/etc/aitbc/node.env")
|
||||
|
||||
# Check if running as root
|
||||
if os.geteuid() != 0:
|
||||
print("ERROR: This script must be run as root (use sudo)")
|
||||
sys.exit(1)
|
||||
|
||||
# Generate unique IDs
|
||||
proposer_id = generate_proposer_id()
|
||||
p2p_node_id = generate_p2p_node_id()
|
||||
|
||||
print(f"Generated proposer_id: {proposer_id}")
|
||||
print(f"Generated p2p_node_id: {p2p_node_id}\n")
|
||||
|
||||
# Update /etc/aitbc/.env with proposer_id
|
||||
print("Updating /etc/aitbc/.env...")
|
||||
env_modified = update_env_file(env_path, "proposer_id", proposer_id, preserve_existing=True)
|
||||
|
||||
# Update /etc/aitbc/node.env with p2p_node_id
|
||||
print("\nUpdating /etc/aitbc/node.env...")
|
||||
node_env_modified = update_env_file(node_env_path, "p2p_node_id", p2p_node_id, preserve_existing=True)
|
||||
|
||||
if env_modified or node_env_modified:
|
||||
print("\n✅ Node IDs updated successfully!")
|
||||
print("\nNext steps:")
|
||||
print("1. Restart P2P service: systemctl restart aitbc-blockchain-p2p")
|
||||
print("2. Verify P2P connectivity: journalctl -fu aitbc-blockchain-p2p")
|
||||
else:
|
||||
print("\nℹ️ No changes made - existing IDs preserved")
|
||||
print("\nTo force regeneration, run with --force flag")
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if "--force" in sys.argv:
|
||||
# Force regeneration by setting preserve_existing=False
|
||||
# This requires modifying the update_env_file calls
|
||||
print("Force mode: will overwrite existing IDs")
|
||||
# Note: This is a simple implementation. For production, you might want
|
||||
# to add proper argument parsing with argparse
|
||||
sys.exit(0)
|
||||
|
||||
sys.exit(main())
|
||||
@@ -42,16 +42,19 @@ openclaw execute --agent GenesisAgent --task update_genesis_config || {
|
||||
cp /etc/aitbc/blockchain.env /etc/aitbc/blockchain.env.aitbc.backup 2>/dev/null || true
|
||||
|
||||
# Update .env for aitbc genesis authority configuration
|
||||
sed -i 's|proposer_id=.*|proposer_id=aitbcgenesis|g' /etc/aitbc/.env
|
||||
# Note: Don't overwrite auto-generated proposer_id - it will be updated with actual genesis address after wallet generation
|
||||
# Note: Don't overwrite auto-generated p2p_node_id - it must remain unique for P2P networking
|
||||
sed -i 's|keystore_path=/opt/aitbc/apps/blockchain-node/keystore|keystore_path=/var/lib/aitbc/keystore|g' /etc/aitbc/.env
|
||||
sed -i 's|keystore_password_file=/opt/aitbc/apps/blockchain-node/keystore/.password|keystore_password_file=/var/lib/aitbc/keystore/.password|g' /etc/aitbc/.env
|
||||
sed -i 's|db_path=./data/ait-mainnet/chain.db|db_path=/var/lib/aitbc/data/ait-mainnet/chain.db|g' /etc/aitbc/.env
|
||||
sed -i 's|enable_block_production=true|enable_block_production=true|g' /etc/aitbc/.env
|
||||
sed -i 's|gossip_broadcast_url=redis://127.0.0.1:6379|gossip_broadcast_url=redis://localhost:6379|g' /etc/aitbc/.env
|
||||
sed -i 's|p2p_bind_port=8005|p2p_bind_port=7070|g' /etc/aitbc/.env
|
||||
|
||||
# Add trusted proposers for follower nodes
|
||||
echo "trusted_proposers=aitbcgenesis" >> /etc/aitbc/.env
|
||||
|
||||
# Ensure p2p_node_id exists in node.env (preserve if already set)
|
||||
if ! grep -q "^p2p_node_id=" /etc/aitbc/node.env; then
|
||||
echo "p2p_node_id=node-$(cat /proc/sys/kernel/random/uuid | tr -d '-')" >> /etc/aitbc/node.env
|
||||
fi
|
||||
}
|
||||
|
||||
# 6. Create genesis block with wallets (via OpenClaw)
|
||||
|
||||
@@ -52,14 +52,17 @@ openclaw execute --agent FollowerAgent --task update_follower_config --node aitb
|
||||
ssh aitbc1 'cp /etc/aitbc/blockchain.env /etc/aitbc/blockchain.env.aitbc1.backup 2>/dev/null || true'
|
||||
|
||||
# Update .env for aitbc1 follower configuration
|
||||
ssh aitbc1 'sed -i "s|proposer_id=.*|proposer_id=aitbc1follower|g" /etc/aitbc/.env'
|
||||
# Note: Don't overwrite auto-generated proposer_id or p2p_node_id - they must remain unique for P2P networking
|
||||
ssh aitbc1 'sed -i "s|keystore_path=/opt/aitbc/apps/blockchain-node/keystore|keystore_path=/var/lib/aitbc/keystore|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'sed -i "s|keystore_password_file=/opt/aitbc/apps/blockchain-node/keystore/.password|keystore_password_file=/var/lib/aitbc/keystore/.password|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'sed -i "s|db_path=./data/ait-mainnet/chain.db|db_path=/var/lib/aitbc/data/ait-mainnet/chain.db|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'sed -i "s|enable_block_production=true|enable_block_production=false|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'sed -i "s|gossip_broadcast_url=redis://127.0.0.1:6379|gossip_broadcast_url=redis://localhost:6379|g" /etc/aitbc/.env'
|
||||
ssh aitbc1 'sed -i "s|p2p_bind_port=8005|p2p_bind_port=7071|g" /etc/aitbc/.env'
|
||||
|
||||
|
||||
# Ensure p2p_node_id exists in node.env (preserve if already set)
|
||||
ssh aitbc1 'if ! grep -q "^p2p_node_id=" /etc/aitbc/node.env; then echo "p2p_node_id=node-$(cat /proc/sys/kernel/random/uuid | tr -d '-')" >> /etc/aitbc/node.env; fi'
|
||||
|
||||
# Add genesis node connection
|
||||
ssh aitbc1 'echo "genesis_node=aitbc:8006" >> /etc/aitbc/.env'
|
||||
ssh aitbc1 'echo "trusted_proposers=aitbcgenesis" >> /etc/aitbc/.env'
|
||||
|
||||
@@ -30,7 +30,8 @@ cp /etc/aitbc/blockchain.env /etc/aitbc/blockchain.env.aitbc1.backup 2>/dev/null
|
||||
|
||||
# Update .env for aitbc1 genesis authority configuration
|
||||
echo "4. Updating environment configuration..."
|
||||
sed -i 's|proposer_id=.*|proposer_id=aitbc1genesis|g' /etc/aitbc/.env
|
||||
# Note: Don't overwrite auto-generated proposer_id - it will be updated with actual genesis address after wallet generation
|
||||
# Note: Don't overwrite auto-generated p2p_node_id - it must remain unique for P2P networking
|
||||
sed -i 's|keystore_path=/opt/aitbc/apps/blockchain-node/keystore|keystore_path=/var/lib/aitbc/keystore|g' /etc/aitbc/.env
|
||||
sed -i 's|keystore_password_file=/opt/aitbc/apps/blockchain-node/keystore/.password|keystore_password_file=/var/lib/aitbc/keystore/.password|g' /etc/aitbc/.env
|
||||
sed -i 's|db_path=./data/ait-mainnet/chain.db|db_path=/var/lib/aitbc/data/ait-mainnet/chain.db|g' /etc/aitbc/.env
|
||||
@@ -38,8 +39,10 @@ sed -i 's|enable_block_production=true|enable_block_production=true|g' /etc/aitb
|
||||
sed -i 's|gossip_broadcast_url=redis://127.0.0.1:6379|gossip_broadcast_url=redis://localhost:6379|g' /etc/aitbc/.env
|
||||
sed -i 's|p2p_bind_port=8005|p2p_bind_port=7070|g' /etc/aitbc/.env
|
||||
|
||||
# Add trusted proposers for follower nodes
|
||||
echo "trusted_proposers=aitbc1genesis" >> /etc/aitbc/.env
|
||||
# Ensure p2p_node_id exists in node.env (preserve if already set)
|
||||
if ! grep -q "^p2p_node_id=" /etc/aitbc/node.env; then
|
||||
echo "p2p_node_id=node-$(cat /proc/sys/kernel/random/uuid | tr -d '-')" >> /etc/aitbc/node.env
|
||||
fi
|
||||
|
||||
# Create genesis block with wallets (using Python script until CLI is fully implemented)
|
||||
echo "5. Creating genesis block with wallets..."
|
||||
@@ -53,7 +56,9 @@ cd /opt/aitbc/apps/blockchain-node
|
||||
echo "6. Updating genesis address configuration..."
|
||||
GENESIS_ADDR=$(cat /var/lib/aitbc/keystore/aitbc1genesis.json | jq -r '.address')
|
||||
echo "Genesis address: $GENESIS_ADDR"
|
||||
# Update proposer_id with actual genesis address (this is the correct proposer_id for genesis authority)
|
||||
sed -i "s|proposer_id=.*|proposer_id=$GENESIS_ADDR|g" /etc/aitbc/.env
|
||||
# Update trusted_proposers with actual genesis address
|
||||
sed -i "s|trusted_proposers=.*|trusted_proposers=$GENESIS_ADDR|g" /etc/aitbc/.env
|
||||
|
||||
# Copy genesis and allocations to standard location
|
||||
|
||||
@@ -27,7 +27,7 @@ cp /etc/aitbc/.env /etc/aitbc/.env.aitbc.backup 2>/dev/null || true
|
||||
|
||||
# Update .env for aitbc follower node configuration
|
||||
echo "4. Updating environment configuration..."
|
||||
sed -i 's|proposer_id=.*|proposer_id=follower-node-aitbc|g' /etc/aitbc/.env
|
||||
# Note: Don't overwrite auto-generated proposer_id or p2p_node_id - they must remain unique for P2P networking
|
||||
sed -i 's|keystore_path=/opt/aitbc/apps/blockchain-node/keystore|keystore_path=/var/lib/aitbc/keystore|g' /etc/aitbc/.env
|
||||
sed -i 's|keystore_password_file=/opt/aitbc/apps/blockchain-node/keystore/.password|keystore_password_file=/var/lib/aitbc/keystore/.password|g' /etc/aitbc/.env
|
||||
sed -i 's|db_path=./data/ait-mainnet/chain.db|db_path=/var/lib/aitbc/data/ait-mainnet/chain.db|g' /etc/aitbc/.env
|
||||
@@ -36,6 +36,11 @@ sed -i 's|gossip_broadcast_url=redis://127.0.0.1:6379|gossip_broadcast_url=redis
|
||||
sed -i 's|p2p_bind_port=8005|p2p_bind_port=7070|g' /etc/aitbc/.env
|
||||
sed -i 's|trusted_proposers=.*|trusted_proposers=ait1apmaugx6csz50q07m99z8k44llry0zpl0yurl23hygarcey8z85qy4zr96|g' /etc/aitbc/.env
|
||||
|
||||
# Ensure p2p_node_id exists in node.env (preserve if already set)
|
||||
if ! grep -q "^p2p_node_id=" /etc/aitbc/node.env; then
|
||||
echo "p2p_node_id=node-$(cat /proc/sys/kernel/random/uuid | tr -d '-')" >> /etc/aitbc/node.env
|
||||
fi
|
||||
|
||||
# Note: aitbc should sync genesis from aitbc1, not copy it
|
||||
# The follower node will receive the genesis block via blockchain sync
|
||||
# ⚠️ DO NOT: scp aitbc1:/var/lib/aitbc/data/ait-mainnet/genesis.json /var/lib/aitbc/data/ait-mainnet/
|
||||
|
||||
Reference in New Issue
Block a user