# Corn API
> Live Corn on-chain data via Blockscout. Corn (Maizenet) is a Bitcoin-backed Ethereum L2; gas and balances are in BTCN. Network stats, gas prices, latest blocks, a block by height or hash, address detail with BTCN balance, a transaction by hash, ERC-20 token metadata and a universal search across addresses, tokens, blocks and transactions. Real data, no key.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/corn-api/..."
```

## Pricing
- **Free** (Free) — 1,650 calls/Mo, 1 req/s
- **Basic** ($11/Mo) — 79,000 calls/Mo, 10 req/s
- **Pro** ($34/Mo) — 505,000 calls/Mo, 20 req/s
- **Mega** ($108/Mo) — 2,550,000 calls/Mo, 50 req/s

## Endpoints

### Network

#### `GET /v1/gas` — Current gas prices

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/corn-api/v1/gas"
```

**Response:**
```json
{
    "data": {
        "fast": 1.01,
        "slow": 1.01,
        "unit": "gwei",
        "average": 1.01,
        "gas_used_today": "342812454"
    },
    "meta": {
        "timestamp": "2026-06-08T09:51:21.275Z",
        "request_id": "7054e559-cf83-45dc-a1c4-04f92e3ea88a"
    },
    "status": "ok",
    "message": "Gas retrieved successfully",
    "success": true
}
```

#### `GET /v1/stats` — Network statistics

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/corn-api/v1/stats"
```

**Response:**
```json
{
    "data": {
        "tvl_usd": null,
        "gas_prices": {
            "fast": 1.01,
            "slow": 1.01,
            "average": 1.01
        },
        "total_blocks": 1635159,
        "coin_price_usd": null,
        "gas_used_today": "342812454",
        "market_cap_usd": 0,
        "total_addresses": "19526",
        "total_transactions": "3927134",
        "transactions_today": "7607",
        "network_utilization_percent": 9.0378478034836e-9
    },
    "meta": {
        "timestamp": "2026-06-08T09:51:21.584Z",
        "request_id": "97e6c374-a9e9-42a6-b6e8-5bc79cb47f37"
    },
    "status": "ok",
    "message": "Stats retrieved successfully",
    "success": true
}
```

### Blocks

#### `GET /v1/block` — A block by height or hash

**Parameters:**
- `height` (query, optional, string) — Block height Example: `1634112`
- `hash` (query, optional, string) — Block hash

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/corn-api/v1/block?height=1634112"
```

**Response:**
```json
{
    "data": {
        "block": {
            "hash": "0x14163f2cda88467e16d530ba389b6a205b8edab80e8d3909d203a9b87b0cbf94",
            "size": 1871,
            "miner": "0xA4b000000000000000000073657175656e636572",
            "height": 1634112,
            "gas_used": 119089,
            "tx_count": 2,
            "gas_limit": 1125899906842624,
            "timestamp": "2026-06-08T02:06:55.000000Z",
            "burnt_fees": "59544500000",
            "difficulty": "1",
            "base_fee_per_gas": "500000"
        }
    },
    "meta": {
        "timestamp": "2026-06-08T09:51:21.877Z",
        "request_id": "92e4da59-23e6-4fd4-bc16-3db7345d0d3b"
    },
    "status": "ok",
    "message": "Block retrieved successfully",
    "success": true
}
```

