Bash Script to Find A Poll's % of AVW

in Gridcoin (GRC)3 years ago

Background

Active Vote Weight (AVW) is an estimate of what amount of vote weight would come from users active on the network if they all voted.

For a poll to be validated, it must get a certain % of AVW to have voted on that poll. For whitelist polls that's 40%, for others it's less. If a poll fails to reach the required number, its results don't matter and its as if it never happened. See the voting wiki page for more information.

The Bash Script

I've created a bash script that uses the wallets RPC command to find the % of AVW for any Gridcoin poll made after 5.0.0 (i.e v2 polls).

I've put it on this GitHub Gist if you want to run it or look at it

Let me know if you are interested in a cross-platform Python version and if you run into any issues in the script

Things to Note About the Script

  • It runs only through Bash which means Windows users are out of luck for now.
    • If there's enough demand, I may create a cross-platform Python version

  • You need to allow RPC commands in your wallet
    • If you haven't already add the following lines to your config (make sure to replace the things in <> with values):
      • server=1
      • rpcallowip=127.0.0.1
      • rpcuser=<A Username for RPC>
      • pcpassword=<A GOOD Password for RPC>

  • It disagrees with gridcoinstats.eu's numbers which is being looked into
    • I believe gridcoinstats.eu's numbers may be at issue, but this could also mean there is some error in this program that I'm missing

  • It's slow and not well optimized. If you are running on a hard drive and not an SSD this will be very slow

  • You will need to install jq and bc and gridcoinresearchd if you don't already have those installed to run it

  • Make sure your wallet is synced if you are looking at a currently running poll or synced up to the end date of the poll if its ended


Example Output

(from the current SiDock@Home Poll)

bash-script-demo.png