axionax Core API Reference
Version: 1.5.0-testnet
Overview
axionax Core provides JSON-RPC API compatible with Ethereum clients + custom extensions for compute, consensus, worker, and network status.
- Standard JSON-RPC (port 8545): Ethereum-compatible
- WebSocket (port 8546): Real-time event subscriptions
- Metrics (port 9090): Prometheus metrics endpoint
Standard Ethereum Methods
eth_chainId
Returns the current chain ID.
{
"jsonrpc": "2.0",
"method": "eth_chainId",
"params": [],
"id": 1
}Example result:
{
"jsonrpc": "2.0",
"result": "0x7a69",
"id": 1
}eth_getBalance
- Parameters: address, block number or "latest"
{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", "latest"],
"id": 1
}axionax Custom Methods
axn_submitJob
- Submit a compute job to the network.
- Parameter: job spec object
{
"jsonrpc": "2.0",
"method": "axn_submitJob",
"params": [{
"specs": {"gpu": "NVIDIA RTX 4090", "vram": 24, "framework": "PyTorch", "region": "us-west"},
"sla": {...},
"data": "0x..."
}],
"id": 1
}axn_getJobStatus
- Status of submitted job. Parameter:
job_id
{
"jsonrpc": "2.0", "method": "axn_getJobStatus", "params": ["job_abc123"], "id": 1
}axn_registerWorker
- Register as compute worker. Parameter: specs
{"jsonrpc":"2.0","method":"axn_registerWorker","params":[{...} ],"id":1}axn_getWorkerStatus
- Get worker stats. Parameter: address
{"jsonrpc":"2.0","method":"axn_getWorkerStatus","params":["0x..."],"id":1}axn_getPricingInfo
- Get current job pricing from PPC
{"jsonrpc":"2.0","method":"axn_getPricingInfo","params":[],"id":1}axn_getValidatorInfo
- Get validator info. Parameter: address
WebSocket Subscriptions
- Subscribe to new jobs:
axn_subscribe : ["newJobs"] - Subscribe job updates:
axn_subscribe : ["jobUpdates", {job_id}] - Subscribe price updates:
axn_subscribe : ["priceUpdates"]
Error Codes
| Code | Message | Description |
|---|---|---|
| -32700 | Parse error | Invalid JSON |
| -32600 | Invalid request | Not valid JSON-RPC |
| -32601 | Method not found | Method does not exist |
| -32602 | Invalid params | Invalid method parameters |
| -32603 | Internal error | Internal JSON-RPC error |
| -32000 | Job not found | Job ID does not exist |
| -32001 | Worker not found | Worker address not registered |
| -32002 | Insufficient stake | Not enough staked AXX |
| -32003 | Invalid specs | Hardware specs don't meet reqs |
| -32004 | Quota exceeded | Worker exceeded epoch quota |
| -32005 | Validation failed | PoPC validation failed |
Rate Limits
- Standard RPC: 100 reqs/second/IP
- WebSocket: 50 subscriptions/connection
- Burst: 200 reqs in 10 seconds
Authentication/Security
- Most endpoints public
- Sensitive operations (stake, register, submit proofs) require signed tx
{
"from": "0x...",
"signature": "0x...",
"nonce": 123
}Example Usage
Using curl
# Get chain ID
curl -X POST http://localhost:8545 \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'
# Get pricing info
curl -X POST http://localhost:8545 \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","method":"axn_getPricingInfo","params":[],"id":1}'Using TypeScript (Web3.js)
import Web3 from 'web3';
const web3 = new Web3('http://localhost:8545');
// Standard
gp const chainId = await web3.eth.getChainId();
// Custom
gp const pricing = await web3.currentProvider.send('axn_getPricingInfo', []);
Using Python (web3.py)
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('http://localhost:8545'))
# Standard method
chain_id = w3.eth.chain_id
# Custom axionax method
pricing = w3.provider.make_request('axn_getPricingInfo', [])