* Refactor documentation, ef_tests makefile * Add makefile to root * Tidy readme * Fix readme badges * Tidy logs * Add terminalize gif * Update readme image * Update readme image * Tidy logs * Update readme image * Update readme * Update readme * Fix book link * Update makefiles * Update book * Fix link in book * Add readme for book * Remove old docs, move api spec YAML * Fix eth2/ dir readme * Add readme for lcli * Add about this book section * Minor formatting improvements * Address mehdi's comments
2.0 KiB
Websocket API
By default, a Lighthouse beacon_node
exposes a websocket server on localhost:5053
.
The following CLI flags control the websocket server:
--no-ws
: disable the websocket server.--ws-port
: specify the listen port of the server.--ws-address
: specify the listen address of the server.
All clients connected to the websocket server will receive the same stream of events, all triggered
by the BeaconChain
. Each event is a JSON object with the following schema:
{
"event": "string",
"data": "object"
}
Events
The following events may be emitted:
Beacon Head Changed
Occurs whenever the canonical head of the beacon chain changes.
{
"event": "beacon_head_changed",
"data": {
"reorg": "boolean",
"current_head_beacon_block_root": "string",
"previous_head_beacon_block_root": "string"
}
}
Beacon Finalization
Occurs whenever the finalized checkpoint of the canonical head changes.
{
"event": "beacon_finalization",
"data": {
"epoch": "number",
"root": "string"
}
}
Beacon Block Imported
Occurs whenever the beacon node imports a valid block.
{
"event": "beacon_block_imported",
"data": {
"block": "object"
}
}
Beacon Block Rejected
Occurs whenever the beacon node rejects a block because it is invalid or an error occurred during validation.
{
"event": "beacon_block_rejected",
"data": {
"reason": "string",
"block": "object"
}
}
Beacon Attestation Imported
Occurs whenever the beacon node imports a valid attestation.
{
"event": "beacon_attestation_imported",
"data": {
"attestation": "object"
}
}
Beacon Attestation Rejected
Occurs whenever the beacon node rejects an attestation because it is invalid or an error occurred during validation.
{
"event": "beacon_attestation_rejected",
"data": {
"reason": "string",
"attestation": "object"
}
}