Get chains

Reports one chain and whether its upstream is answering.

GET /v1/web3/chains/{chain}

Addresshttps://api.hanzo.ai/v1/web3/chains/{chain}
MethodGET
Operationget_web3_chains_by_chain
AuthAuthorization: Bearer $HANZO_API_KEY

Reports one chain and whether its upstream is answering. An unreachable chain is still a 200 with live:false — the chain is configured, which is a different fact from the chain being up, and a 502 here would make a console page error rather than show the outage.

Request

1 field.

FieldInTypeRequiredDescription
chainpathstringyesChain is the registry id, as in /v1/web3/chains/lux.

Response

StatusBodyMeaning
200web3.chainStatusok
defaultproblem-detailsrefused

200 body — 5 fields.

FieldInTypeAlwaysDescription
chainIdbodyinteger (int64)—ChainID is the EIP-155 id, so a caller can check it matches the wallet they are about to sign with.
heightbodyinteger (int64)—Height is the latest block, omitted when the chain did not answer rather than reported as zero — a zero height is a real value on a fresh chain.
idbodystring—ID is the URL name: the value of :chain.
livebodyboolean—Live is whether the upstream answered eth_blockNumber.
namebodystring—Name is for humans.

Failure carries the platform error shape — see Errors.

Examples

hanzo web3 chains get <chain>
import { Configuration, Web3Api } from 'hanzoai';

const api = new Web3Api(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getWeb3ChainsByChain({ chain: 'chain' });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import Web3Api

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = Web3Api(client).get_web3_chains_by_chain(chain='chain')
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.Web3API.GetWeb3ChainsByChain(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, web3_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = web3_api::get_web3_chains_by_chain(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.Web3Api;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new Web3Api(client).getWeb3ChainsByChain();
curl https://api.hanzo.ai/v1/web3/chains/<chain> \
  -H "Authorization: Bearer $HANZO_API_KEY"

MCP reaches web3 through the web3 tool, which names its 3 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_web3_chains"
         }
       }
     }'

Web3 API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.