Skip to content

Instantly share code, notes, and snippets.

@torfbolt
Created May 29, 2020 09:28
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 torfbolt/f41ed62ee7ba29859c161a9617abafe1 to your computer and use it in GitHub Desktop.
Save torfbolt/f41ed62ee7ba29859c161a9617abafe1 to your computer and use it in GitHub Desktop.
Script to generate lighthouse validator config files from EIP-2386 wallets
#!/bin/bash
# usage: ./lh-vc-config-from-wallet.sh wallet/account-regex keystore-passphrase
# example: ./lh-vc-config-from-wallet.sh "witti-validator/lighthouse.*" "witti"
WALLET_DIR="$HOME/.config/ethereum2/wallets"
LH_DIR="$HOME/.lighthouse"
for w in $WALLET_DIR/*; do
wn=$(cat "$w/${w##*/}" | jq -r '.name')
# echo $wn
for a in $w/*; do
[[ $a == $w/${w##*/} ]] && continue
cat "$a" | jq '.name' > /dev/null 2>&1 || continue
an=$wn/$(cat "$a" | jq -r '.name')
[[ $an =~ $1 ]] || continue
pubkey="0x$(cat "$a" | jq -r '.pubkey')"
echo "Generating files for $an"
mkdir -p $LH_DIR/validators/$pubkey
cat $a | jq 'del(.name)' > $LH_DIR/validators/$pubkey/voting-keystore.json
echo -n "$2" > $LH_DIR/secrets/$pubkey
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment