Skip to content

Commit

Permalink
cli-demo folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Akilesh Tangella committed Jun 14, 2023
1 parent a0bad7a commit f412436
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,51 +49,51 @@ KEYFILE_PASSWORD = abc123

Create 4 keyfiles with the following commands:
```sh
yarn ts-node scripts/encrypt_private_key.ts ./demo/signer_private_key.txt -p abc123 -k signer.keyfile.json
yarn ts-node scripts/encrypt_private_key.ts ./cli-demo/signer_private_key.txt -p abc123 -k ./cli-demo/signer.keyfile.json

yarn ts-node scripts/encrypt_private_key.ts ./demo/alice_private_key.txt -p abc123 -k alice.keyfile.json
yarn ts-node scripts/encrypt_private_key.ts ./cli-demo/alice_private_key.txt -p abc123 -k ./cli-demo/alice.keyfile.json

yarn ts-node scripts/encrypt_private_key.ts ./demo/bob_private_key.txt -p abc123 -k bob.keyfile.json
yarn ts-node scripts/encrypt_private_key.ts ./cli-demo/bob_private_key.txt -p abc123 -k ./cli-demo/bob.keyfile.json

yarn ts-node scripts/encrypt_private_key.ts ./demo/carol_private_key.txt -p abc123 -k carol.keyfile.json
yarn ts-node scripts/encrypt_private_key.ts ./cli-demo/carol_private_key.txt -p abc123 -k ./cli-demo/carol.keyfile.json
```

Deploy the contracts and write the configuration to files `nouns.config.json`, `zkv.config.json`, `dkg.config.json`.
These files are read by later commands to connect to the contract.

```console
$ yarn ts-node scripts/deploy_dkg_zkvote.ts signer.keyfile.json ./demo/committee_file_demo.json
$ yarn ts-node scripts/deploy_dummy_nouns.ts signer.keyfile.json
$ yarn ts-node scripts/deploy_dkg_zkvote.ts ./cli-demo/signer.keyfile.json ./cli-demo/committee_file_demo.json
$ yarn ts-node scripts/deploy_dummy_nouns.ts ./cli-demo/signer.keyfile.json
```

Launch 3 committee daemons (each in it's own terminal, as the process will not
terminate until votes are tallied). For demo purposes, we set the tally to be
triggered when the total voting weight reaches 10. Alternatively, it can be run with no `-v` flag and only committee member number parameter. In this case, tally will trigger when `endBlock` is reached.

```sh
yarn ts-node scripts/committee.ts alice.keyfile.json -v 10
yarn ts-node scripts/committee.ts ./cli-demo/alice.keyfile.json -v 10
```
```sh
yarn ts-node scripts/committee.ts bob.keyfile.json -v 10
yarn ts-node scripts/committee.ts ./cli-demo/bob.keyfile.json -v 10
```
```sh
yarn ts-node scripts/committee.ts carol.keyfile.json -v 10
yarn ts-node scripts/committee.ts ./cli-demo/carol.keyfile.json -v 10
```

In a new terminal, setup a vote with proposal Id 1 and end block 1234, register some dummy voters and cast votes up to a total voting weight above 10
(max total voting weight is 20). For example:
```sh
yarn ts-node scripts/setup_vote.ts 1 1234 signer.keyfile.json
yarn ts-node scripts/setup_vote.ts 1 1234 ./cli-demo/signer.keyfile.json
```

```sh
yarn ts-node scripts/vote.ts 1 yay 6 alice.keyfile.json
yarn ts-node scripts/vote.ts 1 yay 6 ./cli-demo/alice.keyfile.json
```
```sh
yarn ts-node scripts/vote.ts 1 nay 3 bob.keyfile.json
yarn ts-node scripts/vote.ts 1 nay 3 ./cli-demo/bob.keyfile.json
```
```sh
yarn ts-node scripts/vote.ts 1 yay 5 carol.keyfile.json
yarn ts-node scripts/vote.ts 1 yay 5 ./cli-demo/carol.keyfile.json
```

When the committee commands notice that the total voting weight used is at
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f412436

Please sign in to comment.