eth_subscribe - Arbitrum

This method allows developers to receive real-time notifications regarding new block headers on the Arbitrum blockchain; it sends notifications whenever a new block is added.

This method is only available through a WebSocket endpoint.

Parameters

FieldTypeRequiredDescription
subscription namestringYesThe type of event to subscribe to (e.g., newHeads, logs, newPendingTransactions, syncing).

Request

Note that subscriptions require a WebSocket connection and WebSocket cat for you to use this method in the console.Install WebSocket cat with:npm install -g wscat

bash$ wscat -c wss://shared.us-east-1.getblock.io/<ACCESS_TOKEN>
# Wait for the connection to be established

Connected (press CTRL+C to quit)

> {"id":1,"jsonrpc":"2.0","method":"eth_subscribe","params":["newHeads"]}
javascriptimport WebSocket from ('ws');

const webSocket = new WebSocket('wss://shared.us-east-1.getblock.io/<ACCESS_TOKEN>');

async function subscribeToNewBlocks() {

  const request = {
    id: 1,
    jsonrpc: '2.0',
    method: 'eth_subscribe',
    params: ['newHeads'],
  };

  const onOpen = (event) => {
    webSocket.send(JSON.stringify(request));
  };

  const onMessage = (event) => {
    const response = JSON.parse(event.data);
    console.log(response);
  };

  try {
    webSocket.addEventListener('open', onOpen);
    webSocket.addEventListener('message', onMessage);
  } catch (error) {
    console.error(error);
  }
}

subscribeToNewBlocks();

Response

java{
  "jsonrpc": "2.0",
  "id": "1",
  "result": "0x9c7c3f3c3c63b1b89ac0c1e0b0d3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8090a1b"
}

Reponse Parameter Definition

Field NameData TypeDescription
subscriptionstringThe subscription ID
objectobjectA block object containing the following fields:
object.numberstring or nullThe block number of the requested block, encoded as hexadecimal. null if the block is pending
object.hashstring or nullThe block hash of the requested block. null if the block is pending
object.parenthashstringHash of the previous block used to generate the current block. Also known as the 'parent block'
object.noncestring or nullThe hash used to demonstrate proof-of-work. null if the block is pending. Returns 0x0000000000000000 when the consensus is proof-of-stake
object.sha3unclesstringThe hash of the list of uncles included in the block. Used to identify the block uniquely and to verify the integrity of the block's data
object.logsbloomstring or nullThe bloom filter for the logs of the block, a data structure that allows for efficient membership testing of elements in a set (the logs included in the block). null if pending
object.transactionsrootstringThe root of the transaction trie of the block. Allows Arbitrum nodes to verify the integrity of the transactions in a block
object.staterootstringThe root of the final state trie of the block. Included in the block header and used to verify the integrity of the state at the time the block was processed
object.receiptsrootstringThe root of the receipts trie of the block. A 32-byte hash of the root node of the receipts trie of all transactions in the block. Used to verify the integrity of the receipts data for all transactions
object.minerstringThe address of the miner receiving the reward
object.difficultystringA measure of how hard it is to find a valid block for the Arbitrum blockchain. A number that increases as more miners join the network and more blocks are added to the chain, encoded as hexadecimal
object.totaldifficultystringThe cumulative sum of the difficulty of all blocks that have been mined in the Arbitrum network since the inception of the network. Measures the overall security and integrity of the Arbitrum network
object.extradatastringExtra data included in a block by the miner who mined it. Often includes messages or other information related to the block
object.sizestringThe size of this block in bytes as an integer value, encoded as hexadecimal
object.gaslimitstringThe maximum gas allowed in this block, encoded as hexadecimal
object.gasusedstringThe total used gas by all transactions in this block, encoded as hexadecimal
object.timestampstringThe Unix timestamp for when the block was collated
object.transactionsarrayAn array of transaction objects. See eth_getTransactionByHash for the exact shape
object.unclesarrayAn array of uncle hashes

Use case

The eth_subscribe method helps developers to:

  • Build real-time dashboards that stream block and transaction activity.
  • Monitor contract events instantly without polling.
  • Detect pending transactions for mempool analytics, wallets, and trading bots.
  • Track node sync progress for DevOps use cases.
  • Receive event-based updates for DeFi protocols, NFT marketplaces, or governance systems

Error handling

Status CodeError MessageCause
403ForbiddenMissing or invalid ACCESS_TOKEN.
-32601notification not supported

Integration with Web3

The eth_subscribe method helps developers to:

  • Build real-time dashboards that stream block and transaction activity.
  • Monitor contract events instantly without polling.
  • Detect pending transactions for mempool analytics, wallets, and trading bots.
  • Track node sync progress for DevOps use cases.
  • Receive event-based updates for DeFi protocols, NFT marketplaces, or governance systems.