# Using BlockVectra on Base

> Original page: https://docs.blockvectra.com/en/guides/base/

BlockVectra provides JSON-RPC access for Base mainnet through unified API endpoints.

## Network information and endpoints

Every request to Base identifies its target network explicitly in the URL path using the slug `base_mainnet`. JSON-RPC supports both path-based key authentication and request header authentication (`x-api-key`).

The parameters and endpoints below reflect active network data:

| Parameter / Endpoint | Value / Template | Authentication |
|---|---|---|
| Chain ID (EIP-155) | `8453` | Unauthenticated (public) |
| JSON-RPC (path key) | `POST https://api.blockvectra.com/v1/base_mainnet/{api_key}` | API key in URL path |
| JSON-RPC (header key) | `POST https://api.blockvectra.com/v1/base_mainnet` | Header x-api-key: {api_key} |
| Data API base | `GET https://api.blockvectra.com/v1/data/base_mainnet/…` | Header x-api-key: {api_key} |
| Public status | `GET https://api.blockvectra.com/v1/status` | Unauthenticated (public) |

## Direct curl and viem examples

You can make JSON-RPC calls directly using curl or web3 client libraries such as viem. Set your API key in the `BLOCKVECTRA_API_KEY` environment variable:

**curl (Header)**

Query the EIP-155 chain ID using the `x-api-key` request header:

```bash
curl -s "https://api.blockvectra.com/v1/base_mainnet" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $BLOCKVECTRA_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
```


  **curl (Path)**

Query the latest block number by passing your API key in the URL path:

```bash
curl -s "https://api.blockvectra.com/v1/base_mainnet/$BLOCKVECTRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'
```


  **TypeScript (viem)**

Connect using viem's `createPublicClient` and the official `base` chain definition:

```ts
import { createPublicClient, http } from "viem";
import { base } from "viem/chains";

const client = createPublicClient({
  chain: base,
  transport: http("https://api.blockvectra.com/v1/base_mainnet", {
    fetchOptions: {
      headers: {
        "x-api-key": process.env.BLOCKVECTRA_API_KEY!,
      },
    },
  }),
});

const blockNumber = await client.getBlockNumber();
console.log("Current block number on Base:", blockNumber);
```

You can also pass the key in the transport URL path:

