> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscribe to events

> Subscribe to the Beacon Chain events and receive a stream of the following data: Event type (event: head): This specifies the type of event being streamed.

<Note>
  **This method will not work in the interactive section as it receives a continuous stream of data.**

  You can test it using Postman:

  ## Instructions:

  1. Click **Run in Postman**.\
     [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/20722034-74bcf624-cd2a-47ff-b790-ec3e25c138fa?action=collection%2Ffork\&collection-url=entityId%3D20722034-74bcf624-cd2a-47ff-b790-ec3e25c138fa%26entityType%3Dcollection%26workspaceId%3Df1ba12a1-51de-4de6-8a9e-97b26ce685e0)
  2. Click **Fork collection** and follow the steps to set it up in your environment.
  3. Select **Get Beacon Chain events**.
  4. After the collection is set up, click **Send**.
</Note>

Subscribe to the Beacon Chain events and receive a stream of the following data:

* **Event type** (event: `head`): This specifies the type of event being streamed. In this case, it's a head event, which relates to the latest confirmed block on the Beacon Chain.
* **Data fields**:
  * `slot`: The slot number at which this block was proposed. Slots are time periods during which a block can be proposed.
  * `block`: The hash of the block that has been accepted as the head of the chain.
  * `state`: The state root of the Ethereum network after processing this block.
  * `epoch_transition`: A boolean indicating whether or not this block involved a transition between epochs.
  * `previous_duty_dependent_root` and `current_duty_dependent_root`: These roots help in understanding the duties thatvalidators need to perform, which may vary from one epoch to another.
  * `execution_optimistic`: A boolean indicating the execution mode. If false, it means the block is fully validated; if true, it implies the block is processed in an optimistic mode, where certain validations might be pending.


## OpenAPI

````yaml openapi/ethereum_beacon_chain_api/events/subscribe_to_events.json GET /0a9d79d93fb2f4a4b1e04695da2b77a7/eth/v1/events
openapi: 3.0.0
info:
  title: Ethereum Beacon Events API
  version: 1.0.0
servers:
  - url: https://beacon-nd-422-757-666.p2pify.com
security: []
paths:
  /0a9d79d93fb2f4a4b1e04695da2b77a7/eth/v1/events:
    get:
      summary: Subscribe to events
      operationId: subscribeToBeaconEvents
      parameters:
        - name: topics
          in: query
          description: Topics to subscribe to, e.g., 'head'
          required: true
          schema:
            type: string
            default: head
      responses:
        '200':
          description: Successfully subscribed to events
          content:
            text/event-stream:
              schema:
                type: string
                example: |+
                  event: contribution_and_proof
                  data: {"contribution": "...", "proof": "..."}

        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
      required:
        - code
        - message

````