Created
May 29, 2020 09:28
-
-
Save torfbolt/f41ed62ee7ba29859c161a9617abafe1 to your computer and use it in GitHub Desktop.
Script to generate lighthouse validator config files from EIP-2386 wallets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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