```ts
const client = createPublicClient({
  chain: base,
  transport: http(`https://api.blockvectra.com/v1/base_mainnet/${process.env.BLOCKVECTRA_API_KEY}`),
});
```


### Response structure

Responses adhere to the JSON-RPC 2.0 specification:

* **Success**: Returns an object containing `jsonrpc: "2.0"`, matching integer `id`, and hexadecimal-encoded `result` (`eth_chainId` returns the hex-encoded chain ID; `eth_blockNumber` returns the latest block height).
* **Disallowed methods**: Requesting a method outside the network's allowed methods returns JSON-RPC error code `-32601` (`method not available`, not billed).
* **Out-of-window queries**: Historical state requests earlier than the state retention window return JSON-RPC error code `-32011` (not billed).
* **Missing API key**: Omitting the key returns HTTP 401 with JSON-RPC error code `-32024` (`missing_api_key`, not billed).
* **Invalid parameters**: Malformed request parameters return JSON-RPC error code `-32602` (not billed).

## Capability and method policy

Available JSON-RPC methods, log block range limits, and historical state retention on Base are published dynamically via `GET /v1/chains`.

### Network parameters and limits

- **eth_getLogs block range**: Max 1000 blocks per request
- **Historical state window**: Recent 10000 blocks (queries beyond return -32011)
- **Execution tracing (debug_trace*)**: Not available

### Allowed methods (methods.allow)

- `eth_blockNumber`
- `eth_chainId`
- `eth_gasPrice`
- `eth_maxPriorityFeePerGas`
- `eth_blobBaseFee`
- `eth_feeHistory`
- `eth_syncing`
- `eth_getBalance`
- `eth_getCode`
- `eth_getStorageAt`
- `eth_getTransactionCount`
- `eth_call`
- `eth_estimateGas`
- `eth_createAccessList`
- `eth_getProof`
- `eth_simulateV1`
- `eth_getBlockByNumber`
- `eth_getBlockByHash`
- `eth_getBlockReceipts`
- `eth_getBlockTransactionCountByNumber`
- `eth_getBlockTransactionCountByHash`
- `eth_getTransactionByHash`
- `eth_getTransactionReceipt`
- `eth_getTransactionByBlockNumberAndIndex`
- `eth_getTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByHash`
- `eth_getRawTransactionByBlockHashAndIndex`
- `eth_getRawTransactionByBlockNumberAndIndex`
- `eth_getLogs`
- `eth_getUncleCountByBlockNumber`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleByBlockNumberAndIndex`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getHeaderByNumber`
- `eth_getHeaderByHash`
- `eth_sendRawTransaction`
- `net_version`
- `web3_clientVersion`
- `web3_sha3`

### Blocked methods (methods.deny)

- `eth_newFilter`
- `eth_newBlockFilter`
- `eth_newPendingTransactionFilter`
- `eth_getFilterLogs`
- `eth_getFilterChanges`
- `eth_uninstallFilter`
- `eth_subscribe`
- `eth_unsubscribe`

## Blockchain Data API

Availability of the Data API is governed dynamically by the `data` field published in `GET /v1/chains`.

### Blockchain Data API status

- **Available**: Blockchain Data API is available on Base. Browse supported datasets in the datasets directory. [Browse datasets directory](https://blockvectra.com/en/data/)

## Getting started and API keys

New accounts get 30,000,000 CU on sign-up — no credit card.

* **Web console**: Sign up via Ethereum wallet signature or email, and generate an API key in the [Console](https://console.blockvectra.com/en/login/?next=%2Fen%2Fkeys%2F). See the [Quickstart guide](https://docs.blockvectra.com/en/quickstart/) for setup details.
* **Programmatic sign-up**: Autonomous AI agents, automated scripts, and CI pipelines can sign in and provision API keys using Ethereum wallet signatures (EIP-191) without a browser. Follow the [Programmatic sign-up guide](https://docs.blockvectra.com/en/guides/programmatic-signup/).
* **AI agents**: Autonomous AI agents can discover Base capabilities and create API keys automatically using the official Model Context Protocol (MCP) server. See [Connecting AI Agents to BlockVectra](https://docs.blockvectra.com/en/guides/ai-agents/).
* **Upgrading limits**: After topping up, the account-wide calls-per-second limit is removed; each key remains subject to Compute Unit (CU) rate and burst limits. For current rates and billing units, see the [Pricing page](https://blockvectra.com/en/pricing/).

## Related guides and resources

* **Base developer documentation**: For network specifications, gas mechanics, and contracts on Base, see the official [Base documentation](https://docs.base.org).
* **Wallet custom RPC**: Configure custom RPC endpoints for Base in MetaMask and Rabby using the [Wallet Custom RPC guide](https://docs.blockvectra.com/en/guides/wallet-custom-rpc/).
* **Transaction simulation**: Test transaction execution and evaluate state changes before broadcasting using `eth_simulateV1` in the [Simulate Transactions guide](https://docs.blockvectra.com/en/guides/simulate-transactions/).
* **Pricing and Compute Units**: See how methods are weighted and metered on the [Pricing page](https://blockvectra.com/en/pricing/).

## Next steps

* [Browse the datasets directory](https://blockvectra.com/en/data/) to see every dataset BlockVectra indexes.
* [See the free plan and pricing](https://blockvectra.com/en/pricing/#free) to check what your account includes.
* [Log in to the console](https://console.blockvectra.com/en/login/?next=%2Fen%2Fkeys%2F) to create an API key.
