monadNewHeads

Fires a notification each time as soon as a block is Proposed and the node has a chance to speculatively execute.

The monadNewHeads is the same as the newHeads subscription type, but the notification emits as soon as the block is Proposed and the node has a chance to speculatively execute.

Supported Networks

Check the Chains page for details about product and chain support!

Parameters

  • None

Response

A monadNewHeads update looks the same as a newHeads update except that it contains the additional blockId and commitState fields:

  • result

    • blockId: DATA, 32 Bytes - The unique identifier of the block. Example: “0x71ce47f39a1eb490354166f762d78bf6e2acaf80b24b4bcd756118d93ef81be0”
    • commitState: string - The current state of the block. Example: “Proposed”
    • number: QUANTITY - The block number. Null when it’s a pending block.
    • parentHash: DATA, 32 Bytes - Hash of the parent block.
    • nonce: DATA, 8 Bytes - Hash of the generated proof-of-work. Null when it’s a pending block.
    • sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.
    • logsBloom: DATA, 256 Bytes - The bloom filter for the logs of the block. Null when it’s a pending block.
    • transactionsRoot: DATA, 32 Bytes - The root of the transaction trie of the block.
    • stateRoot: DATA, 32 Bytes - The root of the final state trie of the block.
    • receiptsRoot: DATA, 32 Bytes - The root of the receipts trie of the block.
    • miner: DATA, 20 Bytes - The address of the beneficiary to whom the mining rewards were given.
    • difficulty: QUANTITY - Integer of the difficulty for this block.
    • extraData: DATA - The “extra data” field of this block.
    • gasLimit: QUANTITY - The maximum gas allowed in this block.
    • gasUsed: QUANTITY - The total used gas by all transactions in this block.
    • timestamp: QUANTITY - The Unix timestamp for when the block was collated.
  • subscription: string - Subscription ID

Request

$// initiate websocket stream first
>wscat -c wss://eth-mainnet.g.alchemy.com/v2/demo
>
>// then call subscription
>{"jsonrpc":"2.0","id": 1, "method": "eth_subscribe", "params": ["monadNewHeads"]}

Result

result
1{"jsonrpc":"2.0", "id":1, "result":"0x9ce59a13059e417087c02d3236a0b1cc"}
2
3{
4 "jsonrpc": "2.0",
5 "method": "eth_subscription",
6 "params": {
7 "result": {
8 "difficulty": "0x15d9223a23aa",
9 "extraData": "0xd983010305844765746887676f312e342e328777696e646f7773",
10 "gasLimit": "0x47e7c4",
11 "gasUsed": "0x38658",
12 "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
13 "miner": "0xf8b483dba2c3b7176a3da549ad41a48bb3121069",
14 "nonce": "0x084149998194cc5f",
15 "number": "0x1348c9",
16 "parentHash": "0x7736fab79e05dc611604d22470dadad26f56fe494421b5b333de816ce1f25701",
17 "receiptRoot": "0x2fab35823ad00c7bb388595cb46652fe7886e00660a01e867824d3dceb1c8d36",
18 "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
19 "stateRoot": "0xb3346685172db67de536d8765c43c31009d0eb3bd9c501c9be3229203f15f378",
20 "timestamp": "0x56ffeff8",
21 "transactionsRoot": "0x0167ffa60e3ebc0b080cdb95f7c0087dd6c0e61413140e39d94d3468d7c9689f"
22 },
23 "subscription": "0x9ce59a13059e417087c02d3236a0b1cc"
24 }
25 }