Private On-Chain Transactions With Lit Protocol

Lit Privacy SDK: Overcome limitations of existing ZK proof technologies and deploy privacy solutions effortlessly for decentralized governance and more. Time and resource-efficient alternative to building zero-knowledge infrastructure from scratch.

Private On-Chain Transactions With Lit Protocol

Guest post by Mihirsinh Parmar with Curve Labs.

We are excited to announce the Lit Privacy SDK, an open-source package developed by Curve Labs, with a grant from Lit Protocol. The Lit Privacy SDK leverages Lit Actions and Programmable Key Pairs to make on-chain transactions private, based on proof of identity and proof of membership. This innovative solution aims to improve privacy in decentralized governance and other applications where privacy is crucial.


Problem Statement

The transparency inherent in blockchains can sometimes hinder privacy, especially in situations like decentralized governance where true preferences may be obscured due to fear of social disapproval. Traditional zero-knowledge technologies have limitations, especially when privacy is to be enabled for existing groups whose membership tokens or contracts are already deployed. For example, Nouns will have to build the zero knowledge infrastructure from the ground up that works with existing deployed token contracts. This requires time and resources.

The Lit Privacy SDK aims to provide a seamless user experience while preserving privacy in various contexts. Leveraging Lit Protocol’s Programmable Key Pairs and Lit Actions, the SDK provides a simple solution for developers to prove user’s group membership without revealing their identity. This is made possible through a custom proof mechanism that generates proof of identity as well as proof of membership.

Implementation Details

The implementation of the Lit Privacy SDK is divided into three main parts: Lit Actions, ProofVerifierRelayer smart contract, and the Lit Privacy SDK itself.

  • Lit Actions: Generates custom proofs for identity and membership verification, maintaining privacy.
  • ProofVerifierRelayer Smart Contract: Unbundles and verifies relayed transactions, ensuring only valid transactions are processed.
  • Lit Privacy SDK: Provides a comprehensive package that includes all the components for easy integration and customization in building applications with private transactions.

Demo: https://codebuster22.github.io/demo-lit-privacy-sdk/
How to test the demo: https://www.loom.com/share/d4c4840e7a0142359013ea14e29c0d6c

Github Repo: https://github.com/Curve-Labs/lit-privacy
NPM registry: https://www.npmjs.com/package/lit-privacy-sdk

Architecture

Lit Actions

Lit Actions are responsible for generating the custom proofs, Proof of Identity and Proof of Membership.

  • Proof of Identity: This Lit Action is used to generate a proof that verifies wallet ownership without revealing the wallet address directly. It is based on the wallet address, block number, and an application-specific public signal.
  • Proof of Membership: This Lit Action is used to generate a proof that validates whether a wallet holds a specific token or not. This allows users to prove their membership in a group or their eligibility for specific actions, such as voting in decentralized governance, while preserving their privacy.

Both Lit Actions are pinned to IPFS and assigned a unique Programmable Key Pair that generates the proof on behalf of the Lit Action.

Link to Lit Actions: https://github.com/Curve-Labs/lit-privacy/tree/main/packages/lit-actions

ProofVerifierRelayer Smart Contract

The ProofVerifierRelayer smart contract serves as an on-chain component and the entry point for relayed transactions. It is responsible for unbundling the relayed transactions and verifying the provided proofs. After the proofs are verified, the data or payload is sent to the implementation smart contract. This contract ensures that only valid transactions with verified proofs are processed and forwarded to the implementation smart contract.

Link to Smart Contract: https://github.com/Curve-Labs/lit-privacy/tree/main/packages/contracts

Lit Privacy SDK

The Lit Privacy SDK is the package developed by Curve Labs, which bundles all the components, including the Lit Actions and the ProofVerifierRelayer smart contract, into one easy-to-use package. The SDK employs a class-based architecture, allowing developers to easily extend and customize its functionality to fit their specific needs. It also packages the Lit Action invocation and relayer invocation in multiple combinations, simplifying the process of integrating the SDK into existing applications.

Link to SDK: https://github.com/Curve-Labs/lit-privacy/tree/main/packages/lit-privacy-sdk

By combining the power of Lit Protocol, custom proofs mechanisms, and a flexible, easy-to-integrate package design, the Lit Privacy SDK offers a robust solution for preserving privacy for on-chain transactions.

How to use the SDK

The Lit Privacy SDK is designed for easy integration into your application. To get started with the SDK, follow the steps below:

  • Visit our detailed documentation page to learn more about the SDK integration process.
  • Initialize the SDK, passing the necessary arguments for your specific use case.
  • Perform private actions using the SDK functions.

For a comprehensive guide on integrating the Lit Privacy SDK into your project, please visit our external documentation page. This resource provides in-depth instructions and examples to help you understand and effectively use the SDK.


Results and Impact

The Lit Privacy SDK reduces the overhead of building a whole system for generating proofs and relaying transactions to the blockchain. Users need to initialize, pass arguments, and perform private actions. This package simplifies the integration of privacy-preserving mechanisms for on-chain transactions in various applications.

Use cases

Lit Privacy SDK will be integrated with various applications. Though we are most excited to see built with this SDK are:

  1. Privacy-Preserving Voting Mechanism: The easiest to build with high impact. A voting mechanism with no peer pressure. An existing community or token (ERC20, ERC721, ERC1155) can easily integrate the Lit Privacy SDK to enable private and anonymous voting.
    Find a simple example here: https://github.com/codebuster22/demo-lit-privacy-sdk. The example repository showcases how to build a private voting mechanism for ENS holders.
  2. Private Members-only Access Control Methods: Many protocols or projects need to deploy smart contracts that give community members special privileges. To keep the identity of the executor anonymous, a new modifier can be added to the smart contract that supports transactions made through Lit Privacy SDK and allows executing member-only functions without revealing the executor's identity.

Conclusion

The Lit Privacy SDK demonstrates the power of Lit Protocol and Lit Actions in enabling privacy for on-chain transactions. Its use-case agnostic design and ease of integration makes it a valuable tool for developers looking to incorporate privacy into their blockchain applications.

About the Authors

Curve Labs
A team of mechanism designers, economists, software engineers, and researchers aspiring to develop frameworks and tooling for a decentralized socio-economic paradigm. They have extensive experience in protocol design, smart contract architecture, dApp design and development. Visit their website at curvelabs.eu and follow them on Twitter @curvelabs.

Mihirsinh Parmar
Backend Engineer, Curve Labs
With extensive experience as a full-stack developer, Mihir specializes in smart contract development and system design. Since joining Curve Labs in 2021, Mihir has designed NFT primitives, developed DeFi protocols, and worked on cross-chain solutions. He is also involved in governance research and React-based UI development. You can find him on Twitter @0xmihir and GitHub codebuster22.

Fabian Scherer
Backend Engineer, Curve Labs
After starting out in product management, Fabian transitioned into engineering in 2019 and took on his first fullstack role shortly after. He joined Curve Labs in 2021 and since then has been focusing on designing and implementing DeFi and Governance solutions. He led the specification, design and implementation of the smart contract based governance system for the Kolektivo Framework. More recently, in the context of a grant by Ceramic and Bacalhau, he developed a UI and a system of smart contracts for DAO contributors to manage their contributions and claim token rewards. He is well versed in the design and implementation of smart contract systems (including zk components) and in React-based UI development. You can find him on Twitter @fursche and GitHub fabianschu.