This repo contains a simple Eth2 "Please Read The Docs" weak subjectivity provider server.
- Docker Engine & Docker Compose
- Eth2 beacon node with accessible HTTP API
- Accurate system time
- Build the containers using
docker-compose build - Fill in the
eth2_apiandws_server_graffitiparameters inconfig.yml - Run the server using:
docker-compose up.
- The default port is
80. This may be changed by editing the port mapping foreth2_ws_serverindocker-compose.yml. - This application uses the
uwsgiPython server. For advanced settings ofuwsgi, load the desired configuration (such as number of processes & threads) in theuwsgisection ofconfig.yml
If your beacon node is running inside a Docker container on the same machine, you will have to connect to it by routing through the Docker network. The eth2_api parameter in config.yml is fed into the Python application running inside a docker container. You need to ensure that the beacon node's docker container is accessible from this container, and appropriately fill in eth2_api.
The Eth2 WS server will serve the following data in JSON format:
current_epoch: The current epoch number of the Eth2 networkis_safe: A boolean value representing whether the Eth2 API endpoint used was operating under safe WS conditions, i.e., if the current epoch is within the safe WS period of the WS checkpoint that is provided in this responsews_checkpoint: The WS checkpoint inblock_root:epoch_numberformatws_period: The WS period as calculated for the state at the WS checkpoint that is provided in this responsegraffiti: Optional graffiti set by the server operator
Example:
{
"current_epoch":16552,
"is_safe":true,
"ws_checkpoint":"0xe8e4b0170c4b9bfb09e477c754db0f5a02756859ccf1e834a39dbafbe9292f3c:15601",
"ws_period":1188,
"graffiti": "This is an Eth2 weak subjectivity data server"
}