Running as API service
Last updated
Last updated
The Operator API facilitates the initiation of validator registrations via API calls, proving particularly useful in cases where the operator independently oversees the creation and storage of validator keys. Within this framework, keystores are generated and preserved externally from the operator. Similarly, exit signatures are produced outside the operator. In essence, the operator acts as an intermediary for communication with the vault contract.
Before proceeding, ensure the following prerequisites are completed:
Generate a hot wallet or connect an existing one. Refer to the section for more details.
To run the Operator API, use the command below:
This command allows for direct parameter input (e.g., --data-dir
) or through environment variables. A basic example of setting environment variables is as follows:
For additional parameter information, use the --help
flag:
Docker Usage Notes
When operating within Docker, it's necessary to specify the --data-dir
variable, such as --data-dir=/data
. Ensure the data-dir
is mapped to a directory on the host.
The database-dir
should also be mapped to a host directory or Docker volume, with write permissions enabled for the directory linked to database-dir
. Setting up permissions is not required if using volumes.
Relayer is a service providing validators registration data to Operator.
Many relayers are possible for various use-cases. Feel free to implement your own relayer using API specification below.
Validators manager is a role who can register validators in the vault.
For most vaults validators manager address equals to deposit data registry address. This is default setup for vaults. In this case you have to upload deposit data to your vault. Vault contract will require Merkle proof for validators on each registration call.
For more advanced cases you can customise validators manager in vault UI. Go to settings -> Roles -> Validators manager. In this setup you don't have to upload deposit data. Vault contract will require validators manager signature on each registration call instead of Merkle proof.
Operator listens to vault balance changes. When 32 Eth is available Operator predicts next validator index and requests Relayer to obtain validator registration data.
Relayer should provide validator registration data when requested. The data includes:
validator public key, deposit signature, deposit amount
validator exit signature
validators manager signature
To produce exit signature Relayer should use validator index passed in request. Operator passes start validator index. You should increment this index for each validator except the first one.
Once Operator receives registration data Operator requests Oracles approvals and submits registration to Vault contract.
validators_start_index
- validator index for the first validator in the batch
validators_batch_size
- number of validators in current batch. Maximum batch size is determined by protocol config, currently 10.
validators_total
- hint for Relayer. Does not affect Relayer response. Relayer may use this value to allocate larger portions of validators in background. validators_total
should be more than or equal to validators_batch_size
.
Validators manager signature is signature. See EIP-712 message structure in . Signer address must be validators manager configured in Vault settings.
See demo project . You may use it as a starting point for your own Relayer.