Skip to content

ssvlabs/ssv-liquidator

Repository files navigation

SSV Network Liquidator

GitHub GitHub package.json version

GitHub commit activity GitHub contributors GitHub last commit

GitHub package.json dynamic GitHub package.json dynamic

Discord


The SSV Liquidator node executes liquidations on accounts that do not hold enough balance to pay for their operational fees

The liquidator node performs 2 main processes:
  • Syncing network contract data Every minute the liquidator node pulls recent balance-determining events for the SSV networks contract and maps all of the network's accounts on the node level to calculate the potential block for liquidation for each account in the network
  • Liquidating accounts once the potential liquidation block is reached. The liquidator node will call the liquidate() function in the network contract, if the node was the first to successfully pass the transaction the account will be liquidated and its SSV collateral will be sent to the wallet address which performed the liquidation

Requirements

ETH1 Node and other parameters

In order to be able to fetch all the operators and their status from the contract and react on different events you need to specify an ETH1 Node URI. If you want to work with a production environment then you must specify eth.infra.com as the --node-url parameter for the CLI. As alternative you can set it up in .env file as the NODE_URL. Examples below for both scenarios.

If you want to play with the testnet you can register in alchemyapi.io. Once registered the URL will look like: https://eth-goerli.alchemyapi.io/v2/<your-token-here>

Review yarn cli --help output and .env.example file for all of the parameters required for liquidator to work.

Node JS

This installation requires NodeJS on your machine. You can download it here.

Installation

git clone https://github.com/bloxapp/ssv-liquidator.git
cd ssv-liquidator
yarn install

Running the CLI

Option 1: Running with CLI arguments

Help on available CLI actions:
yarn cli --help

Input parameters:

ssv-sync-env (sse) = The SSV sync environment (prod or stage). Default: prod ssv-sync (ss) = The SSV contract name (format: version.network). Default: v4.prater node-url (n) = ETH1 node url
private-key (pk) = Account private key
gas-price (g) = Gas price, default: low
hide-table = Hide/show realtime table
max-visible-blocks = Max block range to display active clusters (optional, by default: 50000)

yarn cli --node-url=eth.infra.com --private-key=a70478942bf...

Option 2: Using an env file

Copy the .env.example file to .env and update .env with your parameters.

Example content below:

NODE_URL=eth.infra.com 
ACCOUNT_PRIVATE_KEY=a70478942bf...  
GAS_PRICE=medium  
HIDE_TABLE=false
MAX_VISIBLE_BLOCKS=50000
SSV_SYNC_ENV=prod # prod or stage, prod - is default value
SSV_SYNC=v4.prater # v4.prater | v4.mainnet (only for prod) | v4.prater (only for prod)

If you saved all the parameters in the .env file you can run:

yarn cli

Development

Run CLI as TypeScript executable

yarn cli

Lint

yarn lint

Restart syncer to sync blocks from the beginning (Clear the database file)

rm data/local.db

Testing

  • TODO

Authors

Troubleshooting

  1. Getting ERR_OSSL_EVP_UNSUPPORTED error. As a fast solution you can run liquidator as following:

    NODE_OPTIONS=--openssl-legacy-provider yarn cli ...

    Or as alternative you can save this line: export NODE_OPTIONS=--openssl-legacy-provider in your ~/.bashrc or ~/.zshrc, and then run source ~/.bashrc or source ~/.zshrc. Then you will be able to run yarn cli ... as usual.

    If you want to fix OpenSSL issue in common, follow recommendations: NodeJS v17.0.0 OpenSSL Recommendations

License

The ssv-liquidator is licensed under the GNU General Public License v3.0, also included in our repository in the LICENSE file.