refactor: migrate blockchain CLI commands to use centralized config and update port assignments
- Replace load_multichain_config() with ctx.obj['config'] in all blockchain commands - Update blockchain RPC port from 8003 to 8006 throughout CLI - Add blockchain_rpc_url and wallet_url fields to Config class with environment variable support - Update node status command to use new port logic (8006 for primary, 8026 for dev) - Update installation docs to reflect new blockchain RPC port (8006) - Update
This commit is contained in:
@@ -8,7 +8,7 @@ This document illustrates the complete flow of a job submission through the CLI
|
||||
┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
||||
│ CLI │ │ Client │ │Coordinator │ │ Blockchain │ │ Miner │ │ Ollama │
|
||||
│ Wrapper │────▶│ Python │────▶│ Service │────▶│ Node │────▶│ Daemon │────▶│ Server │
|
||||
│(aitbc-cli.sh)│ │ (client.py) │ │ (port 18000)│ │ (RPC:26657) │ │ (port 18001)│ │ (port 11434)│
|
||||
│(aitbc-cli.sh)│ │ (client.py) │ │ (port 8000) │ │ (RPC:8006) │ │ (port 8005) │ │ (port 11434)│
|
||||
└─────────────┘ └──────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
|
||||
```
|
||||
|
||||
@@ -24,7 +24,7 @@ This document illustrates the complete flow of a job submission through the CLI
|
||||
**Internal Process:**
|
||||
1. Bash script (`aitbc-cli.sh`) parses arguments
|
||||
2. Sets environment variables:
|
||||
- `AITBC_URL=http://127.0.0.1:18000`
|
||||
- `AITBC_URL=http://127.0.0.1:8000`
|
||||
- `CLIENT_KEY=${CLIENT_API_KEY}`
|
||||
3. Calls Python client: `python3 cli/client.py --url $AITBC_URL --api-key $CLIENT_KEY submit inference --prompt "..."`
|
||||
|
||||
@@ -50,7 +50,7 @@ This document illustrates the complete flow of a job submission through the CLI
|
||||
**HTTP Request:**
|
||||
```http
|
||||
POST /v1/jobs
|
||||
Host: 127.0.0.1:18000
|
||||
Host: 127.0.0.1:8000
|
||||
Content-Type: application/json
|
||||
X-Api-Key: ${CLIENT_API_KEY}
|
||||
|
||||
@@ -61,7 +61,7 @@ X-Api-Key: ${CLIENT_API_KEY}
|
||||
}
|
||||
```
|
||||
|
||||
**Coordinator Service (Port 18000):**
|
||||
**Coordinator Service (Port 8000):**
|
||||
1. Receives HTTP request
|
||||
2. Validates API key and job parameters
|
||||
3. Generates unique job ID: `job_123456`
|
||||
@@ -112,10 +112,10 @@ X-Api-Key: ${CLIENT_API_KEY}
|
||||
- Select based on stake, reputation, capacity
|
||||
3. Selected miner: `${MINER_API_KEY}`
|
||||
|
||||
**Coordinator → Miner Daemon (Port 18001):**
|
||||
**Coordinator → Miner Daemon (Port 8005):**
|
||||
```http
|
||||
POST /v1/jobs/assign
|
||||
Host: 127.0.0.1:18001
|
||||
Host: 127.0.0.1:8005
|
||||
Content-Type: application/json
|
||||
X-Api-Key: ${ADMIN_API_KEY}
|
||||
|
||||
@@ -132,7 +132,7 @@ X-Api-Key: ${ADMIN_API_KEY}
|
||||
|
||||
### 6. Miner Processing
|
||||
|
||||
**Miner Daemon (Port 18001):**
|
||||
**Miner Daemon (Port 8005):**
|
||||
1. Receives job assignment
|
||||
2. Updates job status to `running`
|
||||
3. Notifies coordinator:
|
||||
@@ -178,10 +178,10 @@ Content-Type: application/json
|
||||
|
||||
### 8. Result Submission to Coordinator
|
||||
|
||||
**Miner → Coordinator (Port 18000):**
|
||||
**Miner → Coordinator (Port 8000):**
|
||||
```http
|
||||
POST /v1/jobs/job_123456/complete
|
||||
Host: 127.0.0.1:18000
|
||||
Host: 127.0.0.1:8000
|
||||
Content-Type: application/json
|
||||
X-Miner-Key: ${MINER_API_KEY}
|
||||
|
||||
@@ -243,7 +243,7 @@ X-Miner-Key: ${MINER_API_KEY}
|
||||
**HTTP Request:**
|
||||
```http
|
||||
GET /v1/jobs/job_123456
|
||||
Host: 127.0.0.1:18000
|
||||
Host: 127.0.0.1:8000
|
||||
X-Api-Key: ${CLIENT_API_KEY}
|
||||
```
|
||||
|
||||
@@ -276,9 +276,9 @@ Cost: 0.25 AITBC
|
||||
|-----------|------|----------|----------------|
|
||||
| CLI Wrapper | N/A | Bash | User interface, argument parsing |
|
||||
| Client Python | N/A | Python | HTTP client, job formatting |
|
||||
| Coordinator | 18000 | HTTP/REST | Job management, API gateway |
|
||||
| Blockchain Node | 26657 | JSON-RPC | Transaction processing, consensus |
|
||||
| Miner Daemon | 18001 | HTTP/REST | Job execution, GPU management |
|
||||
| Coordinator | 8000 | HTTP/REST | Job management, API gateway |
|
||||
| Blockchain Node | 8006 | JSON-RPC | Transaction processing, consensus |
|
||||
| Miner Daemon | 8005 | HTTP/REST | Job execution, GPU management |
|
||||
| Ollama Server | 11434 | HTTP/REST | AI model inference |
|
||||
|
||||
## Message Flow Timeline
|
||||
@@ -286,12 +286,12 @@ Cost: 0.25 AITBC
|
||||
```
|
||||
0s: User submits CLI command
|
||||
└─> 0.1s: Python client called
|
||||
└─> 0.2s: HTTP POST to Coordinator (port 18000)
|
||||
└─> 0.2s: HTTP POST to Coordinator (port 8000)
|
||||
└─> 0.3s: Coordinator validates and creates job
|
||||
└─> 0.4s: RPC to Blockchain (port 26657)
|
||||
└─> 0.4s: RPC to Blockchain (port 8006)
|
||||
└─> 0.5s: Transaction in mempool
|
||||
└─> 1.0s: Job queued for miner
|
||||
└─> 2.0s: Miner assigned (port 18001)
|
||||
└─> 2.0s: Miner assigned (port 8005)
|
||||
└─> 2.1s: Miner accepts job
|
||||
└─> 2.2s: Ollama request (port 11434)
|
||||
└─> 14.7s: Inference complete (12.5s processing)
|
||||
|
||||
Reference in New Issue
Block a user