# Nervos CKB On-Chain API
> Live on-chain data from the Nervos Common Knowledge Base (CKB) via the official Nervos explorer — clean JSON, no cache. Nervos CKB is a proof-of-work Layer-1 built on the Cell model — a generalised UTXO where every cell can hold state and code — secured by the Eaglesong hash and governed in epochs, with a native state-rent / deposit system (NervosDAO) that pays interest for locking CKB. Read the chain state (tip block, current epoch, block time, difficulty and hashrate); browse the most recent blocks with miner and reward; fetch a single block by number or hash; look up an address's CKB balance, its NervosDAO deposit and compensation, live-cell count and UDT token accounts; or resolve a transaction's block, fee and type. Read live from Nervos, nothing stored. This is Nervos CKB's own Cell-model, NervosDAO and PoW layer — distinct from the Bitcoin, Decred, Ergo and other on-chain APIs and from price feeds.

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

## Pricing
- **Free** (Free) — 900 calls/Mo, 3 req/s
- **Starter** ($11/Mo) — 33,000 calls/Mo, 12 req/s
- **Pro** ($30/Mo) — 170,000 calls/Mo, 28 req/s
- **Business** ($69/Mo) — 850,000 calls/Mo, 55 req/s

## Endpoints

### Network

#### `GET /v1/network` — Chain state — tip block, epoch, block time, difficulty, hashrate

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

**Response:**
```json
{
    "data": {
        "chain": "nervos-ckb",
        "model": "Cell model (generalised UTXO)",
        "source": "Nervos CKB",
        "consensus": "Eaglesong PoW (NC-MAX)",
        "hash_rate": 81841176830210.33,
        "epoch_index": 298,
        "epoch_length": 1534,
        "epoch_number": 14356,
        "native_token": "CKB",
        "tip_block_number": 19562575,
        "average_block_time_ms": 7361.96,
        "estimated_epoch_time_ms": 14364832.725474,
        "transactions_last_24hrs": 16503,
        "transactions_per_minute": 12,
        "current_epoch_difficulty": "766385146820022311"
    },
    "meta": {
        "timestamp": "2026-06-10T22:58:24.385Z",
        "request_id": "e25c4371-8962-4ad4-9203-f3deb4aa27e5"
    },
    "status": "ok",
    "message": "Network state retrieved successfully",
    "success": true
}
```

### Blocks

#### `GET /v1/blocks` — Most recent blocks with miner and reward

