Skip to content

Instantly share code, notes, and snippets.

@yellowred
Last active August 19, 2018 07:00
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 yellowred/a263ccc07be9047cf92a41e4b5c7788c to your computer and use it in GitHub Desktop.
Save yellowred/a263ccc07be9047cf92a41e4b5c7788c to your computer and use it in GitHub Desktop.
Tezos baking/endorsement rights
#!/bin/bash
# Query baking and endorsement right for a delegate in the Tezos blockchain
# Usage:
# Set the delegate first.
# ./baking_rights.sh 17 20 - get right for cycles from 17 to 20
# @source https://gist.github.com/yellowred/a263ccc07be9047cf92a41e4b5c7788c
export TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER=Y;
DELEGATE=<delegate_hash>
YELLOW='\e[33m'
GREEN='\e[32m'
NC='\e[0m'
echo -e "${GREEN}** Tezos baking/endorsement rights **${NC}"
tzBakingRights() {
echo -e "${YELLOW}Baking rights for cycle: $1 ${NC}"
./tezos-client rpc get "/chains/main/blocks/head/helpers/baking_rights?delegate=${DELEGATE}&max_priority=2&cycle=$1"
}
tzEndorsmentRights() {
echo -e "${YELLOW}Endorsement rights for cycle: $1 ${NC}"
./tezos-client rpc get "/chains/main/blocks/head/helpers/endorsing_rights?delegate=${DELEGATE}&cycle=$1"
}
for cycle in $(seq $1 $2); do
tzBakingRights $cycle;
tzEndorsmentRights $cycle;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment