Skip to content

Commit

Permalink
feat: implement KeyManager API (#1246)
Browse files Browse the repository at this point in the history
  • Loading branch information
avilagaston9 authored Aug 13, 2024
1 parent 02a2f86 commit f38288c
Show file tree
Hide file tree
Showing 19 changed files with 1,957 additions and 102 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ Some public endpoints can be found in [eth-clients.github.io/checkpoint-sync-end
> The data retrieved from the URL is stored in the DB once the node is initiated (i.e. the iex prompt shows).
> Once this happens, following runs of `make iex` will start the node using that data.
### Beacon API
### APIs
#### Beacon API

You can start the application with the Beacon API on the default port `4000` running:
```shell
Expand All @@ -100,7 +101,27 @@ make start
You can also specify a port with the "--beacon-api-port" flag:

```shell
iex -S mix run -- --beacon-api --beacon-api-port <your_port_here>
iex -S mix run -- --beacon-api-port <your_port_here>
```
> [!WARNING]
> In case checkpoint-sync is needed, following the instructions above will end immediately with an error (see [Checkpoint Sync](#checkpoint-sync)).
>
#### Key-Manager API

Implemented following the [Ethereum specification](https://ethereum.github.io/keymanager-APIs/#/).

You can start the application with the key manager API on the default port `5000` running:

```shell
iex -S mix run -- --validator-api
```


You can also specify a port with the "--validator-api-port" flag:

```shell
iex -S mix run -- --validator-api-port <your_port_here>
```
> [!WARNING]
> In case checkpoint-sync is needed, following the instructions above will end immediately with an error (see [Checkpoint Sync](#checkpoint-sync)).
Expand Down Expand Up @@ -250,6 +271,7 @@ participants:
use_separate_vc: false
count: 1
cl_max_mem: 4096
keymanager_enabled: true
```
### Kurtosis Execution and Make tasks
Expand Down
14 changes: 14 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ switches = [
log_file: :string,
beacon_api: :boolean,
beacon_api_port: :integer,
validator_api: :boolean,
validator_api_port: :integer,
listen_address: [:string, :keep],
discovery_port: :integer,
boot_nodes: :string,
Expand Down Expand Up @@ -47,6 +49,8 @@ metrics_port = Keyword.get(args, :metrics_port, nil)
enable_metrics = Keyword.get(args, :metrics, not is_nil(metrics_port))
beacon_api_port = Keyword.get(args, :beacon_api_port, nil)
enable_beacon_api = Keyword.get(args, :beacon_api, not is_nil(beacon_api_port))
validator_api_port = Keyword.get(args, :validator_api_port, nil)
enable_validator_api = Keyword.get(args, :validator_api, not is_nil(validator_api_port))
listen_addresses = Keyword.get_values(args, :listen_address)
discovery_port = Keyword.get(args, :discovery_port, 9000)
cli_bootnodes = Keyword.get(args, :boot_nodes, "")
Expand Down Expand Up @@ -153,6 +157,16 @@ config :lambda_ethereum_consensus, BeaconApi.Endpoint,
layout: false
]

# KeyStore API
config :lambda_ethereum_consensus, KeyStoreApi.Endpoint,
server: enable_validator_api,
http: [port: validator_api_port || 5000],
url: [host: "localhost"],
render_errors: [
formats: [json: KeyStoreApi.ErrorJSON],
layout: false
]

# Validator setup

if (keystore_dir != nil and keystore_pass_dir == nil) or
Expand Down
Loading

0 comments on commit f38288c

Please sign in to comment.