Skip to content

lincot/solana-anonymous-voting

Repository files navigation

anonymous bribery-resistant voting on Solana

first off

pnpm install

compiling the circuits

For things to work, replace Poseidon with PoseidonHasher in node_modules/.pnpm/[email protected]/node_modules/circomlib/circuits/smt/smthash_poseidon.circom and remove ../poseidon.circom import.

pnpm circomkit compile Vote && pnpm circomkit setup Vote
pnpm circomkit compile Tally && pnpm circomkit setup Tally
pnpm circomkit compile Relay && pnpm circomkit setup Relay

Export verifying key (to put in programs/anon-vote/src/vk.rs and programs/zk-relayer/src/vk.rs)

pnpm exportVk

testing

anchor test

or with the indexer:

openssl req -x509 -newkey rsa:4096 -nodes -keyout key.pem -out cert.pem -days 365 -subj '/CN=localhost'
anchor build
solana-test-validator \
  --reset \
  --warp-slot 32 \
  --deactivate-feature 9LZdXeKGeBV6hRLdxS1rHbHoEUsKqesCC2ZAPTPKJAbK \
  --bpf-program target/deploy/anon_vote-keypair.json target/deploy/anon_vote.so \
  --bpf-program target/deploy/zk_relayer-keypair.json target/deploy/zk_relayer.so

cargo run --package anon-vote-indexer -- --config indexer/config.yml

anchor test --skip-local-validator --skip-deploy

About

anonymous, bribery-resistant voting on Solana using zkSNARKs

Resources

License

Stars

Watchers

Forks