eth_chainId
Returns the chain ID of the current network.
Params
(0)Result
(Chain ID)string
Match pattern:
^0x(0|[1-9a-f][0-9a-f]*)$
Example
Request
await window.ethereum.request({
"method": "eth_chainId",
"params": []
});
Result
"0x1"
Returns the chain ID of the current network.
await window.ethereum.request({
"method": "eth_chainId",
"params": []
});
"0x1"