Skip to content

Instantly share code, notes, and snippets.

@martinvol
Last active June 25, 2025 17:12
Show Gist options
  • Select an option

  • Save martinvol/31e0098ed3b44ec5cf89c24067fc2fc5 to your computer and use it in GitHub Desktop.

Select an option

Save martinvol/31e0098ed3b44ec5cf89c24067fc2fc5 to your computer and use it in GitHub Desktop.
Step by step to pass a governance proposal on Alfajores or Baklava Celo testnets
#!/usr/bin/env bash
set -euo pipefail
# redirect everything to stdout?
exec 2>&1
NODE_URL="" # TODO add the -n flag to every command to use this node
# Variables to be defined
PROPOSAL_JSON_PATH=<path to proposal">
DESCRIPTION_URL=<url link of proposal>
# address sending the tx
SIGNER=
# private key of the address sending the tx
PRIVATE_KEY=
# address of a single approver multisig
APPROVER=
# private key of the multisig approver
PRIVATE_KEY_APPROVER=
# address of the account that has enough votes to pass the proposal
VOTER=
# private key of the voter
BIG_VOTER_KEY=
celoclijs() {
# <alternative path to a custom celocli build> "$@"
celocli "$@"
}
display_time(){
current_time=`date`
echo "Current time is $current_time"
}
# check cli version just in case, if old it will display a warning
celoclijs --version
#alias celoclijs='celocli'
display_time
# flip comment if needed to force the proposal (no check if tx will succeed, this is useful when one tx depends on the previous one or a different proposal)
#FORCE="--force"
FORCE=""
celoclijs governance:withdraw --from=$SIGNER --privateKey $PRIVATE_KEY || echo "There were no pending refunds" # Optional step, getting some deposits back
# 100e18 is for tesnets, for mainnet is 10000e18, but this script is not useful for mainnet anyways
PROPOSAL_ID=`celoclijs governance:propose --deposit=100e18 --descriptionURL=$DESCRIPTION_URL --from=$SIGNER --jsonTransactions=$PROPOSAL_JSON_PATH $FORCE --privateKey $PRIVATE_KEY | grep "proposalId:" | grep -oE '[0-9]+'`
echo "Proposal has id=$PROPOSAL_ID"
echo -e "\a" && sleep 10 &&\
celoclijs governance:view --proposalID $PROPOSAL_ID
display_time
echo -e "\a" && sleep 10 &&\
celoclijs governance:dequeue --from $APPROVER --privateKey $PRIVATE_KEY_APPROVER &&\
echo -e "\a" && sleep 10 &&\
celoclijs governance:approve --proposalID $PROPOSAL_ID --from $APPROVER --useMultiSig --privateKey $PRIVATE_KEY_APPROVER &&\
echo "proposal approved"
display_time
# echo -e "\a" && sleep 301 &&\
display_time
celoclijs governance:vote --value=Yes --from=$VOTER --proposalID=$PROPOSAL_ID --privateKey $BIG_VOTER_KEY &&\
echo "voted on proposal"
celoclijs governance:view --proposalID $PROPOSAL_ID
echo -e "\a" && sleep 301 &&\
celoclijs governance:execute --from=$SIGNER --proposalID=$PROPOSAL_ID --privateKey $PRIVATE_KEY
# Make some noise
echo -e "\a"
echo -e "\a"
echo -e "\a"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment