Skip to content

Instantly share code, notes, and snippets.

@describeme
Created January 3, 2023 18:55
Show Gist options
  • Save describeme/ad0585cbf98fb0ada50e9ee80eb36410 to your computer and use it in GitHub Desktop.
Save describeme/ad0585cbf98fb0ada50e9ee80eb36410 to your computer and use it in GitHub Desktop.
elrond key extractor
#!/bin/bash
ELROND_NODES_HOME=$HOME/elrond-nodes
rm -rf $HOME/extracted_for_vault.json
if [ -d $ELROND_NODES_HOME ]; then
LFG=1
fi
if [[ $LFG == 1 ]]; then
echo extracting keys from $ELROND_NODES_HOME
echo " "
echo "{" > $HOME/extracted_for_vault.json
i=0
for d in $ELROND_NODES_HOME/* ; do
echo "...extracting keys from $d..."
BASE64_ENCODED_KEY=$(cat $d/config/validatorKey.pem | base64 -w 0)
echo ' "node_'$i'_keypair": "'$BASE64_ENCODED_KEY'",' >> $HOME/extracted_for_vault.json
echo "done."
echo " "
i=$((i+1))
done
echo '"":""' >> $HOME/extracted_for_vault.json
echo "}" >> $HOME/extracted_for_vault.json
else
echo elrond-nodes does not exist at $HOME/elrond-nodes
fi
echo " "
echo "keys for vault: "
echo " "
cat $HOME/extracted_for_vault.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment