Events API

Streams events from HotShot

This API allows a client, not participating in consensus, to follow along with consensus in a trustless manner, by streaming and verifying events produced by consensus. It is especially useful for block builders, who need to maintain their own view of the internal consensus state at all times, so that they can intelligently propose blocks on top of not-yet-finalized proposed parent blocks.

This API is often served on a different port than other APIs, for reasons that will be resolved in future releases.

Types

LeafInfo

The specific format of this type is not currently specified, but it can be deserialized and interpreted in Rust using the LeafInfo type.

DAProposal

The specific format of this type is not currently specified, but it can be deserialized and interpreted in Rust using the Proposal type.

QuorumProposal

The specific format of this type is not currently specified, but it can be deserialized and interpreted in Rust using the Proposal type.

Endpoints

GET /hotshot-events/events

This is a WebSockets endpoint. The client must be prepared to upgrade the connection to a WebSockets connection, including the proper headers.

Subscribe to consensus events.

Yields

{
    "view_number": integer,
    "event":
        {
            "StartupInfo": {
                "known_node_with_stake": [
                    {
                    }
                ]
            }
        }
      | { "HotshotError": { "error": ... } }
      | { "HotshotTransactions": { "transactions": [Transaction] } }
      | {
            "HotshotDecide": {
                "leaf_chain": [LeafInfo],
                "block_size": null | integer
            }
        }
      | {
            "HotshotDAProposal": {
                "proposal": DAProposal,
                "sender": tagged<BLS_VER_KEY>
            }
        }
      | {
            "HotshotQuorumProposal": {
                "proposal": QuorumProposal,
                "sender": tagged<BLS_VER_KEY>
            }
        }
      | "Unknown"
}

Last updated