- Crypto / Web3
Open Source SDK For Developers to Easily Build Private DeFi Applications
Problem that ZRCLib solves
In the blockchain world, privacy, interoperability, and ease of development are significant challenges. ZRCLib, a robust Software Development Kit (SDK), addresses these issues by offering zero-knowledge privacy primitives for developers on Ethereum Virtual Machine (EVM) compatible chains. With ZRCLib, developers only need a few lines of code to build private DeFi primitives such as private transfer and private swap, without needing prior knowledge on ZK, as seen on example below (more details in the README in Github).
// Get the standard ethers contract const token = await ethers.Contract(address, abi, signer); const account = Account.create(token, "password123"); await account.loginWithEthersSigner(signer); // Generate proof that shields 1 token 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); await token.tranfer(transferProof);
ZRCLib currently supports a few features as described below.
Multi-Asset Shielded Pool: This feature adds an extra privacy layer for all tokens by hiding the sender, receiver, transaction amount, and asset type during internal transfers. It supports a wide array of token types like ERC20, ERC721, and ERC1155 at the circuit level, increasing the interoperability of the system and anonymity set, therefore also suitable for long-tailed assets.
Privacy-protected Swaps: ZRCLib provides a mechanism for executing asset swaps while maintaining the utmost privacy and avoiding liquidity bootstrapping issues. It achieves this by following the Un-shield -> ExecSwap -> Re-shield flow, making it a valuable tool for privacy-focused DeFi. With this mechanism, users can swap tokens within the shielded pool in one single transaction, and not losing privacy.
SDK API Design: ZRCLib is developer-friendly, providing a well-designed API and abstracting the complexity of zero-knowledge proof mechanics. This makes it easier for developers to integrate privacy features into their blockchain applications.
To illustrate how the SDK can be used, we built a few examples - a decentralized private stablecoin and a wallet that allow users to do private deposits, transfers and swaps (located in the "examples" directory in the repository). The demo video shown is the private wallet.
Kai - Smart contract developer, built the solidity SDK and smart contracts of private DeFi examples (stablecoin and private wallet). Have been developing in DeFi for 3 years
Rudy - Typescript guru, built the Typescript SDK for client side proof generation and UTXO management, also built the frontend of private DeFi examples. 20 years of experience as a full stack developer
ZP - Zero knowledge circuit engineer, built the ZK circuits for doing private deposit, transfer and swap. Experienced smart contract auditor.