Giter Club home page Giter Club logo

zrclib's Introduction

zrclib ๐Ÿ”ฎ

Mission

To bring zero knowledge privacy primitives to all web3 developers.

Disclaimer

This code is unaudited and under construction. This is experimental software and is provided on an "as is" and "as available" basis and may not work at all. This code is not fit for human or AI consumption and should not be used in production.

Roadmap

  • ZRC-20 (Token & Payment)
  • ZRC-1155 (Payment / Swap / NFTS / Airdrops)
  • Defi Swaps
  • Defiant Pools Prototype (Zero Knowledge Deposit Addresses pt I)
  • Refactor to groth16
  • Implement encrypted store in indexDB
  • Test that utxo store recovers from partial hydration

Future goals

  • Deposit via proof of deposit (Requires TX proving in Zero Knowledge - possibly with Nova / Halo)
  • Withdrawal via threshold network
  • Refactor and redesign of API
  • CLI creation

Prerequisites

  • pnpm (8.2.0+)
  • circom (2.1.5+)
  • b2sum (8.3.2+)

Install dependencies

pnpm install

Run tests

pnpm test
  • Run integration tests

Build project

pnpm build
  • Build circuit artifacts
  • Bundle all keys encoded to json files

Run wallet example

pnpm wallet
  • run the wallet application

API

// Get the standard ethers contract
const token = await ethers.Contract(address, abi, signer);

const account = Account.create(token, "password123");
await account.loginWithEthersSigner(signer);

expect(account.isLoggedIn()).toBe(true);

// Generate proof that shields 1 token
// Call the deposit method on the contract which will
// call `transferFrom` to spend 1 of your ERC-20 tokens and
// commit the transaction. If the transfer fails the transaction will fail
const shieldProof = await account.proveShield(1e18);
await token.deposit(shieldProof);

// Generate proof that sends 0.5 tokens to toAddress
const transferProof = await account.proveTransfer(5e17, receiver);

// Call the transfer method on the contract which will
// verify and commit the transaction
await token.transfer(transferProof);

// Generate proof that burns 0.5 tokens to the receiver address
const unshieldProof = await account.proveUnshield(5e17, receiver);

// Call the withdraw method on the contract which will
// call `transferFrom` to return 0.5 of your ERC-20 tokens to your public account
await token.withdraw(unshieldProof);

zrclib's People

Contributors

ryardley avatar eerkaijun avatar p0n1 avatar hugo0 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.