feat: blockchain production updates for aitbc1
Some checks failed
AITBC CI/CD Pipeline / lint-and-test (3.11) (pull_request) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (pull_request) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (pull_request) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.11) (pull_request) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.12) (pull_request) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.13) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (pull_request) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (pull_request) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (pull_request) Has been cancelled
Security Scanning / Dependency Security Scan (pull_request) Has been cancelled
Security Scanning / Container Security Scan (pull_request) Has been cancelled
Security Scanning / OSSF Scorecard (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-cli (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-services (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (pull_request) Has been cancelled
AITBC CI/CD Pipeline / security-scan (pull_request) Has been cancelled
AITBC CI/CD Pipeline / build (pull_request) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (pull_request) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (pull_request) Has been cancelled
AITBC CI/CD Pipeline / performance-test (pull_request) Has been cancelled
AITBC CI/CD Pipeline / docs (pull_request) Has been cancelled
AITBC CI/CD Pipeline / release (pull_request) Has been cancelled
AITBC CI/CD Pipeline / notify (pull_request) Has been cancelled
AITBC CLI Level 1 Commands Test / test-summary (pull_request) Has been cancelled
Security Scanning / Security Summary Report (pull_request) Has been cancelled
Some checks failed
AITBC CI/CD Pipeline / lint-and-test (3.11) (pull_request) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (pull_request) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (pull_request) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.11) (pull_request) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.12) (pull_request) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.13) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (pull_request) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (pull_request) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (pull_request) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (pull_request) Has been cancelled
Security Scanning / Dependency Security Scan (pull_request) Has been cancelled
Security Scanning / Container Security Scan (pull_request) Has been cancelled
Security Scanning / OSSF Scorecard (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-cli (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-services (pull_request) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (pull_request) Has been cancelled
AITBC CI/CD Pipeline / security-scan (pull_request) Has been cancelled
AITBC CI/CD Pipeline / build (pull_request) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (pull_request) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (pull_request) Has been cancelled
AITBC CI/CD Pipeline / performance-test (pull_request) Has been cancelled
AITBC CI/CD Pipeline / docs (pull_request) Has been cancelled
AITBC CI/CD Pipeline / release (pull_request) Has been cancelled
AITBC CI/CD Pipeline / notify (pull_request) Has been cancelled
AITBC CLI Level 1 Commands Test / test-summary (pull_request) Has been cancelled
Security Scanning / Security Summary Report (pull_request) Has been cancelled
- Update blockchain node scripts for devnet and mainnet - Update blockchain RPC router for production - Update coordinator API main configuration - Update blockchain router endpoints - Add production key generation script - Remove gitea token file (security)
This commit is contained in:
@@ -1 +0,0 @@
|
||||
GITEA_TOKEN=ffce3b62d583b761238ae00839dce7718acaad85
|
||||
@@ -3,12 +3,17 @@ set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
VENV_PYTHON="$ROOT_DIR/.venv/bin/python"
|
||||
if [ ! -x "$VENV_PYTHON" ]; then
|
||||
echo "[devnet] Virtualenv not found at $VENV_PYTHON. Please create it: python -m venv .venv && .venv/bin/pip install -r requirements.txt"
|
||||
exit 1
|
||||
fi
|
||||
export PYTHONPATH="${ROOT_DIR}/src:${ROOT_DIR}/scripts:${PYTHONPATH:-}"
|
||||
|
||||
GENESIS_PATH="data/devnet/genesis.json"
|
||||
ALLOCATIONS_PATH="data/devnet/allocations.json"
|
||||
PROPOSER_ADDRESS="ait15v2cdlz5a3uy3wfurgh6m957kahnhhprdq7fy9m6eay05mvrv4jsyx4sks"
|
||||
python "scripts/make_genesis.py" \
|
||||
"$VENV_PYTHON" "scripts/make_genesis.py" \
|
||||
--output "$GENESIS_PATH" \
|
||||
--force \
|
||||
--allocations "$ALLOCATIONS_PATH" \
|
||||
@@ -42,18 +47,18 @@ cleanup() {
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
python -m aitbc_chain.main &
|
||||
"$VENV_PYTHON" -m aitbc_chain.main &
|
||||
CHILD_PIDS+=($!)
|
||||
echo "[devnet] Blockchain node started (PID ${CHILD_PIDS[-1]})"
|
||||
|
||||
sleep 1
|
||||
|
||||
python -m uvicorn aitbc_chain.app:app --host 127.0.0.1 --port 8026 --log-level info &
|
||||
"$VENV_PYTHON" -m uvicorn aitbc_chain.app:app --host 127.0.0.1 --port 8026 --log-level info &
|
||||
CHILD_PIDS+=($!)
|
||||
echo "[devnet] RPC API serving at http://127.0.0.1:8026"
|
||||
|
||||
# Optional: mock coordinator for devnet only
|
||||
# python -m uvicorn mock_coordinator:app --host 127.0.0.1 --port 8090 --log-level info &
|
||||
# "$VENV_PYTHON" -m uvicorn mock_coordinator:app --host 127.0.0.1 --port 8090 --log-level info &
|
||||
# CHILD_PIDS+=($!)
|
||||
# echo "[devnet] Mock coordinator serving at http://127.0.0.1:8090"
|
||||
|
||||
|
||||
@@ -3,6 +3,11 @@ set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
VENV_PYTHON="$ROOT_DIR/.venv/bin/python"
|
||||
if [ ! -x "$VENV_PYTHON" ]; then
|
||||
echo "[mainnet] Virtualenv not found at $VENV_PYTHON. Please create it: python -m venv .venv && .venv/bin/pip install -r requirements.txt"
|
||||
exit 1
|
||||
fi
|
||||
export PYTHONPATH="${ROOT_DIR}/src:${ROOT_DIR}/scripts:${PYTHONPATH:-}"
|
||||
|
||||
# Load production environment
|
||||
@@ -67,13 +72,13 @@ cleanup() {
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
python -m aitbc_chain.main &
|
||||
"$VENV_PYTHON" -m aitbc_chain.main &
|
||||
CHILD_PIDS+=($!)
|
||||
echo "[mainnet] Blockchain node started (PID ${CHILD_PIDS[-1]})"
|
||||
|
||||
sleep 2
|
||||
|
||||
python -m uvicorn aitbc_chain.app:app --host 127.0.0.1 --port 8026 --log-level info &
|
||||
"$VENV_PYTHON" -m uvicorn aitbc_chain.app:app --host 127.0.0.1 --port 8026 --log-level info &
|
||||
CHILD_PIDS+=($!)
|
||||
echo "[mainnet] RPC API serving at http://127.0.0.1:8026"
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ from .mempool import init_mempool
|
||||
from .metrics import metrics_registry
|
||||
from .rpc.router import router as rpc_router
|
||||
from .rpc.websocket import router as websocket_router
|
||||
from .escrow_routes import router as escrow_router
|
||||
# from .escrow_routes import router as escrow_router # Not yet implemented
|
||||
|
||||
_app_logger = get_logger("aitbc_chain.app")
|
||||
|
||||
@@ -132,7 +132,7 @@ def create_app() -> FastAPI:
|
||||
# Include routers
|
||||
app.include_router(rpc_router, prefix="/rpc", tags=["rpc"])
|
||||
app.include_router(websocket_router, prefix="/rpc")
|
||||
app.include_router(escrow_router, prefix="/rpc")
|
||||
# app.include_router(escrow_router, prefix="/rpc") # Disabled until escrow routes are implemented
|
||||
|
||||
# Metrics and health endpoints
|
||||
metrics_router = APIRouter()
|
||||
|
||||
@@ -4,6 +4,7 @@ from sqlalchemy import func
|
||||
import asyncio
|
||||
import json
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from fastapi import APIRouter, HTTPException, status
|
||||
|
||||
@@ -469,6 +469,6 @@ def create_app() -> FastAPI:
|
||||
|
||||
app = create_app()
|
||||
|
||||
# Register jobs router
|
||||
from .routers import jobs as jobs_router
|
||||
app.include_router(jobs_router.router)
|
||||
# Register jobs router (disabled - legacy)
|
||||
# from .routers import jobs as jobs_router
|
||||
# app.include_router(jobs_router.router)
|
||||
|
||||
@@ -11,11 +11,12 @@ router = APIRouter(tags=["blockchain"])
|
||||
async def blockchain_status():
|
||||
"""Get blockchain status."""
|
||||
try:
|
||||
# Try to get blockchain status from RPC
|
||||
import httpx
|
||||
from ..config import settings
|
||||
|
||||
rpc_url = settings.blockchain_rpc_url.rstrip('/')
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.get("http://localhost:8003/rpc/head", timeout=5.0)
|
||||
response = await client.get(f"{rpc_url}/rpc/head", timeout=5.0)
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
return {
|
||||
@@ -42,11 +43,12 @@ async def blockchain_status():
|
||||
async def blockchain_sync_status():
|
||||
"""Get blockchain synchronization status."""
|
||||
try:
|
||||
# Try to get sync status from RPC
|
||||
import httpx
|
||||
from ..config import settings
|
||||
|
||||
rpc_url = settings.blockchain_rpc_url.rstrip('/')
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.get("http://localhost:8003/rpc/sync", timeout=5.0)
|
||||
response = await client.get(f"{rpc_url}/rpc/sync", timeout=5.0)
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
return {
|
||||
|
||||
27
dev/scripts/generate_production_keys.py
Normal file
27
dev/scripts/generate_production_keys.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import secrets
|
||||
import string
|
||||
import json
|
||||
import os
|
||||
|
||||
def random_string(length=32):
|
||||
alphabet = string.ascii_letters + string.digits
|
||||
return ''.join(secrets.choice(alphabet) for _ in range(length))
|
||||
|
||||
def generate_production_keys():
|
||||
client_key = f"client_prod_key_{random_string(24)}"
|
||||
miner_key = f"miner_prod_key_{random_string(24)}"
|
||||
admin_key = f"admin_prod_key_{random_string(24)}"
|
||||
hmac_secret = random_string(64)
|
||||
jwt_secret = random_string(64)
|
||||
return {
|
||||
"CLIENT_API_KEYS": [client_key],
|
||||
"MINER_API_KEYS": [miner_key],
|
||||
"ADMIN_API_KEYS": [admin_key],
|
||||
"HMAC_SECRET": hmac_secret,
|
||||
"JWT_SECRET": jwt_secret
|
||||
}
|
||||
|
||||
if __name__ == "__main__":
|
||||
keys = generate_production_keys()
|
||||
print(json.dumps(keys, indent=2))
|
||||
Reference in New Issue
Block a user