Skip to content

Instantly share code, notes, and snippets.

@turboza
Last active May 29, 2022 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turboza/9665cccedea4b7094b5a7ff58d4b8188 to your computer and use it in GitHub Desktop.
Save turboza/9665cccedea4b7094b5a7ff58d4b8188 to your computer and use it in GitHub Desktop.

Adding one or more validators to the same node

This is the follow up from the Guide to join kiln for running more than one validator in the same node.

Why?

  • If we have many keys, no need to spin up the new machine, or running the new instance of geth/beacon.
  • Maybe you want to try to get the validator slashed by running the new validator with the same key

How?

Tested with Ubuntu

Substitute values with your data

export VAL_USER=lighthousevalidator2
export VAL_DIR=/var/lib/lighthouse2
export VAL_KEY_DIR=/home/MYUSER/validator_keys2
export VAL_PORT=5058
export RECIPIENT_WALLET_ADDRESS=0x0000000000000000000000000000000000000000
sudo useradd --no-create-home --shell /bin/false $VAL_USER
sudo mkdir -p $VAL_DIR/validators
sudo chown -R $VAL_USER:$VAL_USER $VAL_DIR/validators
sudo chmod 700 $VAL_DIR/validators

import keys to the path below, see the original guide for the instruction.

mkdir $VAL_KEY_DIR
cd $VAL_KEY_DIR
sudo /usr/local/bin/lighthouse account validator import \
 --directory $VAL_KEY_DIR \
 --datadir $VAL_DIR \
 --network kiln

Enter the keystore password from above and enter this.

sudo chown -R $VAL_USER:$VAL_USER $VAL_DIR/validators
sudo vi /etc/systemd/system/$VAL_USER.service

enter this into the file


[Unit]
Description=Lighthouse Ethereum Client Validator Client (Kiln)
Wants=network-online.target
After=network-online.target

[Service]
User=$VAL_USER
Group=$VAL_USER
Type=simple
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/lighthouse vc \
 --network kiln \
 --datadir $VAL_DIR \
 --graffiti EthStaker \
 --metrics \
 --metrics-port $VAL_PORT \
 --suggested-fee-recipient $RECIPIENT_WALLET_ADDRESS

[Install]
WantedBy=multi-user.target


substitute env

envsubst < /etc/systemd/system/$VAL_USER.service | sudo tee /etc/systemd/system/$VAL_USER.service
sudo systemctl daemon-reload
sudo systemctl start $VAL_USER.service
sudo systemctl status $VAL_USER.service
sudo systemctl enable $VAL_USER.service
sudo journalctl -f -u $VAL_USER.service -o cat | ccze -A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment