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

> Monad API method that returns the chain ID of the current network. eth_chainId JSON-RPC method available on the Monad blockchain via Chainstack.

Monad API method that returns the chain ID of the current network. The chain ID is used for transaction signing to prevent replay attacks across different networks.

## Parameters

* `none`

## Response

* `result` — the current chain ID as a hexadecimal string:
  * Monad Mainnet: `0x8f` (143)
  * Monad Testnet: `0x279f` (10143)

## `eth_chainId` code examples

<CodeGroup>
  ```javascript ethers.js theme={"system"}
  const { ethers } = require("ethers");

  const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");

  async function getChainId() {
    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))
  chain_id = web3.eth.chain_id
  print(f'Chain ID: {chain_id}')
  ```
</CodeGroup>

## Use case

A practical use case for `eth_chainId` is verifying that your application is connected to the correct network before sending transactions, which is essential for preventing accidental transactions on the wrong network.


## OpenAPI

````yaml openapi/monad_node_api/chain_info/eth_chainId.json POST /
openapi: 3.0.0
info:
  title: Monad Node API
  version: 1.0.0
  description: This is an API for interacting with a Monad node.
servers:
  - url: https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800
security: []
paths:
  /:
    post:
      tags:
        - Chain info
      summary: eth_chainId
      operationId: eth_chainId
      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 chain ID.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: string

````