# Towns API
> Live EVM on-chain data for Towns (chain id 550) — an OP-Stack Layer-2 that powers decentralised group chat and on-chain social spaces, with gas paid in ETH — served directly from the public Towns JSON-RPC with server-side resilience. The status endpoint returns the chain and network id, the latest block height and the node client version. The block endpoint returns a block by number (or the latest) with its hash, parent hash, timestamp, transaction count, gas used and gas limit, miner and size. The gas endpoint returns the current gas price in both wei and gwei. The balance endpoint returns the ETH balance and outgoing transaction count for any address, converted from base wei (18 decimals) into whole ETH with exact big-integer scaling. Every figure is read live from the chain over JSON-RPC — nothing bundled or modelled — behind a short server-side cache with keep-warm so the feed stays fast and fresh. Ideal for explorers, wallet and dashboard tooling, gas trackers, address monitors and analytics apps across the Towns social ecosystem. Live keyless upstream. 5 endpoints.

## 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/towns-api/..."
```

## Pricing
- **Free** (Free) — 330 calls/Mo, 2 req/s
- **Starter** ($13/Mo) — 15,700 calls/Mo, 8 req/s
- **Pro** ($36/Mo) — 84,000 calls/Mo, 16 req/s
- **Mega** ($85/Mo) — 330,000 calls/Mo, 40 req/s

## Endpoints

### Towns

#### `GET /v1/balance` — Address balance & tx count

**Parameters:**
- `address` (query, optional, string) — EVM address (0x + 40 hex) Example: `0x000000000000000000000000000000000000dEaD`

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

**Response:**
```json
{
    "data": {
        "chain": "Towns",
        "symbol": "ETH",
        "address": "0x000000000000000000000000000000000000dEaD",
        "balance": 0,
        "tx_count": 0,
        "balance_wei": "0"
    },
    "meta": {
        "timestamp": "2026-06-15T20:40:12.022Z",
        "request_id": "4e2f191f-601c-4778-b8c6-6bb23e0819a2"
    },
    "status": "ok",
    "message": "Towns balance retrieved",
    "success": true
}
```

#### `GET /v1/block` — Block by number (or latest)

**Parameters:**
- `number` (query, optional, string) — Block number; omit for latest Example: `5000000`

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

**Response:**
```json
{
    "data": {
        "hash": "0x59e3f80952b9326cd20b316a17350e4074f37e040eef6936ca8f1ddd95fbc058",
        "chain": "Towns",
        "miner": "0x4200000000000000000000000000000000000011",
        "number": 5000000,
        "gas_used": 43779,
        "tx_count": 1,
        "gas_limit": 30000000,
        "timestamp": 1726138071,
        "size_bytes": 839,
        "parent_hash": "0x12c4072d3325c82c4dbc3769403dd26a6151bc567c53c0c48878ade4120edb80",
        "timestamp_iso": "2024-09-12T10:47:51.000Z"
    },
    "meta": {
        "timestamp": "2026-06-15T20:40:12.306Z",
        "request_id": "3ae12d97-0e21-4b8c-98b5-b35748f73286"
    },
    "status": "ok",
    "message": "Towns block retrieved",
    "success": true
}
```

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

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

**Response:**
```json
{
    "data": {
        "chain": "Towns",
        "source": "eth_gasPrice",
        "symbol": "ETH",
        "gas_price_wei": 1000252,
        "gas_price_gwei": 0.001000252
    },
    "meta": {
        "timestamp": "2026-06-15T20:40:12.581Z",
        "request_id": "774bfa9e-c3a3-4985-b90e-52c41809112e"
    },
    "status": "ok",
    "message": "Towns gas retrieved",
    "success": true
}
```

#### `GET /v1/status` — Chain status

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

**Response:**
```json
{
    "data": {
        "chain": "Towns",
        "source": "Towns L2 RPC",
        "symbol": "ETH",
        "chain_id": 550,
        "network_id": 550,
        "latest_block": 32708970,
        "client_version": "reth/v2.2.0-7680d6d/x86_64-unknown-linux-gnu"
    },
    "meta": {
        "timestamp": "2026-06-15T20:40:13.240Z",
        "request_id": "e7e23906-e20e-4fe4-b0fb-cbf87aca8271"
    },
    "status": "ok",
    "message": "Towns status retrieved",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

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

**Response:**
```json
{
    "data": {
        "api": "Towns API",
        "chain": "Towns",
        "source": "Towns L2 JSON-RPC nodes",
        "symbol": "ETH",
        "chain_id": 550,
        "endpoints": [
            "/v1/status",
            "/v1/block",
            "/v1/gas",
            "/v1/balance",
            "/v1/meta"
        ],
        "description": "Live EVM on-chain data for Towns — an OP-Stack Layer-2 powering decentralised group chat and social spaces, gas paid in ETH.",
        "documentation": "https://towns-api.oanor.dev"
    },
    "meta": {
        "timestamp": "2026-06-15T20:40:13.315Z",
        "request_id": "3c001f5c-1593-4d16-a68c-8ba329c8247f"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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