lido
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- tags: withdrawals, tooling, ejector --- ![Ejector](https://hackmd.io/_uploads/HkkJR-beh.png) # Validator Ejector Setup ## Introduction The validator ejector is a daemon service which monitors [ValidatorsExitBusOracle](https://github.com/lidofinance/lido-dao/blob/5fcedc6e9a9f3ec154e69cff47c2b9e25503a78a/contracts/0.8.9/oracle/ValidatorsExitBusOracle.sol) events and sends out stored exit messages when necessary. It allows node operators to generate and sign exit messages ahead of time, which will be sent out by the ejector when the protocol requests an exit to be made. On start, it loads exit messages from a specified folder of individual `.json` files and validates their format, structure, and signature. Then, it loads events from a configurable amount of latest finalized blocks, checks if exits should be made and after that periodically fetches fresh events. ## Requirements ### Hardware - 2-core CPU - 1GB RAM ### Nodes - Execution node - [full node required](https://ethereum.org/en/developers/docs/nodes-and-clients/#node-types) - Consensus node ### Software #### Using Docker: Docker & docker-compose #### Running directly or using for message encryption: Node.js 16 or higher ## Exit Messages The ejector loads and validates exit messages on start. This means that any changes to the messages folder (e.g. new exit messages) require a restart of the application to be picked up. The ejector accepts messages in three formats: ### Generic Format ```json { "message": { "epoch": "123", "validator_index": "123" }, "signature": "0x123" } ``` ### ethdo Output Format ```json { "exit": { "message": { "epoch": "123", "validator_index": "123" }, "signature": "0x123" }, "fork_version": "0x123" } ``` ### Encrypted Format ```json { "version": 4, "uuid": "123abc-123abc-123abc", "path": "", "pubkey": "", "crypto": { "kdf": { "function": "pbkdf2", "params": { "dklen": 123, "c": 123, "prf": "hmac-sha256", "salt": "123abc" }, "message": "" }, "checksum": { "function": "sha256", "params": {}, "message": "123abc" }, "cipher": { "function": "aes-128-ctr", "params": { "iv": "123abc" }, "message": "123abc" } } } ``` ## Encrypting Messages It is highly advised that after exit messages are generated and signed, they should be encrypted for storage safety. The ejector will decrypt files on start by looking up the password in the `MESSAGES_PASSWORD` environment variable. Exit messages are encrypted and decrypted by the ejector according to the [EIP-2335](https://github.com/ethereum/ercs/blob/master/ERCS/erc-2335.md) specification. The ejector is bundled with a small, easy to use encryption script. ### Encryption using the Ejector - Source Code 1. Clone repository: ```bash git clone https://github.com/lidofinance/validator-ejector.git cd validator-ejector ``` 2. Create an `.env` file with your encryption password or pass it to the terminal before proceeding: ``` MESSAGES_PASSWORD=password ``` 3. Copy your `.json` exit message files to directory `encryptor/input` 4. Run `yarn & yarn encrypt` 5. Your encrypted exit message files will be saved to `encryptor/output` ### Encryption using the Ejector - Docker The ejector is bundled with an encryptor script inside, so you can run it using the same Docker image (the sha in the code must always be from the [latest production release](https://hub.docker.com/r/lidofinance/validator-ejector/tags)): ```bash docker run \ -e MESSAGES_PASSWORD=secret \ -v /full/path/to/input:/app/encryptor/input/ \ -v /full/path/to/output:/app/encryptor/output/ \ lidofinance/validator-ejector@sha256:7b0c780d7d62afbf7ac7bdc6f7a35634e67a99ec733632c1fd6eed62388f4d19 \ node /app/dist/encryptor/encrypt.js ``` For platforms with a different architecture but with emulation/transpilation support e.g. macOS on M-series processors, additionally specify: ```bash --platform linux/amd64 ``` ## Environment Variables ### EXECUTION_NODE Address of the execution node. ### CONSENSUS_NODE Address of the consensus node. ### LOCATOR_ADDRESS Address of the [LidoLocator](https://github.com/lidofinance/lido-dao/blob/5fcedc6e9a9f3ec154e69cff47c2b9e25503a78a/contracts/0.8.9/LidoLocator.sol) contract (can be looked up at the [respective network’s deployed contracts page](https://docs.lido.fi/deployed-contracts/)). Hoodi Testnet: ``` 0xe2EF9536DAAAEBFf5b1c130957AB3E80056b06D8 ``` Mainnet: ``` 0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb ``` ### STAKING_MODULE_ID ID of the [StakingRouter](https://github.com/lidofinance/lido-dao/blob/5fcedc6e9a9f3ec154e69cff47c2b9e25503a78a/contracts/0.8.9/StakingRouter.sol) contract module. Currently, the staking router’s [NodeOperatorsRegistry](https://github.com/lidofinance/lido-dao/blob/5fcedc6e9a9f3ec154e69cff47c2b9e25503a78a/contracts/0.4.24/nos/NodeOperatorsRegistry.sol) has three modules, the Curated one with ID `1` and Simple DVT with ID `2`, and the Community Staking Module (CSM) with ID `3` (or `4` on testnets) ### OPERATOR_ID You can find this on the operators dashboard (e.g. #123 on the operator card): [Hoodi Curated module](https://operators-hoodi.testnet.fi/module/1), [Hoodi Simple DVT module](https://operators-hoodi.testnet.fi/module/2), [Mainnet Curated module](https://operators.lido.fi/module/1), [Mainnet Simple DVT module](https://operators.lido.fi/module/2) ### MESSAGES_LOCATION Location from which to load `.json` exit messages. When set, messages mode will be activated. This is not needed if you use the ejector in webhook mode. For example, `/messages` in Docker or simply `messages` if running directly for local files. External storage bucket URLs are supported for AWS S3 and Google Cloud Storage: - `s3://` for S3 - `gs://` for GCS Authentication setup: [S3](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html), [GCS](https://cloud.google.com/docs/authentication/application-default-credentials#attached-sa) ### VALIDATOR_EXIT_WEBHOOK Endpoint to fetch when an exit has to be made. Allows to implement a just in time approach by offloading exiting logic to an external service and using the ejector as a secure exit events reader. When set, webhook mode will be activated. This is not needed if you use the ejector in messages mode. On the endpoint, JSON will be POSTed with the following structure: ```json { "validatorIndex": "123", "validatorPubkey": "0x123" } ``` A 200 response will be counted as a successful exit, non-200 ones as failures. ### ORACLE_ADDRESSES_ALLOWLIST JSON array of Lido Oracle addresses, from which only report transactions will be accepted. To get the list of members you can go to the “Read Contract” section of the ValidatorsExitBusOracle’s HashConsensus on Etherscan and query the `getMembers()` method: [Mainnet](https://etherscan.io/address/0x7FaDB6358950c5fAA66Cb5EB8eE5147De3df355a#readContract#F16), [Hoodi](https://hoodi.etherscan.io/address/0x30308CD8844fb2DB3ec4D056F1d475a802DCA07c?tab=read_write_contract#readContract#F16) #### Example list for Mainnet _(last updated 2025-08-01)_: 1 0x73181107c8D9ED4ce0bbeF7A0b4ccf3320C41d12 2 0x285f8537e1dAeEdaf617e96C742F2Cf36d63CcfB 3 0x404335BcE530400a5814375E7Ec1FB55fAff3eA2 4 0x946D3b081ed19173dC83Cd974fC69e1e760B7d78 5 0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5 6 0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf 7 0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8 8 0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9 9 0x4118DAD7f348A4063bD15786c299De2f3B1333F3 Example `.env` entry for Mainnet _(last updated 2025-08-01)_: ```json ["0x73181107c8D9ED4ce0bbeF7A0b4ccf3320C41d12","0x285f8537e1dAeEdaf617e96C742F2Cf36d63CcfB","0x404335BcE530400a5814375E7Ec1FB55fAff3eA2","0x946D3b081ed19173dC83Cd974fC69e1e760B7d78","0x007DE4a5F7bc37E2F26c0cb2E8A95006EE9B89b5","0xc79F702202E3A6B0B6310B537E786B9ACAA19BAf","0x61c91ECd902EB56e314bB2D5c5C07785444Ea1c8","0xe57B3792aDCc5da47EF4fF588883F0ee0c9835C9","0x4118DAD7f348A4063bD15786c299De2f3B1333F3"] ``` Note: make sure quotes are copied correctly if copying these examples. #### Example list for Hoodi _(last updated 2025-08-01)_: 1 0xcA80ee7313A315879f326105134F938676Cfd7a9 2 0xf03B8DC8762B97F13Ac82e6F94bE3Ed002FF7459 3 0x1932f53B1457a5987791a40Ba91f71c5Efd5788F 4 0xf7aE520e99ed3C41180B5E12681d31Aa7302E4e5 5 0x99B2B75F490fFC9A29E4E1f5987BE8e30E690aDF 6 0x219743f1911d84B32599BdC2Df21fC8Dba6F81a2 7 0xD3b1e36A372Ca250eefF61f90E833Ca070559970 8 0x4c75FA734a39f3a21C57e583c1c29942F021C6B7 9 0x948A62cc0414979dc7aa9364BA5b96ECb29f8736 10 0xfe43A8B0b481Ae9fB1862d31826532047d2d538c 11 0x43C45C2455C49eed320F463fF4f1Ece3D2BF5aE2 Example `.env` entry for Hoodi _(last updated 2025-08-01)_: ```json ["0xcA80ee7313A315879f326105134F938676Cfd7a9","0xf03B8DC8762B97F13Ac82e6F94bE3Ed002FF7459","0x1932f53B1457a5987791a40Ba91f71c5Efd5788F","0xf7aE520e99ed3C41180B5E12681d31Aa7302E4e5","0x99B2B75F490fFC9A29E4E1f5987BE8e30E690aDF","0x219743f1911d84B32599BdC2Df21fC8Dba6F81a2","0xD3b1e36A372Ca250eefF61f90E833Ca070559970","0x4c75FA734a39f3a21C57e583c1c29942F021C6B7","0x948A62cc0414979dc7aa9364BA5b96ECb29f8736","0xfe43A8B0b481Ae9fB1862d31826532047d2d538c","0x43C45C2455C49eed320F463fF4f1Ece3D2BF5aE2"] ``` Note: make sure quotes are copied correctly if copying these examples. ### MESSAGES_PASSWORD Password to decrypt encrypted exit messages with on application start. ### MESSAGES_PASSWORD_FILE Alternative to `MESSAGES_PASSWORD`. Path to file containing the password to decrypt exit messages with. If used, MESSAGES_PASSWORD (not MESSAGES_PASSWORD_FILE) needs to be added to LOGGER_SECRETS to be sanitized. ### BLOCKS_PRELOAD Amount of blocks to load events from on application start. Suggested to include in your `.env` variables, but to be left at the default of 50000 (~7 days of blocks). In case your ejector will be down due to an emergency, this value can be tweaked to let the ejector load a higher amount of blocks on start. ### HTTP_PORT Port for serving metrics and a health check endpoint, default 8989. ### RUN_METRICS Enable with `true` to serve Prometheus metrics: [full list](https://github.com/lidofinance/validator-ejector#metrics) Will be served on `HOST:$HTTP_PORT/metrics`. Highly advised for monitoring and alerting. ### RUN_HEALTH_CHECK Enabled by default, disabled with `false`. Highly recommended to monitor this endpoint. Will be served on `HOST:$HTTP_PORT/health`. ### LOGGER_LEVEL Recommended to set to `info` (default), can be changed to `debug` in case of issues for easier debugging. ### LOGGER_FORMAT Format of logs, `simple` by default, but can be set to `json` to be easily parsable, e.g. by [Loki](https://github.com/grafana/loki). ### LOGGER_SECRETS Environment variable names or exact values which should be replaced in logs, in JSON array of strings format. Advised to include your MESSAGES_PASSWORD, EXECUTION_NODE, and MESSAGES_PASSWORD: ```json ["MESSAGES_PASSWORD","EXECUTION_NODE","CONSENSUS_NODE"] ``` Note: make sure quotes are copied correctly if copying this example. ### DRY_RUN Allows to test the application with `true` without actually sending out exit messages. Use with caution! Make sure to set to `false` or completely leave it out in production. ### Advanced Parameters Please do not use unless suggested by a Lido contributor. - BLOCKS_LOOP - 900 (3 hours of blocks) - Amount of blocks the ejector looks behind on wake in polling jobs - JOB_INTERVAL - 384000 (1 epoch) - Time for which the ejector sleeps between jobs - DISABLE_SECURITY_DONT_USE_IN_PRODUCTION - false - Set to `true` to skip security checks, for example if the ValidatorsExitBusOracle’s HashConsensus contract was changed after the ejector was unable to exit validators e.g. because it was switched off ## Running ### Source Code 1. Clone repository: ```bash git clone https://github.com/lidofinance/validator-ejector.git cd validator-ejector ``` 2. Create an exit messages directory, for example locally `mkdir messages` 3. Put your exit message files in the messages folder 4. Copy the env sample file `cp sample.env .env` 5. Fill the environment variables in the `.env` file 6. Run ```bash yarn yarn build yarn start ``` ### Docker with docker-compose 1. Create a root directory for the ejector, `cd` into that folder 2. Create an exit messages directory `mkdir messages` 3. Put your exit message files in the messages folder 4. Copy the env sample file `cp sample.env .env` 5. Fill the environment variables in the `.env` file 6. Create a `docker-compose.yml` file using [this template](https://github.com/lidofinance/validator-ejector/blob/develop/docker-compose.yml) 7. Run `docker-compose up` or `docker-compose up -d` to start in detached mode (in the background) ## Check the Ejector is working 1. Ensure that there are no errors in the logs and no container restarts occuring 2. Verify that the config logged on start is correctly represented in the logs 3. If you have put presigned messages in the messages folder, make sure the `loadedMessages` count is greater than `0` 4. Ensure you can see the `Job started` and `Job finished` lines in the logs An example of a correct operation log: ``` info: Application started, version 1.0.0 {"EXECUTION_NODE":"<secret>","CONSENSUS_NODE":"<secret>","LOCATOR_ADDRESS":"0x123","STAKING_MODULE_ID":"1","OPERATOR_ID":"0","MESSAGES_LOCATION":"messages","ORACLE_ADDRESSES_ALLOWLIST":["0x123"],"MESSAGES_PASSWORD":"<secret>","BLOCKS_PRELOAD":190000,"BLOCKS_LOOP":64,"JOB_INTERVAL":384000,"HTTP_PORT":8989,"RUN_METRICS":true,"RUN_HEALTH_CHECK":true,"DRY_RUN":false} info: Loading messages from messages info: Loaded 123 messages info: Validating messages info: Starting, searching only for requests for operator 0 info: Loading initial events for 190000 last blocks info: Job started {"operatorId":"0","stakingModuleId":"1","loadedMessages":123} info: Resolved Exit Bus contract address using the Locator {"exitBusAddress":"0x123"} info: Resolved Consensus contract address {"consensusAddress":"0x123"} info: Fetched the latest block from EL {"latestBlock":12345} info: Fetching request events from the Exit Bus {"eventsNumber":190000,"fromBlock":12345,"toBlock":12345} info: Loaded ValidatorExitRequest events {"amount":0} info: Handling ejection requests {"amount":0} info: Job finished info: Starting 384 seconds polling for 64 last blocks ``` ## What if something is wrong? 1. Make sure your configuration is correct 2. Make sure you are on the recommended Docker image sha hash or version if running directly 3. Check if your nodes are synced and working correctly 4. Restart the application 5. Start the application with the LOGGER_LEVEL=debug environment variable and contact the Lido devs with logs to investigate the problem ## Additional Resources Validator Ejector GitHub Repository (Open Source) https://github.com/lidofinance/validator-ejector What's Changing for Node Operators in Lido V2 - parts can be outdated https://hackmd.io/@lido/Byue6SQxh Lido Withdrawals: Automating Validator Exits - parts can be outdated https://hackmd.io/@lido/BkxRxAr-o Ejector Logic Spec - parts can be outdated https://hackmd.io/@lido/r1KZ4YNdj

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully