> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://accounts.tempo.xyz/api/mcp` to find what you need.

# `eth_chainId`

Returns the chain ID of the currently active chain as a hex-encoded number. The active chain can be changed via [`wallet_switchEthereumChain`](/docs/rpc/wallet_switchEthereumChain).

## Request

```ts
type Request = {
  method: 'eth_chainId'
}
```

## Response

```ts
type Response = `0x${string}` // chain id (hex-encoded number)
```

## Example

```ts
const chainId = await provider.request({
  method: 'eth_chainId',
})
```
