> ## 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 | Cronos

> Cronos API method that returns the current chain ID. Chain ID is used to sign replay-protected transactions and verify whether a network is the desired one.

Cronos API method that returns the current chain ID. Chain ID is used to sign replay-protected transactions and verify whether a network is the desired one. It was introduced in [EIP-155](https://eips.ethereum.org/EIPS/eip-155).

## Parameters

* `none`

## Response

* `quantity` — EIP-155 Chain ID

> [!NOTE]
>
> Use the [Chainstack EVM Knife](https://web3tools.chainstacklabs.com/hexadecimal-decimal) to convert the Chain ID from Hexadecimal to Decimal.

## `eth_chainId` code examples

```javascript ethers.js theme={"system"}
const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);

const chainId = async () => {

    // This will return the value in Hex
    const chainId = await provider.send("eth_chainId");
    console.log(`Hex Chain ID: ${chainId}`);
  };

chainId();
```

```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)  
```

## Use case

One possible use case for the `eth_chainId` method is to determine which chain a user is connected to when using a DApp with the MetaMask browser extension. This can be useful to provide a customized user experience based on the specific chain that the user is interacting with.


## OpenAPI

````yaml openapi/cronos_node_api/eth_chainId.json POST /mt_c524ad9781ae5dccd9ac6f5b0370e
openapi: 3.0.0
info:
  title: Cronos Node API
  version: 1.0.0
  description: This is an API for interacting with a Cronos node.
servers:
  - url: https://cronos-mainnet.core.chainstack.com
security: []
paths:
  /mt_c524ad9781ae5dccd9ac6f5b0370e:
    post:
      tags:
        - Update
      summary: eth_chainId
      operationId: getChainId
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  default: 1
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: eth_chainId
                params:
                  type: array
                  default: []
      responses:
        '200':
          description: The network Chain ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: string

````