Skip to content

Instantly share code, notes, and snippets.

@cookandy
Created February 21, 2023 00:04
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 cookandy/32224bf08cc59df8bc354a6b7fbe6907 to your computer and use it in GitHub Desktop.
Save cookandy/32224bf08cc59df8bc354a6b7fbe6907 to your computer and use it in GitHub Desktop.
Check ETH validator withdrawal against CLWP repo
#!/bin/bash
# usage ./checkValidator <space separated list of validators>
NOT_FOUND="Not Found"
if [ $# -eq 0 ]
then
echo "You must provide at least one argument. \n Use with ./clwpCheck.sh <validator1Index> <validator2Index> ..."
fi
# Check cURL command if available (required), abort if does not exists
type curl >/dev/null 2>&1 || { echo >&2 "Required curl but it's not installed. Aborting."; exit 1; }
echo "🕵️ Checking the public CLWP list at https://github.com/benjaminchodroff/ConsensusLayerWithdrawalProtection/tree/main/mainnet"
for i in "$@"; do
echo
RESPONSE=`curl -s "https://github.com/benjaminchodroff/ConsensusLayerWithdrawalProtection/commits/main/mainnet/"$i".json.atom"`
if [ "$RESPONSE" == "$NOT_FOUND" ]; then
echo "🟢 Validator $i not found in the broadcast list."
else
JSONRESPONSE=`curl -s "https://raw.githubusercontent.com/benjaminchodroff/ConsensusLayerWithdrawalProtection/main/mainnet/"$i".json"`
startIndex=$(echo $JSONRESPONSE | grep -b -o 'to_execution_address' | cut -d: -f1)
withdrawalAddress=${JSONRESPONSE:$startIndex+23:42}
echo "🔴 Validator $i: Watch out, there is a request to change the withdrawal address to "$withdrawalAddress
echo " If you didn't request this change, you should contact CLWP right away 👉 https://clwp.xyz/index.php/contact.html"
echo " This signed message will be broadcast at Shangai 👉 https://raw.githubusercontent.com/benjaminchodroff/ConsensusLayerWithdrawalProtection/main/mainnet/"$i".json"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment