> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# eth_chainId | Tempo

> Tempo API method that returns the chain ID of the current network. The Tempo mainnet chain ID is 4217 (0x1079 in hexadecimal). On Tempo.

Tempo API method that returns the chain ID of the current network. The Tempo mainnet chain ID is `4217` (`0x1079` in hexadecimal). The Moderato testnet chain ID is `42431` (`0xa5bf`).

## Parameters

* `none`

## Response

* `result` — the chain ID encoded as hexadecimal (`0x1079` for Tempo mainnet / `0xa5bf` for Moderato testnet)

## `eth_chainId` code examples

<CodeGroup>
  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  const getChainId = async () => {
      const network = await provider.getNetwork();
      console.log(`Chain ID: ${network.chainId}`);
    };

  getChainId();
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3

  node_url = "CHAINSTACK_NODE_URL"

  web3 = Web3(Web3.HTTPProvider(node_url))
  print(web3.eth.chain_id)
  ```

  ```bash cURL theme={"system"}
  curl -X POST "CHAINSTACK_NODE_URL" \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id": 1}'
  ```
</CodeGroup>


## OpenAPI

````yaml openapi/tempo_node_api/chain_info/eth_chainId.json POST /
openapi: 3.0.0
info:
  title: eth_chainId Tempo example
  version: 1.0.0
  description: This is an API example for eth_chainId for Tempo.
servers:
  - url: https://tempo-mainnet.core.chainstack.com/c3ce2925b51f1ed18719fe8a23bbdccf
security: []
paths:
  /:
    post:
      tags:
        - Chain info
      summary: eth_chainId
      operationId: tempo-eth-chainId
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: eth_chainId
                params:
                  type: array
                  items: {}
                  default: []
                id:
                  type: integer
                  default: 1
      responses:
        '200':
          description: The chain ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: string
                    description: >-
                      The chain ID encoded as hexadecimal (0xa5bd for Tempo
                      testnet)

````