Phantom Developer Documentation home pagelight logodark logo
  • Support
  • Download Phantom
  • Download Phantom
Getting Started
Mobile Deeplinks
Developer Tools and Resources
  • Support
  • GitHub
  • Community
  • Building with Phantom
    • Introduction
    https://mintlify.s3.us-west-1.amazonaws.com/phantom-e50e2e68/icons/solana.svg
    Solana
    • Get started with Solana
    • Detect the provider
    • Establish a connection
    • Send a legacy transaction
    • Send a versioned transaction
    • Sign a message
    • Error messages and codes
    https://mintlify.s3.us-west-1.amazonaws.com/phantom-e50e2e68/icons/ethereum.svg
    Ethereum, Monad, Base & Polygon
    • Get started with EVM networks
    • Detect the provider
    • Establish a connection
    • Send a transaction
    • Sign a message
    • Provider API Reference
      • Provider API reference
      • Properties
        • Properties
        • isPhantom
        • chainId
        • networkVersion
        • selectedAddress
        •  events
        •  eventsCount
      • Events
      • Methods
      • Error messages and codes
    https://mintlify.s3.us-west-1.amazonaws.com/phantom-e50e2e68/icons/sui.svg
    Sui
    • Get started with Sui
    • Detect the provider
    • Establish a connection
    • Send a transaction
    • Sign a message
    https://mintlify.s3.us-west-1.amazonaws.com/phantom-e50e2e68/icons/bitcoin.svg
    Bitcoin
    • Get started with Bitcoin
    • Detect the provider
    • Establish a connection
    • Send a transaction
    • Sign a message
    • Provider API reference
    Properties

    chainId

    ​
    window.phantom.ethereum.chainId

    The chainId of the network you are currently connected to, returned as a hexadecimal string.

    Copy
    Ask AI
    const chainId = window.phantom.ethereum.chainId;
    console.log(chainId);
    // "0x1"
    // hexidecimal representation of Ethereum Mainnet
    

    Was this page helpful?

    isPhantomnetworkVersion
    websitegithub
    Powered by Mintlify
    On this page
    • window.phantom.ethereum.chainId
    Assistant
    Responses are generated using AI and may contain mistakes.