window.phantom.ethereum.chainId
ThechainId of the network you are currently connected to, returned as a hexadecimal string.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Read the chainId property to get the hex-encoded ID of the network Phantom is currently connected to.
chainId of the network you are currently connected to, returned as a hexadecimal string.
const chainId = window.phantom.ethereum.chainId;
console.log(chainId);
// "0x1"
// hexadecimal representation of Ethereum Mainnet
Was this page helpful?