Skip to main content

getHashRate

Callable

  • getHashRate<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, returnFormat: ReturnFormat): Promise<NumberTypes[ReturnFormat[number]]>

  • Type parameters

    • ReturnFormat: DataFormat

    Parameters

    • web3Context: Web3Context<EthExecutionAPI, any>

      (Web3Context) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.

    • returnFormat: ReturnFormat

      (DataFormat defaults to DEFAULT_RETURN_FORMAT) Specifies how the return data should be formatted.

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The number of hashes per second that the node is mining with.

    web3.eth.getHashRate().then(console.log);
    > 493736n

    web3.eth.getHashRate({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log);
    > "0x788a8"