qwizzie
Well-known member
Step 1 : Create a new text file
Step 2 : Choose which code text to use, super majority ruling on budget proposals or simple majority ruling on DCG decision proposals
Super Majority ruling on budget proposals (yes-no votes compared to total number of yes+no+abstain)
Example : Dash Core Group Operations July
Credits to xkcd, see edit.
Simple Majority ruling on DCG decision proposals (yes votes compared to total number of yes+no)
Example : DCG Evo Accelerated Release Schedule
Credits to xkcd, see edit
Step 3 : Save as votes.txt
Step 4 : Rename to votes.sh
Step 5 : Transfer this file to your Ubuntu home directory (i use WinSCP for this)
Step 6 : chmod +x votes.sh
Step 7 : dos2unix votes.sh
(if dos2unix not installed, then install through sudo apt-get install dos2unix but on my Ubuntu system it was already installed)
Step 8 : ./votes.sh
'./votes.sh' command can now be used to fetch the votes (yes, no, abstain) of both Masternodes and Evonodes on a specific proposal
Use dashmate core cli "gobject list all" (dashmate users) or dash-cli gobject list all (other users) to see the proposal hashes of all hashes of active proposals in the budget sytem and replace the hash in '# Use dash-cli if working, else assume a dashmate is to be used' in above shell script, if you want to check this on a different proposal.
Edit : credits to xkcd, who provided me with a better version of the code (already integrated on this post), one that is also compatible to both dashmate users and other users and does not need logging.
Step 2 : Choose which code text to use, super majority ruling on budget proposals or simple majority ruling on DCG decision proposals
Super Majority ruling on budget proposals (yes-no votes compared to total number of yes+no+abstain)
Example : Dash Core Group Operations July
Bash:
#!/bin/bash
# Define color codes
ORANGE='\033[0;33m'
CYAN='\033[0;36m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# Use dash-cli if working, else assume a dashmate is to be used.
if dash-cli -version >/dev/null 2>&1;then
output=$(dash-cli gobject getcurrentvotes 6c4e0f9244f25616128f198ac37ce3daa45bd04055965a54318da8bcc556eb50)
else
output=$(dashmate core cli "gobject getcurrentvotes 6c4e0f9244f25616128f198ac37ce3daa45bd04055965a54318da8bcc556eb50")
fi
# Show the output on screen
echo -e "${ORANGE}Output:${NC}\n${ORANGE}$output${NC}"
echo
echo -e "${ORANGE}Evonodes have a multiplier of 4 on their votes, this script does not take that into account during counting of Evonodes votes.${NC}"
echo -e "${ORANGE}Having a multiplier of 4 on votes, does not change the super vote majority percentage for Evonodes.${NC}"
echo
# Initialize counters
count_masternodes=0
count_yes_masternodes=0
count_no_masternodes=0
count_abstain_masternodes=0
count_evonodes=0
count_yes_evonodes=0
count_no_evonodes=0
count_abstain_evonodes=0
# Process each line of the content
# Assuming each line contains a key-value pair separated by colon ':'
while IFS=':",' read -r a b c d e f g h i j k l; do
# $g is yes, no, abstain
# $h is funding, delete, etc
# $i is 1 or 4.
# Update the counters
[[ $h$i == "funding1" ]] && ((count_masternodes++))
[[ $g$h$i == "yesfunding1" ]] && ((count_yes_masternodes++))
[[ $g$h$i == "nofunding1" ]] && ((count_no_masternodes++))
[[ $g$h$i == "abstainfunding1" ]] && ((count_abstain_masternodes++))
[[ $h$i == "funding4" ]] && ((count_evonodes++))
[[ $g$h$i == "yesfunding4" ]] && ((count_yes_evonodes++))
[[ $g$h$i == "nofunding4" ]] && ((count_no_evonodes++))
[[ $g$h$i == "abstainfunding4" ]] && ((count_abstain_evonodes++))
done <<< "$output"
# Adjust the total counts to subtract no votes
net_yes_mn=$((count_yes_masternodes-count_no_masternodes))
percent_yes_mn=$(bc<<<"scale=2;$net_yes_mn/$count_masternodes*100")
# Calculate percentages
net_yes_emn=$((count_yes_evonodes-count_no_evonodes))
percent_yes_emn=$(printf '%.2f' $(bc<<<"scale=4;$net_yes_emn/$count_evonodes*100"))
# Print the counts
echo -e "${CYAN}Total count of voted Masternodes : $count_masternodes${NC}"
echo
echo -e " - ${GREEN}Yes: $count_yes_masternodes${NC}"
echo -e " - ${GREEN}No: $count_no_masternodes${NC}"
echo -e " - ${GREEN}Abstain: $count_abstain_masternodes${NC}"
echo -e " - ${GREEN}Net Yes / super vote majority : $net_yes_mn ($percent_yes_mn%)${NC}"
echo
echo -e "${CYAN}Total count of voted Evonodes : $count_evonodes${NC}"
echo
echo -e " - ${GREEN}Yes: $count_yes_evonodes${NC}"
echo -e " - ${GREEN}No: $count_no_evonodes${NC}"
echo -e " - ${GREEN}Abstain: $count_abstain_evonodes${NC}"
echo -e " - ${GREEN}Net Yes / super vote majority : $net_yes_emn ($percent_yes_emn%)${NC}"
echo
Simple Majority ruling on DCG decision proposals (yes votes compared to total number of yes+no)
Example : DCG Evo Accelerated Release Schedule
Bash:
#!/bin/bash
# Define color codes
ORANGE='\033[0;33m'
CYAN='\033[0;36m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# Use dash-cli if working, else assume dashmate is to be used
if dash-cli -version >/dev/null 2>&1; then
output=$(dash-cli gobject getcurrentvotes 615d8a6d4edafdcee65ff16ab9c7bacef6f5d1b1096466c0957f0441287dcc90)
else
output=$(dashmate core cli "gobject getcurrentvotes 615d8a6d4edafdcee65ff16ab9c7bacef6f5d1b1096466c0957f0441287dcc90")
fi
# Show the output on screen
echo -e "${ORANGE}Output:${NC}\n${ORANGE}$output${NC}"
echo
echo -e "${ORANGE}Evonodes have a multiplier of 4 on their votes, this script does not take that into account during counting of Evonodes votes.${NC}"
echo -e "${ORANGE}Having a multiplier of 4 on votes, does not change the simple vote majority percentage for Evonodes.${NC}"
echo
# Initialize counters
count_masternodes=0
count_yes_masternodes=0
count_no_masternodes=0
count_abstain_masternodes=0
count_evonodes=0
count_yes_evonodes=0
count_no_evonodes=0
count_abstain_evonodes=0
# Process each line of the content
# Assuming each line contains a key-value pair separated by colon ':'
while IFS=':",' read -r a b c d e f g h i j k l; do
# $g is yes, no, abstain
# $h is funding, delete, etc
# $i is 1 or 4.
# Check update the counters
[[ $h$i == "funding1" ]] && ((count_masternodes++))
[[ $g$h$i == "yesfunding1" ]] && ((count_yes_masternodes++))
[[ $g$h$i == "nofunding1" ]] && ((count_no_masternodes++))
[[ $g$h$i == "abstainfunding1" ]] && ((count_abstain_masternodes++))
[[ $h$i == "funding4" ]] && ((count_evonodes++))
[[ $g$h$i == "yesfunding4" ]] && ((count_yes_evonodes++))
[[ $g$h$i == "nofunding4" ]] && ((count_no_evonodes++))
[[ $g$h$i == "abstainfunding4" ]] && ((count_abstain_evonodes++))
done <<< "$output"
# Adjust the total counts to subtract abstain votes
actual_count_masternodes=$((count_masternodes - count_abstain_masternodes))
actual_count_evonodes=$((count_evonodes - count_abstain_evonodes))
# Calculate percentages
percent_yes_mn=$(printf '%.2f' $(bc<<<"scale=4;$count_yes_masternodes/$actual_count_masternodes*100"))
percent_yes_emn=$(printf '%.2f' $(bc<<<"scale=4;$count_yes_evonodes/$actual_count_evonodes*100"))
# Print the counts
echo -e "${CYAN}Total count of voted Masternodes : $actual_count_masternodes${NC}"
echo
echo -e " - ${GREEN}Yes: $count_yes_masternodes (simple vote majority : $percent_yes_mn%)${NC}"
echo -e " - ${GREEN}No: $count_no_masternodes${NC}"
echo -e " - ${GREEN}Abstain: $count_abstain_masternodes${NC}"
echo
echo -e "${CYAN}Total count of voted Evonodes : $actual_count_evonodes${NC}"
echo
echo -e " - ${GREEN}Yes: $count_yes_evonodes (simple vote majority : $percent_yes_emn%)${NC}"
echo -e " - ${GREEN}No: $count_no_evonodes${NC}"
echo -e " - ${GREEN}Abstain: $count_abstain_evonodes${NC}"
echo
Step 3 : Save as votes.txt
Step 4 : Rename to votes.sh
Step 5 : Transfer this file to your Ubuntu home directory (i use WinSCP for this)
Step 6 : chmod +x votes.sh
Step 7 : dos2unix votes.sh
(if dos2unix not installed, then install through sudo apt-get install dos2unix but on my Ubuntu system it was already installed)
Step 8 : ./votes.sh
'./votes.sh' command can now be used to fetch the votes (yes, no, abstain) of both Masternodes and Evonodes on a specific proposal
Use dashmate core cli "gobject list all" (dashmate users) or dash-cli gobject list all (other users) to see the proposal hashes of all hashes of active proposals in the budget sytem and replace the hash in '# Use dash-cli if working, else assume a dashmate is to be used' in above shell script, if you want to check this on a different proposal.
Edit : credits to xkcd, who provided me with a better version of the code (already integrated on this post), one that is also compatible to both dashmate users and other users and does not need logging.
Last edited: