Skip to main content

getChainId

Callable


  • Type parameters

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The chain ID of the current connected node as described in the EIP-695.

    web3.eth.getChainId().then(console.log);
    > 61n

    web3.eth.getChainId({ number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
    > 61