EthereumMethods

eth_subscribe

The eth_subscribe('newHeads') method allows developers to receive real-time notifications regarding new block headers on the Ethereum blockchain. This method sends notifications whenever a new bloc...

eth_subscribe

Overview

The 'eth_subscribe("newHeads")' method allows developers to receive real-time notifications regarding new block headers on the Ethereum blockchain. This method sends notifications whenever a new block is added to the chain.

Request

{
  "method": "eth_subscribe",
  "params": ["newHeads"]
}

Request Parameters

  • method: The API method to call. For this endpoint, it should be "eth_subscribe".
  • params: An array containing the type of event to subscribe to. In this case, it should be "newHeads".

Response

{
  "subscription": "subscription ID",
  "result": {
    "number": "block number",
    "hash": "block hash",
    "parenthash": "hash of the previous block",
    "nonce": "proof-of-work hash",
    "sha3uncles": "hash of the list of uncles",
    "logsbloom": "bloom filter for the logs",
    "transactionsroot": "root of the transaction trie",
    "stateroot": "root of the final state trie",
    "receiptsroot": "root of the receipts trie",
    "miner": "address of the miner",
    "difficulty": "difficulty measure",
    "totaldifficulty": "cumulative difficulty",
    "extradata": "extra data",
    "size": "block size",
    "gaslimit": "maximum gas allowed",
    "gasused": "total used gas",
    "timestamp": "Unix timestamp",
    "transactions": "array of transaction objects",
    "uncles": "array of uncle hashes"
  }
}
Service StatusGitHub SDK