# On-chain Block / Height

> On-chain Block / Height is a paid API for AI agents from agent-commerce-factory-jm.austriaeast.cloudapp.azure.com, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Fetch EVM block metadata (latest or by number) including hash, timestamp, gas, miner, and transaction count for a given chain.

## Facts

- Endpoint: POST https://agent-commerce-factory-jm.austriaeast.cloudapp.azure.com/v1/onchain/block
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/on-chain-block-height-58d40635
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_7Ngjj1vbnxW-FSKUVq7Nc

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability on-chain-block-height-58d40635 -d '<json body>'
```

Example prompt: What's the current block height on Ethereum, and can you also pull the full block details — hash, timestamp, gas used, base fee, and miner — for the latest block?

## When to prefer this

Choose this endpoint when you need on-chain block metadata — height, hash, gas stats, timestamp, or miner — for any supported EVM chain (Ethereum, Base, Arbitrum, Optimism, Polygon, BSC). Ideal for indexers needing chain-tip data, agents tracking finality, block explorer bots, or any workflow that needs to anchor activity to a specific block. Prefer this over general crypto price endpoints when you need structural blockchain data rather than market data.

## Known failure modes

- Invalid or unsupported chain name returns an error — use only supported chains: ethereum, base, arbitrum, optimism, polygon, bsc
- Block number exceeds current chain height returns not-found or invalid block error
- Negative or non-integer block number rejected by schema validation
- RPC node unavailability for a specific chain may cause timeout or 503
- Payment failure (x402) blocks the request if USDC balance is insufficient

## Output

Returns a structured object with the block's number, hash, parent hash, Unix timestamp, transaction count, gas used, gas limit, base fee per gas, and miner address for the specified EVM chain and block number (or latest block if no number is provided).

## Request schema (JSON Schema)

```json
{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "type": "object",
 "properties": {
  "input": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "type": "string",
     "enum": [
      "POST"
     ]
    },
    "bodyType": {
     "type": "string",
     "enum": [
      "json",
      "form-data",
      "text"
     ]
    },
    "body": {
     "type": "object",
     "properties": {
      "chain": {
       "type": "string",
       "default": "ethereum",
       "description": "EVM chain (ethereum, base, arbitrum, optimism, polygon, bsc)."
      },
      "block": {
       "type": "integer",
       "minimum": 0,
       "description": "Block number; omit for the latest block."
      }
     },
     "required": []
    }
   },
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "machine": {
       "type": "string"
      },
      "route": {
       "type": "string"
      },
      "chain": {
       "type": "string"
      },
      "block": {
       "type": "object",
       "properties": {
        "chain": {
         "type": [
          "string",
          "null"
         ]
        },
        "number": {
         "type": [
          "integer",
          "null"
         ]
        },
        "hash": {
         "type": [
          "string",
          "null"
         ]
        },
        "parentHash": {
         "type": [
          "string",
          "null"
         ]
        },
        "timestamp": {
         "type": [
          "string",
          "null"
         ]
        },
        "timestampUnix": {
         "type": [
          "integer",
          "null"
         ]
        },
        "txCount": {
         "type": [
          "integer",
          "null"
         ]
        },
        "gasUsed": {
         "type": [
          "string",
          "null"
         ]
        },
        "gasLimit": {
         "type": [
          "string",
          "null"
         ]
        },
        "baseFeePerGasWei": {
         "type": [
          "string",
          "null"
         ]
        },
        "miner": {
         "type": [
          "string",
          "null"
         ]
        }
       }
      },
      "economics": {
       "type": "object",
       "properties": {
     
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/on-chain-block-height-58d40635/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent-commerce-factory-jm.austriaeast.cloudapp.azure.com](https://www.zero.xyz/host/agent-commerce-factory-jm.austriaeast.cloudapp.azure.com/llms.txt)
