The marketplace handler was hardcoded to use port 8102, but the Exchange API
service runs on port 8001. Updated all marketplace_url default values from
http://localhost:8102 to http://localhost:8001 to fix connection errors
in Stage 4 training.
- Change /blocks/{number} to /rpc/blocks/{number} for block queries
- Fix chain_id fallback logic to use 'or' instead of getattr default
- Update all genesis block checks to use /rpc/blocks/0 endpoint
This aligns blockchain CLI commands with the actual RPC API paths.
Fixed two CLI bugs exposed during training:
1. wallet send - Fixed 'name requests is not defined'
- Added missing 'import requests' in cli/handlers/wallet.py
- Command now reaches RPC correctly; failures are blockchain-level
2. wallet transactions - Fixed 'list object has no attribute get'
- Updated get_transactions in cli/aitbc_cli.py to handle both list and dict responses
- RPC /rpc/transactions returns a list, CLI expected dict with transactions key
- Normalizes tx_hash to hash for display
3. Training self-transfer - Skip when wallet has 0 balance
- Updated scripts/training/stage1_foundation.sh to check wallet balance before self-transfer
- Avoids retrying guaranteed failures when wallet has no on-chain account
Validation:
- wallet transactions: No longer raises list.get error
- wallet send: Fails correctly at blockchain layer (sender account not found)
- Training script: Skips self-transfer when balance is 0
Prevented RPC service from producing blocks by:
- Added AITBC_FORCE_ENABLE_BLOCK_PRODUCTION environment variable (highest priority)
- Updated _env_value() helper to check multiple env var names in priority order
- Set all block production env vars to false in RPC wrapper script
- Added AITBC_FORCE_ENABLE_BLOCK_PRODUCTION=false to systemd service file
- Fixed CLI get_balance() to use requests library instead of AITBCHTTPClient
- Added 404 handling in
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.
- Add chain_id parameter to blockchain block command for multi-chain support
- Update block query to pass chain_id as request parameter
- Update block output fields to match RPC response (tx_count, proposer)
- Add /health endpoint alias to exchange API (in addition to /api/health)
- Simplify genesis block initialization in training script (skip redundant checks)
Updated blockchain CLI handlers to use real blockchain RPC endpoints instead of mock data:
- handle_blockchain_block(): Query /blocks/{number} endpoint instead of printing mock data
- handle_blockchain_init(): Check blockchain status via /blocks/0 instead of /rpc/init
- handle_blockchain_genesis(): Use /blocks/0 endpoint for genesis block operations
- Pass default_rpc_url to handle_blockchain_block() in unified_cli.py
Updated training
Fixed CLI blockchain connection timeout errors by updating default RPC URL
from port 8006 to port 8005 across all CLI modules.
Root cause:
- Port 8006 is for blockchain P2P protocol (not HTTP RPC)
- Port 8005 is the HTTP RPC API port
- CLI was trying to use HTTP on port 8006, causing timeouts
Updated files:
- cli/advanced_wallet.py: DEFAULT_RPC_URL
- cli/enterprise_cli.py: DEFAULT_RPC_URL
- cli/commands/blockchain.py: _get_node_endpoint()
- cli/core/main.py: default_rpc_url
- cli/commands/sync.py: source and import-url defaults
- cli/commands/marketplace.py: rpc_url config default
- cli/commands/blockchain_event_bridge.py: test mode config
- cli/handlers/bridge.py: test mode config
- cli/commands/deployment.py: service endpoints
This fixes the training script errors where CLI commands were timing out
when trying to connect to the blockchain node.
- Fix hardcoded DATABASE_URL in 4 new microservices (gpu-service, governance-service, trading-service, marketplace-service) - now use os.getenv() with SQLite fallback
- Move httpx.AsyncClient to API gateway lifespan for connection pooling
- Add 30-second timeout to API gateway proxy calls
- Move hardcoded service URLs to environment variables in API gateway (GPU_SERVICE_URL, MARKETPLACE_SERVICE_URL, etc.)
- Add cli/build/ and cli/dist/ to .gitignore and remove 42 stale build artifacts from git
- Fix version pinning conflicts in 4 new service pyproject.toml files (align with root: fastapi >=0.115.6, sqlmodel >=0.0.38, pytest >=9.0.3)
- Fix 18 remaining datetime.utcnow() calls in monitoring-service and ai-service (replace with datetime.now(timezone.utc))
- Add retries (3 attempts), authentication (Bearer token), rate limiting (100/min via slowapi), and circuit breaker to API gateway
- Add /ready and /live endpoints to 4 new microservices for production readiness/liveness probes
- Audit debug logging - confirmed no sensitive data (passwords, keys, secrets, tokens) is logged; cache keys and masked API keys are safe
- Convert api-gateway pyproject.toml to old Poetry format for workspace compatibility
- Add routing configuration for AI service (port 8106)
- Add routing configuration for Monitoring service (port 8107)
- Add routing configuration for OpenClaw service (port 8108)
- Add routing configuration for Plugin service (port 8109)
- Remove duplicate middleware implementations from coordinator-api (app_logging.py, error
Fixed hardcoded IP addresses in production code by replacing them with
environment variables or config settings:
- apps/blockchain-node/src/aitbc_chain/sync_cli.py: Use AITBC_SYNC_SOURCE
and AITBC_SYNC_IMPORT_URL env vars for RPC URLs
- apps/blockchain-node/src/aitbc_chain/app.py: Use AITBC_TRUSTED_IPS
env var for rate limiting bypass
- apps/coordinator-api/src/app/routers/client.py: Use settings.blockchain_rpc_url
for RPC endpoint
- dev/scripts/dev_heartbeat.py: Use AITBC_LOCAL_RPC and AITBC_GENESIS_RPC
env vars for RPC URLs
- cli/aitbc_cli.py: Use AITBC_FOLLOWER_HOST and AITBC_FOLLOWER_PORT
env vars for network peer display
This makes the codebase more portable and configurable for different
deployment environments.
Deleted .bak, .backup, and .orig files:
- 2 .orig files from blockchain-node
- 9 .bak files from cli commands
- 1 .bak file from dev scripts
- 1 .backup file from docs
- 1 .bak file from scripts
These files add noise and should not be tracked in git.
- Remove host.docker.internal from api-endpoint-tests.yml CI workflow
- Remove Docker build/push commands from production-deploy.sh
- Remove Docker prerequisite checks from deploy.sh
- Remove Docker from CLI deployment instructions
- Remove Docker from marketplace_scaler.py scaling comment
- Remove Docker from agent_security.py sandbox config and comments
- Remove Docker from developer_platform.py skills list
- Remove Dockerfile/docker-compose.yml from final-cleanup.sh output
- Addresses request to remove all Docker support references
- Replace hardcoded 10.1.223.40 in sync.py with AITBC_SYNC_SOURCE_URL env var
- Replace hardcoded 10.1.223.1 in explorer.py with AITBC_EXPLORER_URL env var
- Default to localhost if env vars not set
- Addresses report item #4 (hardcoded IPs)
- Replace all 2,087 uses of datetime.utcnow() across 294 files
- Add UTC import to datetime statements where needed
- Addresses Python 3.12+ deprecation warning (report item #3)