2019-10-02 01:04:56 +00:00
|
|
|
# HTTP API
|
|
|
|
|
2021-10-06 00:46:09 +00:00
|
|
|
[OpenAPI Specification](https://ethereum.github.io/beacon-APIs/)
|
2020-09-29 03:46:54 +00:00
|
|
|
|
|
|
|
## Beacon Node
|
|
|
|
|
2019-12-19 00:45:28 +00:00
|
|
|
A Lighthouse beacon node can be configured to expose a HTTP server by supplying the `--http` flag. The default listen address is `localhost:5052`.
|
2019-10-02 01:04:56 +00:00
|
|
|
|
|
|
|
The following CLI flags control the HTTP server:
|
|
|
|
|
2019-12-19 00:45:28 +00:00
|
|
|
- `--http`: enable the HTTP server (required even if the following flags are
|
|
|
|
provided).
|
|
|
|
- `--http-port`: specify the listen port of the server.
|
|
|
|
- `--http-address`: specify the listen address of the server.
|
2019-10-02 01:04:56 +00:00
|
|
|
|
2022-03-02 01:05:08 +00:00
|
|
|
The schema of the API aligns with the standard Ethereum Beacon Node API as defined
|
2021-10-06 00:46:09 +00:00
|
|
|
at [github.com/ethereum/beacon-APIs](https://github.com/ethereum/beacon-APIs).
|
2020-09-29 03:46:54 +00:00
|
|
|
It is an easy-to-use RESTful HTTP/JSON API. An interactive specification is
|
2021-10-06 00:46:09 +00:00
|
|
|
available [here](https://ethereum.github.io/beacon-APIs/).
|
2019-10-02 01:04:56 +00:00
|
|
|
|
2019-12-19 00:45:28 +00:00
|
|
|
## Troubleshooting
|
2019-10-02 01:04:56 +00:00
|
|
|
|
2019-12-19 00:45:28 +00:00
|
|
|
### HTTP API is unavailable or refusing connections
|
2019-10-02 01:04:56 +00:00
|
|
|
|
2019-12-19 00:45:28 +00:00
|
|
|
Ensure the `--http` flag has been supplied at the CLI.
|
2019-10-02 01:04:56 +00:00
|
|
|
|
2019-12-19 00:45:28 +00:00
|
|
|
You can quickly check that the HTTP endpoint is up using `curl`:
|
2019-10-02 01:04:56 +00:00
|
|
|
|
|
|
|
```
|
2019-12-19 00:45:28 +00:00
|
|
|
curl "localhost:5052/beacon/head"
|
2019-10-02 01:04:56 +00:00
|
|
|
|
2019-12-19 00:45:28 +00:00
|
|
|
{"slot":37934,"block_root":"0x4d3ae7ebe8c6ef042db05958ec76e8f7be9d412a67a0defa6420a677249afdc7","state_root":"0x1c86b13ffc70a41e410eccce20d33f1fe59d148585ea27c2afb4060f75fe6be2","finalized_slot":37856,"finalized_block_root":"0xbdae152b62acef1e5c332697567d2b89e358628790b8273729096da670b23e86","justified_slot":37888,"justified_block_root":"0x01c2f516a407d8fdda23cad4ed4381e4ab8913d638f935a2fe9bd00d6ced5ec4","previous_justified_slot":37856,"previous_justified_block_root":"0xbdae152b62acef1e5c332697567d2b89e358628790b8273729096da670b23e86"}
|
2019-10-02 01:04:56 +00:00
|
|
|
```
|