# 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"
```

### 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"
```

### 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"
```

### 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"
```

### 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"
```

### Meta

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

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


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