revert: restore CLI and training script to use port 8006
Reverted previous changes that incorrectly changed RPC port from 8006 to 8005. Investigation revealed: - Port 8005 runs AI service (uvicorn src.ai_service.main:app) - Port 8006 runs blockchain node HTTP RPC (uvicorn aitbc_chain.app:app) The blockchain node HTTP RPC is actually on port 8006, not 8005. The issue is that the blockchain node on port 8006 is not responding to HTTP requests. Next step: Debug why blockchain node on port 8006 is not responding to HTTP.
This commit is contained in:
@@ -13,7 +13,7 @@ import requests
|
||||
|
||||
# Default paths
|
||||
DEFAULT_KEYSTORE_DIR = Path("/var/lib/aitbc/keystore")
|
||||
DEFAULT_RPC_URL = "http://localhost:8005"
|
||||
DEFAULT_RPC_URL = "http://localhost:8006"
|
||||
|
||||
# Note: Legacy simple_wallet.py module has been replaced by unified CLI
|
||||
# This file should use the new nested CLI structure via subprocess calls
|
||||
|
||||
@@ -10,7 +10,7 @@ def _get_node_endpoint(ctx):
|
||||
# Use the new blockchain_rpc_url from config
|
||||
return config.blockchain_rpc_url
|
||||
except:
|
||||
return "http://127.0.0.1:8005" # Use HTTP RPC port (not blockchain protocol port)
|
||||
return "http://127.0.0.1:8006" # Default blockchain RPC port
|
||||
|
||||
from typing import Optional, List
|
||||
from utils import output, error
|
||||
|
||||
@@ -231,7 +231,7 @@ def config(test_mode):
|
||||
if test_mode:
|
||||
# Mock data for testing
|
||||
mock_config = {
|
||||
"blockchain_rpc_url": "http://localhost:8005",
|
||||
"blockchain_rpc_url": "http://localhost:8006",
|
||||
"gossip_backend": "redis",
|
||||
"gossip_broadcast_url": "redis://localhost:6379",
|
||||
"coordinator_api_url": "http://localhost:8011",
|
||||
|
||||
@@ -79,7 +79,7 @@ def status(service):
|
||||
|
||||
checks = [
|
||||
"Coordinator API: http://localhost:8011/health",
|
||||
"Blockchain Node RPC: http://localhost:8005/health",
|
||||
"Blockchain Node RPC: http://localhost:8006/health",
|
||||
"Marketplace: http://localhost:8001/health",
|
||||
"Wallet Service: http://localhost:8003/status"
|
||||
]
|
||||
|
||||
@@ -267,7 +267,7 @@ def pay(ctx, booking_id: str, amount: float, from_wallet: str, to_wallet: str, t
|
||||
|
||||
# Get wallet balance from blockchain
|
||||
from aitbc_cli.utils.chain_id import get_chain_id
|
||||
rpc_url = config.get('rpc_url', 'http://localhost:8005')
|
||||
rpc_url = config.get('rpc_url', 'http://localhost:8006')
|
||||
chain_id = get_chain_id(rpc_url)
|
||||
balance_response = httpx.Client().get(f"{rpc_url}/rpc/account/{address}?chain_id={chain_id}", timeout=5)
|
||||
if balance_response.status_code != 200:
|
||||
|
||||
@@ -17,8 +17,8 @@ def sync():
|
||||
|
||||
|
||||
@sync.command()
|
||||
@click.option('--source', default=lambda: os.getenv('AITBC_SYNC_SOURCE_URL', 'http://127.0.0.1:8005'), help='Source RPC URL (leader)')
|
||||
@click.option('--import-url', default='http://127.0.0.1:8005', help='Local RPC URL for import')
|
||||
@click.option('--source', default=lambda: os.getenv('AITBC_SYNC_SOURCE_URL', 'http://127.0.0.1:8006'), help='Source RPC URL (leader)')
|
||||
@click.option('--import-url', default='http://127.0.0.1:8006', help='Local RPC URL for import')
|
||||
@click.option('--batch-size', type=int, default=100, help='Blocks per batch')
|
||||
@click.option('--poll-interval', type=float, default=0.2, help='Seconds between batches')
|
||||
def bulk(source, import_url, batch_size, poll_interval):
|
||||
|
||||
@@ -151,7 +151,7 @@ def cli(ctx, url, api_key, chain_id, output, verbose, debug):
|
||||
|
||||
# Handle chain_id with auto-detection
|
||||
from aitbc_cli.utils.chain_id import get_chain_id, get_default_chain_id
|
||||
default_rpc_url = url.replace('/api', '') if url else 'http://localhost:8005'
|
||||
default_rpc_url = url.replace('/api', '') if url else 'http://localhost:8006'
|
||||
ctx.obj['chain_id'] = get_chain_id(default_rpc_url, override=chain_id)
|
||||
|
||||
# Add commands to CLI
|
||||
|
||||
@@ -16,7 +16,7 @@ from aitbc.paths import get_keystore_path
|
||||
|
||||
# Default paths
|
||||
DEFAULT_KEYSTORE_DIR = get_keystore_path()
|
||||
DEFAULT_RPC_URL = "http://localhost:8005"
|
||||
DEFAULT_RPC_URL = "http://localhost:8006"
|
||||
|
||||
def get_password(password_arg: str = None, password_file: str = None) -> str:
|
||||
"""Get password from various sources"""
|
||||
|
||||
@@ -87,7 +87,7 @@ def handle_bridge_config(args):
|
||||
|
||||
if args.test_mode:
|
||||
print("⚙️ Blockchain Event Bridge Configuration (test mode):")
|
||||
print("🔗 Blockchain RPC URL: http://localhost:8005")
|
||||
print("🔗 Blockchain RPC URL: http://localhost:8006")
|
||||
print("💬 Gossip Backend: redis")
|
||||
return
|
||||
|
||||
|
||||
@@ -30,54 +30,54 @@ genesis_block_initialization() {
|
||||
return 0
|
||||
|
||||
print_status "Initializing blockchain on Follower Node..."
|
||||
if NODE_URL="http://aitbc1:8005" cli_cmd "blockchain init --force"; then
|
||||
if NODE_URL="http://aitbc1:8006" cli_cmd "blockchain init --force"; then
|
||||
print_success "Blockchain initialized on Follower Node"
|
||||
else
|
||||
print_warning "Blockchain may already be initialized on Follower Node"
|
||||
fi
|
||||
|
||||
print_status "Verifying RPC connectivity to Genesis Node (port 8005)..."
|
||||
if curl -s --max-time 5 http://localhost:8005/health > /dev/null 2>&1; then
|
||||
print_success "Genesis Node RPC (port 8005) is accessible"
|
||||
print_status "Verifying RPC connectivity to Genesis Node (port 8006)..."
|
||||
if curl -s --max-time 5 http://localhost:8006/health > /dev/null 2>&1; then
|
||||
print_success "Genesis Node RPC (port 8006) is accessible"
|
||||
else
|
||||
print_warning "Genesis Node RPC (port 8005) is not accessible"
|
||||
print_warning "Genesis Node RPC (port 8006) is not accessible"
|
||||
fi
|
||||
|
||||
print_status "Verifying RPC connectivity to Follower Node (port 8005 on aitbc1)..."
|
||||
if curl -s --max-time 5 http://aitbc1:8005/health > /dev/null 2>&1; then
|
||||
print_success "Follower Node RPC (port 8005 on aitbc1) is accessible"
|
||||
print_status "Verifying RPC connectivity to Follower Node (port 8006 on aitbc1)..."
|
||||
if curl -s --max-time 5 http://aitbc1:8006/health > /dev/null 2>&1; then
|
||||
print_success "Follower Node RPC (port 8006 on aitbc1) is accessible"
|
||||
else
|
||||
print_warning "Follower Node RPC (port 8005 on aitbc1) is not accessible"
|
||||
print_warning "Follower Node RPC (port 8006 on aitbc1) is not accessible"
|
||||
fi
|
||||
|
||||
print_status "Verifying Follower Node RPC also runs on port 8005..."
|
||||
if ssh aitbc1 "curl -s --max-time 5 http://localhost:8005/health" > /dev/null 2>&1; then
|
||||
print_success "Follower Node RPC also accessible on port 8005"
|
||||
print_status "Verifying Follower Node RPC also runs on port 8006..."
|
||||
if ssh aitbc1 "curl -s --max-time 5 http://localhost:8006/health" > /dev/null 2>&1; then
|
||||
print_success "Follower Node RPC also accessible on port 8006"
|
||||
else
|
||||
print_warning "Follower Node RPC not accessible on port 8005 (check follower node health)"
|
||||
print_warning "Follower Node RPC not accessible on port 8006 (check follower node health)"
|
||||
fi
|
||||
|
||||
print_status "Funding training wallet from genesis block initial coins..."
|
||||
# The genesis block contains actual AIT coins - mine a block to get the reward
|
||||
print_status "Starting mining to get genesis block reward..."
|
||||
if NODE_URL="http://localhost:8005" cli_cmd "mining start --wallet $WALLET_NAME"; then
|
||||
if NODE_URL="http://localhost:8006" cli_cmd "mining start --wallet $WALLET_NAME"; then
|
||||
print_success "Mining started for wallet $WALLET_NAME"
|
||||
sleep 5 # Wait for mining to produce a block
|
||||
|
||||
print_status "Checking mining status..."
|
||||
NODE_URL="http://localhost:8005" cli_cmd "mining status --wallet $WALLET_NAME" || print_warning "Mining status check failed"
|
||||
NODE_URL="http://localhost:8006" cli_cmd "mining status --wallet $WALLET_NAME" || print_warning "Mining status check failed"
|
||||
|
||||
print_status "Checking mining rewards..."
|
||||
NODE_URL="http://localhost:8005" cli_cmd "mining rewards --wallet $WALLET_NAME" || print_warning "Mining rewards check failed"
|
||||
NODE_URL="http://localhost:8006" cli_cmd "mining rewards --wallet $WALLET_NAME" || print_warning "Mining rewards check failed"
|
||||
|
||||
print_status "Stopping mining after obtaining genesis reward..."
|
||||
NODE_URL="http://localhost:8005" cli_cmd "mining stop" || print_warning "Mining stop failed"
|
||||
NODE_URL="http://localhost:8006" cli_cmd "mining stop" || print_warning "Mining stop failed"
|
||||
else
|
||||
print_warning "Mining start failed - wallet may not have initial funds"
|
||||
fi
|
||||
|
||||
print_status "Verifying wallet balance after mining genesis block..."
|
||||
NODE_URL="http://localhost:8005" cli_cmd "wallet balance $WALLET_NAME" || print_warning "Balance check failed"
|
||||
NODE_URL="http://localhost:8006" cli_cmd "wallet balance $WALLET_NAME" || print_warning "Balance check failed"
|
||||
|
||||
update_progress "Genesis Block Initialization"
|
||||
}
|
||||
|
||||
@@ -19,15 +19,15 @@ export LOG_DIR="${LOG_DIR:-/var/log/aitbc}"
|
||||
export WALLET_NAME="${WALLET_NAME:-openclaw-trainee}"
|
||||
export WALLET_PASSWORD="${WALLET_PASSWORD:-trainee123}"
|
||||
export TRAINING_TIMEOUT="${TRAINING_TIMEOUT:-300}"
|
||||
export GENESIS_NODE="http://localhost:8005"
|
||||
export FOLLOWER_NODE="http://aitbc1:8005"
|
||||
export GENESIS_NODE="http://localhost:8006"
|
||||
export FOLLOWER_NODE="http://aitbc1:8006"
|
||||
|
||||
# Service endpoints
|
||||
export SERVICES=(
|
||||
"8001:Exchange"
|
||||
"9001:Agent-Coordinator"
|
||||
"8005:Genesis-Node-RPC"
|
||||
"8005:Follower-Node-RPC"
|
||||
"8006:Genesis-Node-RPC"
|
||||
"8006:Follower-Node-RPC"
|
||||
"11434:Ollama"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user