Skip to content

Commit

Permalink
update documentation with new commands for votes tallying
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Apr 3, 2024
1 parent 2a8fa90 commit 83023b7
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions docs/tally-verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,34 @@ WALLET_MNEMONIC=
WALLET_PRIVATE_KEY
```

Decrypt messages and tally the votes:
Decrypt messages, tally the votes and generate proofs:

```
yarn hardhat tally --rapidsnark {RAPID_SNARK} --output-dir {OUTPUT_DIR} --network {network}
yarn hardhat gen-proofs --clrfund {CLRFUND_CONTRACT_ADDRESS} --maci-tx-hash {MACI_CREATION_TRANSACTION_HASH} --proof-dir {OUTPUT_DIR} --rapidsnark {RAPID_SNARK} --network {network}
```

You only need to provide `--rapidsnark` if you are running the `tally` command on an intel chip.
If `gen-proofs` failed, you can rerun the command with the same parameters. If the maci-state.json file has been created, you can skip fetching MACI logs by providing the MACI state file as follow:

If there's error and the tally task was stopped prematurely, it can be resumed by passing 2 additional parameters, '--tally-file' and/or '--maci-state-file', if the files were generated.
```
yarn hardhat gen-proofs --clrfund {CLRFUND_CONTRACT_ADDRESS} --maci-state-file {MACI_STATE_FILE_PATH} --proof-dir {OUTPUT_DIR} --rapidsnark {RAPID_SNARK} --network {network}
```


** Make a backup of the {OUTPUT_DIR} before continuing to the next step **


Upload the proofs on chain:
```
# for rerun
yarn hardhat tally --maci-state-file {maci-state.json} --tally-file {tally.json} --output-dir {OUTPUT_DIR} --network {network}
yarn hardhat prove-on-chain --clrfund {CLRFUND_CONTRACT_ADDRESS} --proof-dir {OUTPUT_DIR} --network {network}
yarn hardhat publish-tally-results --clrfund {CLRFUND_CONTRACT_ADDRESS} --proof-dir {OUTPUT_DIR} --network localhost
```

Result will be saved to `tally.json` file, which must then be published via IPFS.
If there's error running `prove-on-chain` or `publish-tally-resuls`, simply rerun the commands with the same parameters.



Result will be saved to `{OUTPUT_DIR}/tally.json` file, which must then be published via IPFS.

**Using [command line](https://docs.ipfs.tech/reference/kubo/cli/#ipfs)**

Expand Down

0 comments on commit 83023b7

Please sign in to comment.