**Parameters:**
- `limit` (query, optional, string) — Number of blocks (1-50) Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/nervos-api/v1/blocks?limit=10"
```

**Response:**
```json
{
    "data": {
        "count": 10,
        "blocks": [
            {
                "epoch": null,
                "miner": "ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0259kv0x5jez6h0l5qr52k64weapapgyscsnmhn",
                "number": 19562577,
                "timestamp": "2026-06-10T22:58:15.712Z",
                "block_hash": null,
                "difficulty": null,
                "reward_ckb": 625.10046258,
                "transactions_count": 1
            },
            {
                "epoch": null,
                "miner": "ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqvgqh40v2g5ps3rann79tvw9gq6ewrft7gp909qk",
                "number": 19562576,
                "timestamp": "2026-06-10T22:58:11.380Z",
                "block_hash": null,
                "difficulty": null,
                "reward_ckb": 625.10046258,
                "transactions_count": 4
            },
            {
                "epoch": null,
                "miner": "ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0259kv0x5jez6h0l5qr52k64weapapgyscsnmhn",
                "number": 19562575,
                "timestamp": "2026-06-10T22:58:09.393Z",
                "block_hash": null,
                "difficulty": null,
                "reward_ckb": 625.10046258,
                "transactions_count": 4
            },
            {
                "epoch": null,
                "miner": "ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0dn8gg6ag
…(truncated, see openapi.json for full schema)
```

### Block

#### `GET /v1/block` — A single block by number or hash

**Parameters:**
- `number` (query, optional, string) — Block number Example: `19559000`
- `hash` (query, optional, string) — Block hash (0x + 64 hex)

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

**Response:**
```json
{
    "data": {
        "epoch": 14353,
        "miner": "ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0tpsqq08mkay9ewrfrdwlcghv62qw704s93hhsj",
        "number": 19559000,
        "source": "Nervos CKB",
        "timestamp": "2026-06-10T14:11:17.272Z",
        "block_hash": "0x1325ea4ccae7b795c5bfab4fa69f2b77428c4a45cf98a4d22836e71e21406c03",
        "difficulty": "935293536651311521",
        "reward_ckb": 778.6228195,
        "transactions_count": 2
    },
    "meta": {
        "timestamp": "2026-06-10T22:58:25.048Z",
        "request_id": "89026ff8-7f65-4c2e-a05b-2965557d04fd"
    },
    "status": "ok",
    "message": "Block retrieved successfully",
    "success": true
}
```

### Address

#### `GET /v1/address` — An address's CKB balance, NervosDAO deposit, live cells and UDT accounts

**Parameters:**
- `address` (query, required, string) — Nervos address (mainnet ckb1...) Example: `ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0tpsqq08mkay9ewrfrdwlcghv62qw704s93hhsj`

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

**Response:**
```json
{
    "data": {
        "source": "Nervos CKB",
        "address": "ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0tpsqq08mkay9ewrfrdwlcghv62qw704s93hhsj",
        "balance_ckb": 67917951.75984755,
        "bitcoin_address": null,
        "dao_deposit_ckb": 0,
        "live_cells_count": 99904,
        "udt_account_count": 0,
        "mined_blocks_count": 3671803,
        "transactions_count": 3672740,
        "balance_occupied_ckb": 0,
        "dao_compensation_ckb": 0
    },
    "meta": {
        "timestamp": "2026-06-10T22:58:44.967Z",
        "request_id": "af400579-0fc5-45c7-9ffb-c8676d6c8a98"
    },
    "status": "ok",
    "message": "Address retrieved successfully",
    "success": true
}
```

### Transaction

#### `GET /v1/transaction` — A transaction's block, fee and type

**Parameters:**
- `hash` (query, required, string) — Transaction hash (0x + 64 hex) Example: `0x9fee19cb44afa5b083c6c74b4a549a2b50298be0d418625f50e884a09ba7b1f8`

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

**Response:**
```json
{
    "data": {
        "source": "Nervos CKB",
        "block_time": "2026-06-10T15:02:55.401Z",
        "income_ckb": null,
        "is_cellbase": false,
        "block_number": 19559410,
        "transaction_hash": "0x9fee19cb44afa5b083c6c74b4a549a2b50298be0d418625f50e884a09ba7b1f8",
        "transaction_fee_ckb": 0.05
    },
    "meta": {
        "timestamp": "2026-06-10T22:58:45.439Z",
        "request_id": "aa09ec53-ad05-4efc-9eb7-d953a883b908"
    },
    "status": "ok",
    "message": "Transaction retrieved successfully",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "model": "Cell model (generalised UTXO)",
        "source": "Nervos explorer API (mainnet-api.explorer.nervos.org, live)",
        "service": "nervos-api",
        "consensus": "Eaglesong PoW (NC-MAX)",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/block": "A single block by number or hash (number=19559000 or hash=0x…).",
            "GET /v1/blocks": "Most recent blocks with miner and reward (limit=10).",
            "GET /v1/address": "An address's CKB balance, NervosDAO deposit, live cells and UDT accounts (address=ckb1...).",
            "GET /v1/network": "Chain state — tip block, epoch, block time, difficulty, hashrate.",
            "GET /v1/transaction": "A transaction's block, fee and type (hash=0x + 64 hex)."
        },
        "description": "Live on-chain data from the Nervos Common Knowledge Base (CKB) via the official Nervos explorer API. Nervos CKB is a proof-of-work Layer-1 built on the Cell model — a generalised UTXO where every cell can hold state and code — secured by Eaglesong and governed in epochs, with a native state-rent/deposit system (NervosDAO) that pays interest for locking CKB. The network endpoint returns the chain state (tip block, epoch, block time, difficulty, hashrate); the blocks endpoint returns the most recent blocks with miner and reward; the block endpoint returns a single block by number or hash; the address endpoint returns an address's CKB balance, NervosDAO d
…(truncated, see openapi.json for full schema)
```


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