• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Pre-Proposal: Would you like to be able to vote with number? (v2)

Would you like to be able to cast votes using numbers and extract the results as an average?


  • Total voters
    6
Will the masternodes ever be able to escape the animal level they are currently on, become humans and vote the numbers?


Creatures kissing in the rain
Shepherds in the dark again
In the hanging garden, change the past
In the hanging garden, wearing furs and masks

"Here is wisdom, and whoever has a mind in him, let him vote the number of the beast, for it is the number of a human."
 
Last edited:
New version 4 of the code that calculates the BASE3 results. It removes the POSE_BANNED masternodes from the electorate.

It is only compatible with dashd v20 (I renamed the "grep HighPerformance$" command to "grep Evo$" as required by the v20 specs).

For backwards compatibility, use the verson 3 of this code (just rename "Evo" back to "HighPerformance").

New version 5 of the code that calculates the BASE3 results. It fixes some bugs caused due to EVO, and has a better (non html) output .
Bash:
#!/bin/bash
#set -x
#Supports Evo Nodes -- BASE3 voting
#script's arguments: <mnowatch csvfile> <proposal for the 1st digit> <proposal for the 2nd digit>  ..... <proposal for the nth digit>
csvfile=$1
wget -q http://mnowatch.org/$csvfile
[[ -f "$csvfile" ]] || exit 1
props=`echo $@|cut -f2- -d" "`
my_awk_cmd="awk -F, '"
my_awk_cmd_2ndpart="s/\n/ /g"
my_awk_cmd_3ndpart="cut -f1"
countit=0
four=""
for fn in `echo $props`; do
#The semantic is ( NO_VOTE=0, ABSTAIN_VOTE=1 and YES_VOTE=2) and 4 when they didnt vote.
my_awk_cmd=$my_awk_cmd"\$3 ~ \"$fn\" {print \$1 \" 2\"} \$4 ~ \"$fn\" {print \$1 \" 0\"} \$5 ~ \"$fn\" {print \$1 \" 1\"} !/$fn/ {print \$1 \" 4\"} "
my_awk_cmd_2ndpart="N;"$my_awk_cmd_2ndpart
countit=`expr $countit + 2`
my_awk_cmd_3ndpart=$my_awk_cmd_3ndpart",$countit"
four=$four"4"
done
my_awk_cmd_2ndpart=`echo $my_awk_cmd_2ndpart|cut -f2- -d';'`
my_awk_cmdR="cat $csvfile|grep -v ',POSE_BANNED$'|cut -f1-10 -d,|grep Regular$|"$my_awk_cmd"'|sed '$my_awk_cmd_2ndpart'|grep -v '\" 4'|$my_awk_cmd_3ndpart -d' '|cut -f3 -d'\"'|sed -e 's/ //g'"
my_awk_cmdR_Inv="cat $csvfile|grep -v ',POSE_BANNED$'|cut -f1-10 -d,|grep Regular$|"$my_awk_cmd"'|sed '$my_awk_cmd_2ndpart'|$my_awk_cmd_3ndpart -d' '|cut -f3 -d'\"'|sed -e 's/ //g'|grep -v $four|grep 4"
my_awk_cmdH="cat $csvfile|grep -v ',POSE_BANNED$'|cut -f1-10 -d,|grep Evo$|"$my_awk_cmd"'|sed '$my_awk_cmd_2ndpart'|grep -v '\" 4'|$my_awk_cmd_3ndpart -d' '|cut -f3 -d'\"'|sed -e 's/ //g'"
my_awk_cmdH_Inv="cat $csvfile|grep -v ',POSE_BANNED$'|cut -f1-10 -d,|grep Evo$|"$my_awk_cmd"'|sed '$my_awk_cmd_2ndpart'|$my_awk_cmd_3ndpart -d' '|cut -f3 -d'\"'|sed -e 's/ //g'|grep -v $four|grep 4"
electorateR=`cat $csvfile|grep -v ',POSE_BANNED$'|cut -f1-10 -d,|grep Regular$|wc -l`
electorateH=`cat $csvfile|grep -v ',POSE_BANNED$'|cut -f1-10 -d,|grep Evo$|wc -l`
electorate=`echo "$electorateR + $electorateH*4"|bc -l`
echo "Electorate = $electorate potential votes (Regular and Evo MN)"
validvotesR=`eval $my_awk_cmdR |sort | wc -l`
invalidvotesR=`eval $my_awk_cmdR_Inv |sort | wc -l`
validvotesH=`eval $my_awk_cmdH |sort | wc -l`
invalidvotesH=`eval $my_awk_cmdH_Inv |sort | wc -l`
validvotes=`echo "$validvotesR + $validvotesH*4"|bc -l`
invalidvotes=`echo "$invalidvotesR + $invalidvotesH*4"|bc -l`
echo "Valid Votes = "$validvotes" "
participation=`echo "scale=2;((100 * $validvotes) / $electorate)" | bc -l`
echo "Valid Votes participation percentage = "$participation" % "
echo "Invalid Votes = "$invalidvotes" "
invparticipation=`echo "scale=2;((100 * $invalidvotes) / $electorate)" | bc -l`
echo "Invalid Votes participation percentage = "$invparticipation" % "
totalparticipation=`echo "$participation + $invparticipation"|bc -l`
echo "Total Voting participation ( both valid and invalid votes ) = "$totalparticipation" % "
echo "==VOTING RESULTS=="
allvotesRH=`echo $(eval $my_awk_cmdR)" "$(eval $my_awk_cmdH)" "$(eval $my_awk_cmdH)" "$(eval $my_awk_cmdH)" "$(eval $my_awk_cmdH)" -"|sed 's/\n//g'`
mostvotednum=`echo $allvotesRH|sed 's/ / \n/g'|grep -v -|sort|uniq -c|rev|sed -e 's/ /:/1'|rev|sort -t":" -k1 -nr|head -1`
mostvotednumtimes=`echo $mostvotednum|cut -f1 -d" "`
mostvoted=`echo $mostvotednum|cut -f2 -d" "|cut -f1 -d:`
participationmostvoted=`echo "scale=2;((100 * $mostvotednumtimes) / $validvotes)" | bc -l`
mostvoted10=`echo "ibase=3;$mostvoted" | bc`
echo "most Voted Number =  $mostvoted10 (or $mostvoted base3) was voted by $mostvotednumtimes votes ( $participationmostvoted % of the valid votes )"
median=`echo $allvotesRH|sed 's/ / \n/g'|grep -v -|sort|tail -n +$(((\`echo $allvotesRH|sed 's/ / \n/g'|grep -v -|sort | wc -l\` / 2) + 1)) | head -n 1` #do I have a bug here in case of odd/even number of votes?
median10=`echo "ibase=3;$median" | bc`
echo "median Average = $median10 (or $median base3)"
resunum=0
meanAverage=`echo $allvotesRH|sed 's/ / \n/g'|grep -v -|sort|uniq -c|rev|cut -f2- -d" "|sed -e 's/ /:/1'|rev|sort -t":" -k1 -nr`
for dn in `echo $meanAverage`; do
 multi=`echo $dn|cut -f1 -d:`
 numi=`echo $dn|cut -f2 -d:`
 numidec=`echo "ibase=3;$numi" | bc`
 resu=`echo "($multi * $numidec)"|bc -l`
 resunum=`expr $resunum + $resu`
done
finalavg=`echo "scale=2;( $resunum / $validvotes)" | bc -l`
echo "mean Average = "$finalavg
#echo "The Valid Votes (base3)"
#echo $allvotesRH|sed 's/ / \n/g'|grep -v -|sort

run the script as shown in the example below:
Bash:
./script.sh the_results_dashd_2024-10-03-00-52-28.html.csv encointerUBI-Digit1 encointerUBI-Digit2 encointerUBI-Range-0-242-Digit3 encointerUBI-NewRange-0-80-Digit4

...to crosscheck the results presented below:

 
Last edited:
Back
Top