# Bitlayer API
> Real-time on-chain data for Bitlayer (chain-id 200901) — the Bitcoin Layer-2 built on the BitVM paradigm, EVM-compatible and secured by Bitcoin, using BTC as its native gas token. Query live network status (latest block height, network id, client version), fetch any block by height or the latest one (timestamp, transaction count, gas used / limit, base fee, miner), read the current gas price in wei and gwei, and look up the native BTC balance and transaction count of any address. A keyless, no-account JSON wrapper over the canonical Bitlayer JSON-RPC node — decoded from hex into plain decimals and human-readable BTC so you do not have to. Ideal for explorers, wallets, dashboards, gas estimators and analytics on the Bitlayer Bitcoin L2.

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

## Pricing
- **Free** (Free) — 4,200 calls/Mo, 3 req/s
- **Basic** ($14/Mo) — 59,000 calls/Mo, 10 req/s
- **Pro** ($36/Mo) — 222,000 calls/Mo, 25 req/s
- **Mega** ($78/Mo) — 905,000 calls/Mo, 60 req/s

## Endpoints

### Network

#### `GET /v1/status` — Network status (latest block, chain id, client version)

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

**Response:**
```json
{
    "data": {
        "chain": "Bitlayer",
        "chain_id": 200901,
        "network_id": 200901,
        "rpc_healthy": true,
        "latest_block": 23081569,
        "native_symbol": "BTC",
        "client_version": "Geth/v1.1.10-stable-842b00a4/linux-amd64/go1.21.13"
    },
    "meta": {
        "timestamp": "2026-06-15T11:14:37.893Z",
        "request_id": "f66cfd40-6b9a-4449-8578-7378d771bc65"
    },
    "status": "ok",
    "message": "Chain status retrieved successfully",
    "success": true
}
```

### Blocks

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

**Parameters:**
- `number` (query, optional, string) — Block height (decimal or 0x-hex), or "latest" Example: `10000000`

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

**Response:**
```json
{
    "data": {
        "hash": "0xfd27f19d136513343b2a6b3337d62eade1fb643f0688ffbefd9e9eb2226741eb",
        "miner": "0x56cb8f58ead1c8d5066235e17223a49dc2dc471d",
        "number": 10000000,
        "gas_used": 147000,
        "gas_limit": 40000000,
        "timestamp": 1742276634,
        "size_bytes": 1884,
        "parent_hash": "0x34e1f9a4d47db0a2b50f52c7dd06ce8e7a35d282887b9f323cf56228a504170e",
        "timestamp_iso": "2025-03-18T05:43:54.000Z",
        "transaction_count": 7,
        "base_fee_per_gas_wei": "7"
    },
    "meta": {
        "timestamp": "2026-06-15T11:14:38.163Z",
        "request_id": "3aa92c0f-c107-4fde-9e18-b16579cb7768"
    },
    "status": "ok",
    "message": "Block retrieved successfully",
    "success": true
}
```

### Gas

#### `GET /v1/gas` — Current gas price (wei + gwei)

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

**Response:**
```json
{
    "data": {
        "at_block": 23081570,
        "gas_price_wei": "25000007",
        "native_symbol": "BTC",
        "gas_price_gwei": 0.025
    },
    "meta": {
        "timestamp": "2026-06-15T11:14:38.545Z",
        "request_id": "280f31f5-69df-4d4c-a25a-1810ee1412e6"
    },
    "status": "ok",
    "message": "Gas price retrieved successfully",
    "success": true
}
```

### Accounts

#### `GET /v1/balance` — Native BTC balance and transaction count of an address

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

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

**Response:**
```json
{
    "data": {
        "address": "0x000000000000000000000000000000000000dEaD",
        "balance": "0.000008229936831915",
        "balance_wei": "8229936831915",
        "native_symbol": "BTC",
        "transaction_count": 0
    },
    "meta": {
        "timestamp": "2026-06-15T11:14:38.904Z",
        "request_id": "93791267-e5b0-4137-95f8-67da04f6b1ef"
    },
    "status": "ok",
    "message": "Balance retrieved successfully",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "type": "Bitcoin Layer-2 (BitVM-based, EVM-compatible)",
        "chain": "Bitlayer",
        "network": "mainnet",
        "chain_id": 200901,
        "decimals": 18,
        "ecosystem": "Bitlayer — Bitcoin-secured EVM rollup, native gas token BTC",
        "endpoints": [
            "/v1/status",
            "/v1/block",
            "/v1/gas",
            "/v1/balance",
            "/v1/meta"
        ],
        "description": "Bitlayer is a Bitcoin Layer-2 network built on the BitVM paradigm, EVM-compatible and secured by Bitcoin, using BTC as its native gas token.",
        "documentation": "https://bitlayer-api.oanor.dev",
        "native_symbol": "BTC"
    },
    "meta": {
        "timestamp": "2026-06-15T11:14:38.977Z",
        "request_id": "b337f4e8-6f51-45cf-b99d-f5c0679f902e"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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