Skip to main content

eth_chainId

Returns the current chain id.

Params

This method does not accept any parameters.

Result

Returns a Promise that resolves with a string that represents the current chain id.

Example

const chainId = await provider.request({ method: 'eth_chainId' });
console.log(chainId); // ['0xaa36a7']