Bank-of-JubJub / base

This repo includes the base contracts and circuits for the Bank of JubJub.
MIT License
12 stars 4 forks source link

Private-token

Token with private balances using zkSNARKs and Homomorphic Encryption, inspired by Zeestar and Zether, implemented in Noir (and Rust).

You can read the slides presenting the final project here.

Quick description

This project is an implementation of a token on Ethereum with private balances, i.e all the balances are publicly stored on the Ethereum blockchain in an encrypted format, but only the owner of an Ethereum account is able to decrypt their own balance. This is possible thanks to the improved expressiveness allowed by homomorphic encryption on top of zkSNARKs, allowing a party A to compute over encrypted data owned by another party B i.e A can add encrpyted balances owned by B without needing any knowledge of those balances.

Pros:

Cons:

Sequence Diagram:

private token sequence

The current model is the following:

After the deployment of the new Private Token, transfers between users can occur.

The Baby Jubjub private key, which corresponds to the public key, should be safeguarded diligently by each registered user. If lost, the user will no longer have access to their funds. anyone with the private key can spend funds.

Requirements

To run the tests :

Run:

cargo build --release --manifest-path circuits/exponential_elgamal/babygiant_native/Cargo.toml

to build the native library for the babygiant decryption algorithm.

Install deps at root:

yarn

Generate Solidity Verifier contracts:

nargo codegen-verifier --workspace && ./copy_verifiers.sh

Then run:

in one terminal:

npx hardhat node
cd packages/hardhat && yarn && yarn test

gate count