Skip to content

Commit

Permalink
docs: Create tally docs | NPG-000 (#582)
Browse files Browse the repository at this point in the history
# Description

Adding tally script docs

---------

Co-authored-by: Oleksandr Prokhorenko <[email protected]>
  • Loading branch information
kukkok3 and minikin authored Oct 4, 2023
1 parent c2c0c82 commit 83748f0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/tally/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# How to use tally script
### Offline
To run the offline tally script we need the committe key and the `active_plans.json` (voteplans encrypted file) to be in the folder where the script is executed. The committee key is generated by the vitup tool together with the other backend artifacts, the `active_plans.json` can be retrived from the api with `curl https://{url}/api/v0/vote/active/plans > active_plans.json` after vote ended. Also we need the jcli tool to be installed. We can then run the script passing the voteplan id of the voteplan we want to decrypt `./private_offline.sh 9a278b6f788278e5cd8dfd6de8b8b8699a7f6b4847c680843de6c02d5b3169b2`


### Online
To run the online tally script we need the committe key to be in the folder where the script is executed. We need to set the env variable `JORMUNGANDR_RESTAPI_URL` in the script. Also we need the jcli tool to be installed. We can then run the script passing the voteplan index of the voteplan we want to decrypt and the expiry block date. The expiry block date is obtained taking the field `"lastBlockDate"` from the response of `https://{url}/api/v0/node/stats` and rounding that up. So if `"lastBlockDate": "25.779"` the script would be called like `./private.sh 0 26.0`
The online tally script needs to be runned after voting ends and before tally time ends. The script will post the decrypted result back to the node as a transaction and it will appear in the `https://{url}/api/v0/vote/active/plans`

0 comments on commit 83748f0

Please sign in to comment.