#### `GET /v1/blocks` — Latest blocks

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/corn-api/v1/blocks"
```

**Response:**
```json
{
    "data": {
        "count": 50,
        "blocks": [
            {
                "hash": "0x57a70b27dea9840c4f421136feaba4f1b6c7544ae3e7e7ae496843d8dad42283",
                "size": 1934,
                "miner": "0xA4b000000000000000000073657175656e636572",
                "height": 1635194,
                "gas_used": 116304,
                "tx_count": 2,
                "gas_limit": 1125899906842624,
                "timestamp": "2026-06-08T09:50:51.000000Z",
                "burnt_fees": "58152000000",
                "difficulty": "1",
                "base_fee_per_gas": "500000"
            },
            {
                "hash": "0x89f7198eef671f94de77ef42ef473f3327772299784ed1dc29bed1aafd66da03",
                "size": 1871,
                "miner": "0xA4b000000000000000000073657175656e636572",
                "height": 1635193,
                "gas_used": 119065,
                "tx_count": 2,
                "gas_limit": 1125899906842624,
                "timestamp": "2026-06-08T09:50:18.000000Z",
                "burnt_fees": "59532500000",
                "difficulty": "1",
                "base_fee_per_gas": "500000"
            },
            {
                "hash": "0x22139c8cf617cc11bb6291878571832b30de725018a50c4b6c005f1f5fb3770e",
                "size": 1934,
                "miner": "0xA4b000000000000000000073657175656e636572",
                "height": 1635192,
                "gas_used": 116280,
                "tx_count": 2,
                
…(truncated, see openapi.json for full schema)
```

### Accounts

#### `GET /v1/address` — Address detail with BTCN balance

**Parameters:**
- `address` (query, required, string) — Address hash Example: `0xDF0B24095e15044538866576754F3C964e902Ee6`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/corn-api/v1/address?address=0xDF0B24095e15044538866576754F3C964e902Ee6"
```

**Response:**
```json
{
    "data": {
        "address": {
            "ens": null,
            "hash": "0xDF0B24095e15044538866576754F3C964e902Ee6",
            "name": "FiatTokenProxy",
            "token": {
                "name": "Bridged USDC (Corn)",
                "type": "ERC-20",
                "symbol": "USDC.e"
            },
            "creator": "0xa83c39D47fc482d6E792e9fb2156d0b4E790d1F5",
            "balance_wei": "0",
            "is_contract": true,
            "is_verified": true,
            "balance_btcn": 0
        }
    },
    "meta": {
        "timestamp": "2026-06-08T09:51:22.866Z",
        "request_id": "207076fe-ff74-4110-a594-871913ea5852"
    },
    "status": "ok",
    "message": "Address retrieved successfully",
    "success": true
}
```

### Transactions

#### `GET /v1/transaction` — A transaction by hash

**Parameters:**
- `hash` (query, required, string) — Transaction hash Example: `0x5476f51f921c85f441a4be7611d493154773058c9273670129e093ecf17d0249`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/corn-api/v1/transaction?hash=0x5476f51f921c85f441a4be7611d493154773058c9273670129e093ecf17d0249"
```

**Response:**
```json
{
    "data": {
        "transaction": {
            "to": "0x00000000000000000000000000000000000A4B05",
            "from": "0x00000000000000000000000000000000000A4B05",
            "hash": "0x5476f51f921c85f441a4be7611d493154773058c9273670129e093ecf17d0249",
            "type": 106,
            "block": 1634112,
            "nonce": 0,
            "method": "startBlock",
            "status": "ok",
            "fee_wei": "0",
            "fee_btcn": 0,
            "gas_used": 0,
            "gas_price": "500000",
            "timestamp": "2026-06-08T02:06:55.000000Z",
            "value_wei": "0",
            "value_btcn": 0,
            "confirmations": 1083
        }
    },
    "meta": {
        "timestamp": "2026-06-08T09:51:23.232Z",
        "request_id": "cb9c9988-8b12-48e3-b8f1-4331b9b7f522"
    },
    "status": "ok",
    "message": "Transaction retrieved successfully",
    "success": true
}
```

### Tokens

#### `GET /v1/token` — ERC-20 token metadata

**Parameters:**
- `address` (query, required, string) — Token contract address Example: `0xDF0B24095e15044538866576754F3C964e902Ee6`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/corn-api/v1/token?address=0xDF0B24095e15044538866576754F3C964e902Ee6"
```

**Response:**
```json
{
    "data": {
        "token": {
            "icon": null,
            "name": "Bridged USDC (Corn)",
            "type": "ERC-20",
            "symbol": "USDC.e",
            "holders": null,
            "decimals": 6,
            "total_supply": "21256395828",
            "exchange_rate_usd": null,
            "circulating_market_cap": null
        }
    },
    "meta": {
        "timestamp": "2026-06-08T09:51:23.537Z",
        "request_id": "95a2ebb3-8867-47a5-9f77-85b64f48fbee"
    },
    "status": "ok",
    "message": "Token retrieved successfully",
    "success": true
}
```

### Search

#### `GET /v1/search` — Universal on-chain search

**Parameters:**
- `q` (query, required, string) — Address, token, block or tx Example: `USD`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/corn-api/v1/search?q=USD"
```

**Response:**
```json
{
    "data": {
        "count": 31,
        "query": "USD",
        "results": [
            {
                "name": "Bridged USDC (Corn)",
                "type": "token",
                "symbol": "USDC.e",
                "address": "0xDF0B24095e15044538866576754F3C964e902Ee6"
            },
            {
                "name": "USD₮0",
                "type": "token",
                "symbol": "USD₮0",
                "address": "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb"
            },
            {
                "name": "Avalon Avalon USDC",
                "type": "token",
                "symbol": "aCornUSDC",
                "address": "0x7Db9a5458432e810A2787B15f712Da1eCC3afe41"
            },
            {
                "name": "USDa",
                "type": "token",
                "symbol": "USDa",
                "address": "0xff12470a969Dd362EB6595FFB44C82c959Fe9ACc"
            },
            {
                "name": "Avalon Avalon Variable Debt USDC",
                "type": "token",
                "symbol": "variableDebtCornUSDC",
                "address": "0x052eF2323d022a2401dAEf88b68e563EfE8FE1fa"
            },
            {
                "name": "Smokehouse USDT0",
                "type": "token",
                "symbol": "bbqUSDT0",
                "address": "0x9b2fa89E23Ae84f7895A58f8ec7Cb0b267ED8a21"
            },
            {
                "name": "USDC/wBTCN",
                "type": "token",
                "symbol": "USDC
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Service metadata

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/corn-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "service": "corn-api",
        "endpoints": {
            "GET /v1/gas": "Gas oracle (slow/average/fast in gwei).",
            "GET /v1/meta": "This document.",
            "GET /v1/block": "Block detail by height= or hash=.",
            "GET /v1/stats": "Network stats (blocks, txns, coin price, market cap, gas).",
            "GET /v1/token": "ERC-20 token detail by contract (address=).",
            "GET /v1/blocks": "The most recent blocks.",
            "GET /v1/search": "Search addresses, tokens, blocks & txns (q=).",
            "GET /v1/address": "Address balance, ENS & contract info (address=).",
            "GET /v1/transaction": "Transaction detail (hash=)."
        },
        "description": "Live Corn on-chain data via Blockscout: network stats, a gas oracle (gwei), recent blocks and block detail, address balances with ENS, transaction detail, ERC-20 token detail and a universal search across addresses, tokens, blocks and transactions. Corn (Maizenet) is a Bitcoin-backed Ethereum L2; gas and balances are in BTCN. Real on-chain data, no key."
    },
    "meta": {
        "timestamp": "2026-06-08T09:51:23.939Z",
        "request_id": "d728d19a-9185-4046-8e5b-223e1f93ded1"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/corn-api
OpenAPI spec: https://www.oanor.com/api/corn-api/openapi.json
