Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

eth_chainId

Get the current chain ID in hexadecimal format.

Authentication Required: No (returns default chain if not authenticated)

Request

await jaw.provider.request({
  method: 'eth_chainId',
});

Parameters

None

Response

Returns the chain ID as a hexadecimal string.

Type: 0x${string}

Example

"0x1"

Behavior

  • Returns default chain ID if not authenticated
  • Returns current active chain ID if authenticated
  • Updates when chain is switched via wallet_switchEthereumChain

Example Usage

import { JAW } from '@jaw.id/core';
 
const jaw = JAW.create({
  apiKey: 'your-api-key',
});
 
const chainId = await jaw.provider.request({
  method: 'eth_chainId',
});

Related Methods