<!-- tempo-docs-context -->
> Source: [/docs/api/json-rpc](https://tempo.xyz/developers/docs/api/json-rpc.md)
> Section: [API reference](https://tempo.xyz/developers/docs/api.md). Tempo API reference: authentication, conventions, endpoints grouped by product, Console management endpoints, JSON-RPC, and the indexer. An API key authenticates API requests; an account signing key authorizes transactions.
> [Documentation index](https://tempo.xyz/developers/llms.txt) · [Docs skill](https://tempo.xyz/developers/SKILL.md)

> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.xyz/developers/llms.txt) and Markdown pages directly.

<span id="json-rpc-api" />

# Tempo JSON-RPC API

The Tempo API exposes a **JSON-RPC entrypoint** for raw, node-level chain access alongside its REST and Indexer surfaces. Use it for [Ethereum-compatible JSON-RPC methods](https://ethereum.org/developers/docs/apis/json-rpc/) and Tempo-specific chain queries. Method availability depends on the endpoint; debug and administration methods may require your own node.

Point any Ethereum-compatible client at the hosted entrypoint, or [run your own node](https://tempo.xyz/developers/docs/guide/node/rpc):

| Chain | RPC URL |
|---------|---------|
| Mainnet | `https://api.tempo.xyz/rpc` |
| Testnet | `https://api.tempo.xyz/rpc/testnet` |

## Connect to Tempo JSON-RPC with tools

Use the Tempo JSON-RPC API with command-line tools, TypeScript clients, React hooks, or Rust providers.

### Cast

[Cast](https://www.getfoundry.sh/reference/cast/cast) is Foundry's command-line tool that includes tools to call JSON-RPC methods and inspect chain state from a terminal.

```bash [Terminal]
cast block-number --rpc-url https://api.tempo.xyz/rpc # [!code focus]
```

### Viem

[Viem](https://viem.sh/docs/clients/public) is a TypeScript client for Ethereum-compatible JSON-RPC APIs, useful for server-side scripts and app logic.

```ts [example.ts]
import { createClient, http } from 'viem/tempo'

const client = createClient({
  transport: http('https://api.tempo.xyz/rpc'), // [!code focus]
})

const blockNumber = await client.getBlockNumber() // [!code focus]
```

### Typed Client

The [Tempo API client](https://tempo.xyz/developers/docs/sdk/typescript/api-client) is Tempo's typed API client for TypeScript. Use it when you want one client for Tempo REST endpoints and the JSON-RPC passthrough, with typed route parameters, status narrowing, and Tempo API error envelopes.

```ts [example.ts]
import { Client } from 'tapimo'

const client = Client.create({ apiKey: process.env.TEMPO_API_KEY })

const response = await client.rpc[':chain{(mainnet|testnet|[0-9]+)}'].$post({
  param: { chain: 'testnet' }, // [!code focus]
  json: { jsonrpc: '2.0', id: 1, method: 'eth_blockNumber', params: [] }, // [!code focus]
})

const body = await response.json() // [!code focus]
```

### Wagmi

[Wagmi](https://wagmi.sh/react/api/createConfig) provides React hooks and configuration helpers on top of Viem clients.

:::code-group
```ts [wagmi.config.ts]
import { createConfig, http } from 'wagmi'
import { tempo } from 'viem/chains'

export const config = createConfig({
  chains: [tempo],
  transports: {
    [tempo.id]: http('https://api.tempo.xyz/rpc'), // [!code focus]
  },
})
```

```tsx [BlockNumber.tsx]
import { useBlockNumber } from 'wagmi'

export function BlockNumber() {
  const blockNumber = useBlockNumber() // [!code focus]
  return <span>{blockNumber.data?.toString()}</span> // [!code focus]
}
```
:::

### Rust

[Alloy](https://docs.rs/alloy-provider) is a Rust toolkit for Ethereum-compatible chains, including providers for JSON-RPC calls.

```rs [example.rs]
use alloy::providers::{Provider, ProviderBuilder};
use tempo_alloy::TempoNetwork;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let provider = ProviderBuilder::new_with_network::<TempoNetwork>()
        .connect("https://api.tempo.xyz/rpc") // [!code focus]
        .await?;

    let block_number = provider.get_block_number().await?; // [!code focus]
    println!("Latest block: {block_number}"); // [!code focus]

    Ok(())
}
```

## Tempo JSON-RPC endpoints

### RPC

* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#admin_validatorkey) — admin\_validatorKey
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#consensus_getfinalization) — consensus\_getFinalization
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#consensus_getidentitytransitionproof) — consensus\_getIdentityTransitionProof
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#consensus_getlatest) — consensus\_getLatest
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#consensus_subscribe) — consensus\_subscribe
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#consensus_unsubscribe) — consensus\_unsubscribe
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_blocknumber) — eth\_blockNumber
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_call) — eth\_call
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_chainid) — eth\_chainId
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_createaccesslist) — eth\_createAccessList
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_estimategas) — eth\_estimateGas
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_feehistory) — eth\_feeHistory
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_filltransaction) — eth\_fillTransaction
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_gasprice) — eth\_gasPrice
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getblockaccesslist) — eth\_getBlockAccessList
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getblockbyhash) — eth\_getBlockByHash
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getblockbynumber) — eth\_getBlockByNumber
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getblockreceipts) — eth\_getBlockReceipts
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getblocktransactioncountbyhash) — eth\_getBlockTransactionCountByHash
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getblocktransactioncountbynumber) — eth\_getBlockTransactionCountByNumber
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getcode) — eth\_getCode
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getfilterchanges) — eth\_getFilterChanges
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getfilterlogs) — eth\_getFilterLogs
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getlogs) — eth\_getLogs
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getproof) — eth\_getProof
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getstorageat) — eth\_getStorageAt
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_getstoragevalues) — eth\_getStorageValues
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_gettransactionbyblockhashandindex) — eth\_getTransactionByBlockHashAndIndex
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_gettransactionbyblocknumberandindex) — eth\_getTransactionByBlockNumberAndIndex
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_gettransactionbyhash) — eth\_getTransactionByHash
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_gettransactioncount) — eth\_getTransactionCount
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_gettransactionreceipt) — eth\_getTransactionReceipt
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_maxpriorityfeepergas) — eth\_maxPriorityFeePerGas
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_newblockfilter) — eth\_newBlockFilter
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_newfilter) — eth\_newFilter
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_newpendingtransactionfilter) — eth\_newPendingTransactionFilter
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_sendrawtransaction) — eth\_sendRawTransaction
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_sendrawtransactionsync) — eth\_sendRawTransactionSync
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_simulatev1) — eth\_simulateV1
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_syncing) — eth\_syncing
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#eth_uninstallfilter) — eth\_uninstallFilter
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#tempo_forkschedule) — tempo\_forkSchedule
* [`POST /rpc`](https://tempo.xyz/developers/docs/api/rpc#tempo_fundaddress) — tempo\_fundAddress
* [`POST /rpc/{chain}`](https://tempo.xyz/developers/docs/api/rpc#rpcrequestbychain) — Call chain JSON-RPC
