Created
January 3, 2023 18:55
-
-
Save describeme/ad0585cbf98fb0ada50e9ee80eb36410 to your computer and use it in GitHub Desktop.
elrond key extractor
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 | |
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