Unified Blockchain Pattern
Axol uses a consistent API pattern across all 23+ supported blockchains. Learn one API, access every chain.
Pattern Overview
All blockchain endpoints follow this structure:
/v1/blockchain/{chain}/{resource}/{identifier}
Where:
{chain}- Blockchain identifier (ethereum, polygon, solana, etc.){resource}- Resource type (blocks, transactions, addresses, gas){identifier}- Optional specific item (block number, tx hash, address)
Common Endpoints
Every supported chain provides these endpoints:
Blocks
| Endpoint | Description |
|---|---|
GET /v1/blockchain/{chain}/blocks/latest | Get latest block |
GET /v1/blockchain/{chain}/blocks/{number} | Get block by number |
GET /v1/blockchain/{chain}/blocks/{hash} | Get block by hash |
Transactions
| Endpoint | Description |
|---|---|
GET /v1/blockchain/{chain}/transaction/{hash} | Get transaction details |
GET /v1/blockchain/{chain}/transactions/block/{number} | Get transactions in block |
Addresses
| Endpoint | Description |
|---|---|
GET /v1/blockchain/{chain}/balance/{address} | Get address balance |
GET /v1/blockchain/{chain}/addresses/{address}/transactions | Get address history |
Gas (EVM chains)
| Endpoint | Description |
|---|---|
GET /v1/blockchain/{chain}/gas | Current gas prices |
GET /v1/blockchain/{chain}/gas/history | Historical gas data |
Chain Info
| Endpoint | Description |
|---|---|
GET /v1/blockchain/{chain}/status | Chain status |
GET /v1/blockchain/{chain}/info | Chain information |
GET /v1/blockchain/{chain}/stats/network | Network statistics |
Examples
Get Latest Block
Python:
import requests
API_KEY = "your_api_key"
BASE_URL = "https://api.axol.io/api/v1"
def get_latest_block(chain: str) -> dict:
response = requests.get(
f"{BASE_URL}/blockchain/{chain}/blocks/latest",
headers={"X-API-Key": API_KEY}
)
return response.json()
# Works for any chain
eth_block = get_latest_block("ethereum")
sol_block = get_latest_block("solana")
btc_block = get_latest_block("bitcoin")
TypeScript:
async function getLatestBlock(chain: string): Promise<any> {
const response = await fetch(
`${BASE_URL}/blockchain/${chain}/blocks/latest`,
{ headers: { 'X-API-Key': API_KEY } }
);
return response.json();
}
// Same code, any chain
const ethBlock = await getLatestBlock('ethereum');
const solBlock = await getLatestBlock('solana');
const btcBlock = await getLatestBlock('bitcoin');
Multi-Chain Balance Check
async def get_multi_chain_balances(address: str, chains: list[str]) -> dict:
"""Check balance across multiple chains."""
balances = {}
async with aiohttp.ClientSession() as session:
for chain in chains:
try:
url = f"{BASE_URL}/blockchain/{chain}/balance/{address}"
async with session.get(url, headers=headers) as resp:
data = await resp.json()
balances[chain] = data.get("data", {}).get("balance", "0")
except Exception as e:
balances[chain] = f"Error: {e}"
return balances
# Check one address across multiple chains
balances = await get_multi_chain_balances(
"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb5",
["ethereum", "polygon", "arbitrum", "optimism", "base"]
)
Cross-Chain Gas Comparison
async def compare_gas_prices(chains: list[str]) -> dict:
"""Compare gas prices across EVM chains."""
results = {}
for chain in chains:
try:
response = requests.get(
f"{BASE_URL}/blockchain/{chain}/gas",
headers={"X-API-Key": API_KEY}
)
data = response.json()
results[chain] = {
"fast_gwei": data["fast"],
"chain": chain
}
except Exception:
pass
# Sort by gas price
return dict(sorted(results.items(), key=lambda x: x[1]["fast_gwei"]))
# Find cheapest chain for your transaction
gas_comparison = await compare_gas_prices([
"ethereum", "polygon", "arbitrum", "optimism", "base"
])
Response Format
All responses follow a consistent structure:
Success Response
{
"success": true,
"data": {
"block_number": 19500000,
"block_hash": "0xabc...",
"timestamp": 1697890123,
"transactions": 150
},
"metadata": {
"chain": "ethereum",
"cached": true,
"cache_ttl": 12,
"response_time_ms": 5
}
}
Error Response
{
"success": false,
"error": "chain_not_found",
"message": "Chain 'invalid_chain' is not supported",
"request_id": "req_abc123"
}
Chain-Specific Considerations
While the API pattern is consistent, some chains have unique characteristics:
EVM Chains
- Full gas estimation support
- Smart contract call support
- ENS resolution (Ethereum)
Bitcoin
- UTXO-based queries
- No gas price (fee rate in sat/vB)
- Different address formats
Solana
- Slot-based instead of block numbers
- SPL token support
- Program account queries
Cosmos Chains
- Block height in response
- Validator information
- IBC support
See Also
- Supported Chains - Full list of chains
- Gas API - Gas price endpoints
- Error Handling - Error codes and handling