Skip to main content

Subscribe

Request Body

ParameterTypeDescription
method*stringMust be "subscribe"
subscription*objectSee below
subscription.type*stringMust be "newBlocks"
Note: No user parameter required for global subscriptions.

Response

Subscription Confirmation:
{
  "channel": "subscriptionResponse",
  "data": {
    "method": "subscribe",
    "subscription": {
      "type": "newBlocks"
    }
  }
}
Block Notification:
{
  "channel": "newBlocks",
  "data": {
    "blockNumber": 12345,
    "timestamp": 1701234567890,
    "transactionCount": 15,
    "blockHash": "0x1234..."
  }
}

Block Fields

FieldTypeDescription
blockNumbernumberSequential block number
timestampnumberBlock creation time in milliseconds
transactionCountnumberNumber of transactions in block
blockHashstringUnique block hash

Unsubscribe

{
  "method": "unsubscribe",
  "subscription": {
    "type": "newBlocks"
  }
}

Notes

  • Global subscription - no user address required
  • Blocks sent in real-time as they are created
  • Useful for monitoring blockchain progress and transaction confirmations