POST
/
events
/
blocks
[INDEXER] Get a range of BlockEvents
curl --request POST \
  --url https://example.com/events/blocks \
  --header 'Content-Type: application/json' \
  --data '{
  "network_identifier": {
    "blockchain": "bitcoin",
    "network": "mainnet",
    "sub_network_identifier": {
      "network": "shard 1",
      "metadata": {
        "producer": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"
      }
    }
  },
  "offset": 5,
  "limit": 5
}'
{
  "max_sequence": 5,
  "events": [
    {
      "sequence": 5,
      "block_identifier": {
        "index": 1123941,
        "hash": "0x1f2cc6c5027d2f201a5453ad1119574d2aed23a392654742ac3c78783c071f85"
      },
      "type": "block_added"
    }
  ]
}

Body

application/json

EventsBlocksRequest is utilized to fetch a sequence of BlockEvents indicating which blocks were added and removed from storage to reach the current state.

network_identifier
object
required

The network_identifier specifies which network a particular object is associated with.

offset
integer

offset is the offset into the event stream to sync events from. If this field is not populated, we return the limit events backwards from tip. If this is set to 0, we start from the beginning.

Required range: x >= 0
Example:

5

limit
integer

limit is the maximum number of events to fetch in one call. The implementation may return <= limit events.

Required range: x >= 0
Example:

5

Response

Expected response to a valid request

EventsBlocksResponse contains an ordered collection of BlockEvents and the max retrievable sequence.

max_sequence
integer
required

max_sequence is the maximum available sequence number to fetch.

Required range: x >= 0
Example:

5

events
object[]
required

events is an array of BlockEvents indicating the order to add and remove blocks to maintain a canonical view of blockchain state. Lightweight clients can use this event stream to update state without implementing their own block syncing logic.