Skip to content

dd6465-3/FHE_to_ZKP_Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FHE to ZKP Compiler

The FHE to ZKP Compiler is a powerful tool designed to transform Fully Homomorphic Encryption (FHE) computations into streamlined Zero-Knowledge Proofs (ZKPs). This innovative solution, driven by Zama's Fully Homomorphic Encryption technology, bridges the gap between complex privacy-preserving computations and efficient on-chain verification.

Why This Matters

In an era where data privacy is paramount, traditional methods of verifying complex computational results on the blockchain can be cumbersome and expose sensitive information. Existing solutions often require users to compromise on either verification efficiency or the confidentiality of their data. The absence of a tool that seamlessly converts FHE computations into ZKPs creates a bottleneck for developers aiming to build sophisticated privacy-focused applications.

The Power of FHE

Zama's Fully Homomorphic Encryption technology offers a robust solution to these challenges. By allowing computations to be executed on encrypted data without needing to decrypt it first, FHE preserves the confidentiality of sensitive information. Our FHE to ZKP Compiler leverages Zama’s open-source libraries such as Concrete, TFHE-rs, and the zama-fhe SDK to efficiently generate ZKPs from FHE computations, enabling fast and secure verification on the blockchain while maintaining user privacy.

Key Features

  • FHE to ZKP Conversion: Automatically converts FHE computations into efficient ZKP circuits, ensuring that complex calculations remain private while being verifiable.

  • Cost-Effective Verification: Significantly reduces on-chain verification costs, making it an essential technology for combining FHE with blockchain solutions.

  • Developer-Friendly Interface: Designed as a command-line tool and API, it facilitates easy integration into existing development workflows.

  • Cryptographic Backbone: Utilizes state-of-the-art cryptographic methods from the Zama ecosystem, empowering developers to create more complex privacy applications on-chain.

Technology Stack

  • Zama SDK: Central component for confidential computing.
  • Concrete: For homomorphic encryption operations.
  • TFHE-rs: For bootstrapping and complex computations.
  • Node.js: JavaScript runtime for executing server-side code.
  • Hardhat/Foundry: Development environments for smart contracts.

Directory Structure

Here's an overview of the project structure to help you navigate the components:

FHE_to_ZKP_Compiler/
│
├── src/
│   ├── compiler/
│   │   ├── FHE_to_ZKP_Converter.sol
│   │   └── utilities.js
│   └── main.js
│
├── tests/
│   ├── test_fhe_to_zkp.js
│   └── example_test.js
│
├── package.json
├── README.md
└── .gitignore

Getting Started

Prerequisites

Before you start, ensure you have the following installed on your machine:

  • Node.js (version 14 or above)
  • Hardhat or Foundry for running tests and deploying contracts

Installation Steps

  1. Download the Project: Make sure you have acquired the source code for the FHE to ZKP Compiler.

  2. Navigate to the Project Directory: Open your terminal and go into the project folder.

  3. Install Dependencies: Run the following command to install the required libraries and dependencies, including Zama's libraries:

    npm install

Building and Running

After you have set up your environment, you can build and execute the project. Use the following commands:

  • Compile Contracts: To compile the smart contracts, execute:

    npx hardhat compile
  • Run Tests: To ensure everything works correctly, run the tests provided in the repository:

    npx hardhat test
  • Execute Main Program: To run the main program, use the command:

    node src/main.js

Sample Code

Here’s a quick code snippet demonstrating how to utilize the FHE to ZKP Compiler to convert a simple FHE operation into a ZKP:

const { compileFHE } = require('./compiler/FHE_to_ZKP_Converter');

async function runExample() {
    const fheComputation = '...'; // Your FHE computation here
    try {
        const zkpCircuit = await compileFHE(fheComputation);
        console.log('Generated ZKP Circuit:', zkpCircuit);
    } catch (error) {
        console.error('Error during conversion:', error);
    }
}

runExample();

Acknowledgements

Powered by Zama

We extend our sincere gratitude to the Zama team for their pioneering contributions to the realm of privacy-preserving technologies. Their commitment to open-source tools makes it possible for developers to build confidential blockchain applications seamlessly. Thanks to their innovative work, the FHE to ZKP Compiler stands as a testament to the power of combining advanced cryptographic techniques with blockchain technology.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published