Chain Information
Access comprehensive blockchain metadata, RPC endpoints, and cross-chain data.
Try it Live
Open in Swagger UI → to test these endpoints interactively.
Endpoints​
| Endpoint | Description | Price |
|---|---|---|
GET /api/chains | List all chains | FREE |
GET /api/chains/:id | Chain details | FREE |
GET /api/chains/:id/status | Chain status | FREE |
GET /api/chains/:id/blocks | Recent blocks | $0.005 |
GET /api/chains​
List all supported blockchains.
Request​
curl https://api.web3identity.com/api/chains
Response​
{
"chains": [
{
"id": 1,
"name": "Ethereum",
"shortName": "eth",
"network": "mainnet",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"rpc": ["https://eth.llamarpc.com"],
"explorers": [
{
"name": "Etherscan",
"url": "https://etherscan.io",
"standard": "EIP3091"
}
],
"features": ["ENS", "EIP1559", "EIP4844"],
"testnet": false
},
{
"id": 8453,
"name": "Base",
"shortName": "base",
"network": "mainnet",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"rpc": ["https://mainnet.base.org"],
"parentChain": 1,
"l2Type": "optimistic",
"testnet": false
}
],
"count": 45,
"categories": {
"mainnet": 35,
"testnet": 10,
"l2": 12,
"sidechain": 3
}
}
GET /api/chains/:id​
Get detailed information for a specific chain.
Request​
curl https://api.web3identity.com/api/chains/1
Response​
{
"id": 1,
"name": "Ethereum",
"shortName": "eth",
"network": "mainnet",
"chainType": "L1",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"rpc": [
"https://eth.llamarpc.com",
"https://ethereum.publicnode.com",
"https://rpc.ankr.com/eth"
],
"wss": [
"wss://ethereum.publicnode.com"
],
"explorers": [
{
"name": "Etherscan",
"url": "https://etherscan.io",
"standard": "EIP3091",
"apiUrl": "https://api.etherscan.io/api"
}
],
"consensus": "PoS",
"blockTime": 12,
"gasToken": "ETH",
"features": {
"ens": true,
"eip1559": true,
"eip4844": true,
"multicall": "0xcA11bde05977b3631167028862bE2a173976CA11"
},
"bridges": [
{
"name": "Arbitrum Bridge",
"url": "https://bridge.arbitrum.io",
"chains": [42161]
},
{
"name": "Optimism Bridge",
"url": "https://app.optimism.io/bridge",
"chains": [10]
}
],
"faucets": [],
"testnet": false,
"infoUrl": "https://ethereum.org",
"status": "active"
}
GET /api/chains/:id/status​
Get real-time chain status and health.
Request​
curl https://api.web3identity.com/api/chains/1/status
Response​
{
"chain": "Ethereum",
"chainId": 1,
"status": "healthy",
"currentBlock": 19234567,
"blockTime": 12.1,
"avgBlockTime24h": 12.05,
"gasPrice": {
"fast": 35,
"standard": 28,
"slow": 22
},
"tps": 15.2,
"pendingTransactions": 89234,
"difficulty": "58750003716598352816469",
"hashrate": "892.5 TH/s",
"validators": 987234,
"stakedETH": "32456789",
"lastUpdate": "2026-02-08T12:34:56Z",
"health": {
"rpcLatency": 45,
"blockLag": 0,
"syncStatus": "synced"
}
}
Status Values​
| Status | Description |
|---|---|
healthy | Operating normally |
degraded | Reduced performance |
outage | Not responding |
syncing | Still syncing blocks |
GET /api/chains/:id/blocks​
Get recent blocks for a chain.
Query Parameters​
| Param | Type | Default | Description |
|---|---|---|---|
limit | number | 10 | Max blocks (1-100) |
includeTransactions | boolean | false | Include tx hashes |
Request​
curl "https://api.web3identity.com/api/chains/1/blocks?limit=5"
Response​
{
"chainId": 1,
"blocks": [
{
"number": 19234567,
"hash": "0xabc123...",
"timestamp": "2026-02-08T12:34:56Z",
"miner": "0x...",
"gasUsed": 15234567,
"gasLimit": 30000000,
"baseFee": 25.5,
"transactionCount": 234,
"size": 123456
}
],
"avgBlockTime": 12.1,
"avgGasUsed": 14567890
}
Supported Chains​
Mainnets​
| Chain | ID | Type | ENS |
|---|---|---|---|
| Ethereum | 1 | L1 | âś… |
| Base | 8453 | L2 (OP) | âś… |
| Arbitrum One | 42161 | L2 (OP) | âś… |
| Optimism | 10 | L2 (OP) | âś… |
| Polygon | 137 | Sidechain | âś… |
| Avalanche C-Chain | 43114 | L1 | ❌ |
| BNB Smart Chain | 56 | Sidechain | ❌ |
| Gnosis | 100 | L1 | âś… |
| Polygon zkEVM | 1101 | L2 (ZK) | ❌ |
| zkSync Era | 324 | L2 (ZK) | ❌ |
Testnets​
| Chain | ID | Faucet |
|---|---|---|
| Sepolia | 11155111 | Faucet |
| Base Sepolia | 84532 | Faucet |
| Arbitrum Sepolia | 421614 | Faucet |
SDK Examples​
JavaScript​
import { Web3IdentityClient } from '@web3identity/sdk';
const client = new Web3IdentityClient();
// List all chains
const chains = await client.getChains();
console.log(`Supported chains: ${chains.count}`);
// Get chain details
const ethereum = await client.getChain(1);
console.log(`Block time: ${ethereum.blockTime}s`);
console.log(`Consensus: ${ethereum.consensus}`);
// Check chain status
const status = await client.getChainStatus(1);
console.log(`Current block: ${status.currentBlock}`);
console.log(`TPS: ${status.tps}`);
// Get recent blocks
const blocks = await client.getBlocks(1, { limit: 10 });
console.log(`Latest block: ${blocks.blocks[0].number}`);
React Hook​
import { useState, useEffect } from 'react';
function useChainStatus(chainId: number) {
const [status, setStatus] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
const fetchStatus = async () => {
const res = await fetch(
`https://api.web3identity.com/api/chains/${chainId}/status`
);
const data = await res.json();
setStatus(data);
setLoading(false);
};
fetchStatus();
const interval = setInterval(fetchStatus, 15000); // Update every 15s
return () => clearInterval(interval);
}, [chainId]);
return { status, loading };
}
// Usage
function ChainMonitor({ chainId }: { chainId: number }) {
const { status, loading } = useChainStatus(chainId);
if (loading) return <div>Loading...</div>;
return (
<div className="chain-status">
<h3>{status.chain}</h3>
<div className="metrics">
<div>Block: #{status.currentBlock.toLocaleString()}</div>
<div>TPS: {status.tps.toFixed(1)}</div>
<div>Gas: {status.gasPrice.standard} gwei</div>
<div>Status: <span className={status.status}>{status.status}</span></div>
</div>
</div>
);
}
Python​
from web3identity import Client
client = Client()
# List chains
chains = client.get_chains()
print(f"Total chains: {chains['count']}")
# Get chain info
eth = client.get_chain(1)
print(f"Chain: {eth['name']}")
print(f"Native token: {eth['nativeCurrency']['symbol']}")
print(f"RPC: {eth['rpc'][0]}")
# Check status
status = client.get_chain_status(1)
print(f"Current block: {status['currentBlock']:,}")
print(f"Block time: {status['blockTime']}s")
print(f"Gas (standard): {status['gasPrice']['standard']} gwei")
# Multi-chain comparison
def compare_chains(chain_ids):
for chain_id in chain_ids:
status = client.get_chain_status(chain_id)
print(f"{status['chain']}: {status['tps']:.1f} TPS, {status['gasPrice']['standard']} gwei")
compare_chains([1, 8453, 42161, 10])
cURL Examples​
# List all chains
curl https://api.web3identity.com/api/chains
# Get Ethereum details
curl https://api.web3identity.com/api/chains/1
# Get Base status
curl https://api.web3identity.com/api/chains/8453/status
# Get recent blocks
curl "https://api.web3identity.com/api/chains/1/blocks?limit=10"
# Filter chains by type
curl "https://api.web3identity.com/api/chains?type=l2"
Chain Selection Helper​
// Auto-select fastest chain with lowest gas
async function selectOptimalChain(supportedChains) {
const statuses = await Promise.all(
supportedChains.map(id =>
fetch(`https://api.web3identity.com/api/chains/${id}/status`)
.then(r => r.json())
)
);
// Score based on gas price and TPS
const scored = statuses.map(s => ({
chainId: s.chainId,
chain: s.chain,
score: (s.tps / 10) - (s.gasPrice.standard / 5), // Higher TPS, lower gas = better
gas: s.gasPrice.standard,
tps: s.tps
}));
// Sort by score
scored.sort((a, b) => b.score - a.score);
return scored[0];
}
// Usage
const optimal = await selectOptimalChain([1, 8453, 42161, 10]);
console.log(`Best chain: ${optimal.chain} (${optimal.tps} TPS, ${optimal.gas} gwei)`);
Multi-Chain Routing​
Example of routing transactions based on chain availability:
class ChainRouter {
constructor(preferredChains = [1, 8453, 42161]) {
this.chains = preferredChains;
}
async getHealthyChain() {
for (const chainId of this.chains) {
const status = await fetch(
`https://api.web3identity.com/api/chains/${chainId}/status`
).then(r => r.json());
if (status.status === 'healthy' && status.health.blockLag < 10) {
return {
chainId,
name: status.chain,
gasPrice: status.gasPrice.standard
};
}
}
throw new Error('No healthy chains available');
}
async executeOnBestChain(transaction) {
const chain = await this.getHealthyChain();
console.log(`Routing to ${chain.name} (${chain.gasPrice} gwei)`);
// Execute transaction
return chain;
}
}
const router = new ChainRouter([8453, 42161, 10, 1]); // Prefer L2s
const chain = await router.getHealthyChain();
Bridge Aggregation​
Find available bridges between chains:
async function findBridges(fromChainId, toChainId) {
const fromChain = await fetch(
`https://api.web3identity.com/api/chains/${fromChainId}`
).then(r => r.json());
const bridges = fromChain.bridges.filter(b =>
b.chains.includes(toChainId)
);
return bridges.map(b => ({
name: b.name,
url: b.url,
estimatedTime: b.estimatedTime || 'Unknown'
}));
}
// Find bridges from Ethereum to Arbitrum
const bridges = await findBridges(1, 42161);
bridges.forEach(b => console.log(`${b.name}: ${b.url}`));
RPC Failover​
Implement RPC failover using multiple endpoints:
async function fetchWithFailover(chainId, method, params) {
const chain = await fetch(
`https://api.web3identity.com/api/chains/${chainId}`
).then(r => r.json());
for (const rpc of chain.rpc) {
try {
const response = await fetch(rpc, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method,
params
}),
timeout: 5000
});
if (response.ok) {
const data = await response.json();
return data.result;
}
} catch (error) {
console.warn(`RPC ${rpc} failed, trying next...`);
continue;
}
}
throw new Error(`All RPCs failed for chain ${chainId}`);
}
// Usage
const blockNumber = await fetchWithFailover(1, 'eth_blockNumber', []);
console.log(`Current block: ${parseInt(blockNumber, 16)}`);
Related Endpoints​
- Gas Prices — Gas price data
- Wallet Balances — Multi-chain balances
- Transaction History — Cross-chain transactions
- Token Prices — Multi-chain token prices