Skip to content

Commit f38288c

Browse files
authored
feat: implement KeyManager API (#1246)
1 parent 02a2f86 commit f38288c

File tree

19 files changed

+1957
-102
lines changed

19 files changed

+1957
-102
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ Some public endpoints can be found in [eth-clients.github.io/checkpoint-sync-end
9090
> The data retrieved from the URL is stored in the DB once the node is initiated (i.e. the iex prompt shows).
9191
> Once this happens, following runs of `make iex` will start the node using that data.
9292
93-
### Beacon API
93+
### APIs
94+
#### Beacon API
9495

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

102103
```shell
103-
iex -S mix run -- --beacon-api --beacon-api-port <your_port_here>
104+
iex -S mix run -- --beacon-api-port <your_port_here>
105+
```
106+
> [!WARNING]
107+
> In case checkpoint-sync is needed, following the instructions above will end immediately with an error (see [Checkpoint Sync](#checkpoint-sync)).
108+
>
109+
110+
#### Key-Manager API
111+
112+
Implemented following the [Ethereum specification](https://ethereum.github.io/keymanager-APIs/#/).
113+
114+
You can start the application with the key manager API on the default port `5000` running:
115+
116+
```shell
117+
iex -S mix run -- --validator-api
118+
```
119+
120+
121+
You can also specify a port with the "--validator-api-port" flag:
122+
123+
```shell
124+
iex -S mix run -- --validator-api-port <your_port_here>
104125
```
105126
> [!WARNING]
106127
> In case checkpoint-sync is needed, following the instructions above will end immediately with an error (see [Checkpoint Sync](#checkpoint-sync)).
@@ -250,6 +271,7 @@ participants:
250271
use_separate_vc: false
251272
count: 1
252273
cl_max_mem: 4096
274+
keymanager_enabled: true
253275
```
254276
255277
### Kurtosis Execution and Make tasks

config/runtime.exs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ switches = [
1818
log_file: :string,
1919
beacon_api: :boolean,
2020
beacon_api_port: :integer,
21+
validator_api: :boolean,
22+
validator_api_port: :integer,
2123
listen_address: [:string, :keep],
2224
discovery_port: :integer,
2325
boot_nodes: :string,
@@ -47,6 +49,8 @@ metrics_port = Keyword.get(args, :metrics_port, nil)
4749
enable_metrics = Keyword.get(args, :metrics, not is_nil(metrics_port))
4850
beacon_api_port = Keyword.get(args, :beacon_api_port, nil)
4951
enable_beacon_api = Keyword.get(args, :beacon_api, not is_nil(beacon_api_port))
52+
validator_api_port = Keyword.get(args, :validator_api_port, nil)
53+
enable_validator_api = Keyword.get(args, :validator_api, not is_nil(validator_api_port))
5054
listen_addresses = Keyword.get_values(args, :listen_address)
5155
discovery_port = Keyword.get(args, :discovery_port, 9000)
5256
cli_bootnodes = Keyword.get(args, :boot_nodes, "")
@@ -153,6 +157,16 @@ config :lambda_ethereum_consensus, BeaconApi.Endpoint,
153157
layout: false
154158
]
155159

160+
# KeyStore API
161+
config :lambda_ethereum_consensus, KeyStoreApi.Endpoint,
162+
server: enable_validator_api,
163+
http: [port: validator_api_port || 5000],
164+
url: [host: "localhost"],
165+
render_errors: [
166+
formats: [json: KeyStoreApi.ErrorJSON],
167+
layout: false
168+
]
169+
156170
# Validator setup
157171

158172
if (keystore_dir != nil and keystore_pass_dir == nil) or

0 commit comments

Comments
 (0)