Join AWS, Dust Labs & OrangeDAO at QuickPitch. Win $80k — Apply Today.

Contents

eth-v1-events REST API Endpoint

It provides endpoint to subscribe to beacon node Server-Sent-Events stream. The consumers should use eventsource implementation to listen on those events. The servers may send SSE comments beginning with : for any purpose, including to keep the event stream connection alive in the presence of proxy servers.

Parameters:

  1. topics - array[string] - The event types to subscribe to. The available values: head, block, attestation, voluntary_exit, finalized_checkpoint, chain_reorg, contribution_and_proof.

Returns:

  1. data - The object with the following values:

    slot - string - The corresponding slot

    block - string - The information about the specified block

    state - string - The activation state

    current_duty_dependent_root - string - The current duty dependent root

    previous_duty_dependent_root - string - The previous duty dependent root

    epoch_transition - boolean - The epoch transition

    execution_optimistic - boolean - It's true if the response references an unverified execution payload. The optimistic information may be invalidated at a later time. If the field is not present, assume the false value

Code Examples:

require "uri"
require "net/http"

url = URI("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/eth/v1/events?topics=head")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["accept"] = "text/event-stream"

response = https.request(request)
puts response.read_body
Ready to get started? Create a free account