Skip to content

critesjosh/past-my-shades

Repository files navigation

Can't see past my shades

A privacy suite of products built for the EVM.

  • Private Fundraising
  • Sealed bid auctions
  • Private voting

Leverages zk-snarks written in Noir and this nifty El Gamal library for homomorphic addition.

This application is built on the Bank of Jubjub private payments protocol.

How it works

  • An private app contract is deployed to an EVM blockchain. Users can use any ERC20 token with the bank of jubjub protocol, and by extension, any of these private app contracts.
  • Users lock their bank of jubjub account to the private app contract
  • Users can interact with the private app contract, defined by the logic specified in the specific private app contract (vote, contribute, bid)
  • Once the vote/contribution/bidding period has ended or the user removed themselves from participation, they can unlock their bank of jubjub account from the private application contract

Features

Private Fundraising

  • Raise money without revealing how much is raised
  • Only collect funds from donees if the fundraiser threshold was reached
  • Fund raise private amounts to accounts controlled by multisig accounts (e.g. Gnosis Safe)

Contracts

Circuits

  • correct_addition - contributors use this circuit to enforce correctness of adding their encrypted contribution to the fundraiser
  • correct_encrypted_zero - the fundraiser creator uses this to enforce correctness of setting the initial encrypted value (0) of the fundraiser
  • met_threshold - the fundraiser manager uses this circuit to enforce correctness of checking if the fundraiser has met the threshold
  • revoke_contribution - contributors use this circuit to revoke their contribution to the fundraiser

Sealed bid auctions

  • Bid on NFTs without revealing how much you bid
  • Bids can be private, coming from the Bank of Jubjub protocol, or public coming from Arbitrum/Base or other blockchains

Contracts

Circuits

  • consolidate_bids
    • used by the auction manager to reduce the list of private bids to the single, highest bid
  • private_bid_greater
    • used by the auction manager to indicate whether the top private bid or top public bid is higher without revealing the value of the top private bid

Private voting

Vote on proposals without revealing how you voted. Votes are encrypted to a vote manager. The vote manager is responsible for processing the result of the vote when the voting period has ended. The vote manager account can be controlled by multiple parties or a multisig to reduce the risk of a griefing attack. Note that anyone with the vote manager private key will be able to decrypt the vote totals, but will not be able to alter the outcome of the vote.

Vote structs include a destination contract and bytecode to be executed when a vote is passed. This bytecode can include:

  • instructions to a bridging protocol to execute code on other chains
  • bidding on a private NFT auction (or any purchase/sale)
  • sending funds to a private crowdfunding fundraiser
  • transferring funds from a DAO treasury

Contracts

Circuits

  • check_vote
    • checks that a vote has correctly encrypted yay and nay votes to the vote manager
    • checks that the vote has the corresponding private key. checks that
    • checks that the voter does not vote with more than their token balance
  • process_votes
    • checks if yay or nay received more votes, without revealing the vote totals
    • valid proofs can only be generated by the vote manager
  • correct_zero
    • checks that the initial encrypted 0 value is correct
    • same circuit as used in the fundraiser

Deployments

Sepolia

All contracts deployed by this account:

https://sepolia.etherscan.io/address/0x353654e70272693bf8916372b4e7cf3dccacde9f

Arbitrum Sepolia

All contracts deployed by this account:

https://sepolia.arbiscan.io/address/0x353654e70272693bf8916372b4e7cf3dccacde9f

Base Sepolia

All contracts deployed by this account:

https://sepolia.basescan.org/address/0x353654e70272693bf8916372b4e7cf3dccacde9f

About

private fundraising, sealed bid auction, private voting app - Eth denver 2024 hackathon project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published