1

This is a simple smart contract I found in the internet for a zero knowledge applications.

But there is no libs imported.

What is the best lib to use in this situation? Can openzeppelin solve this problem?

pragma solidity ^0.6.0;

// Smart contract for a zero knowledge application
contract ZeroKnowledge {
    // The proving key for the zero knowledge proof
    ProvingKey public provingKey;
    // The verifier contract for the zero knowledge proof
    Verifier public verifier;

    // Constructor to initialize the smart contract with the proving key and verifier
    constructor(ProvingKey _provingKey, Verifier _verifier) public {
        provingKey = _provingKey;
        verifier = _verifier;
    }

    // Function to allow users to submit a zero knowledge proof
    function submitProof(uint[] memory proof) public {
        require(verifier.verifyProof(proof, provingKey.pk()));
        // Perform some action based on the successful verification of the proof
    }
}
1
  • The question is too broad. Do you have something in mind, a particular use case?
    – Ismael
    Commented Jan 12, 2023 at 2:29

1 Answer 1

1

I wouldn't look to someone like OZ for these kinds of solutions, since their work is directed towards Etheruem itself, and not ZK/L2 rollups per sé.

Check here for a guide which I used to better my knowledge of ZK, including some fun tutorials, and to break into the popular gnark ZK library from Concensys.

Hope that helps :)

1
  • Thank you @XaEk for helping me! Commented Jan 9, 2023 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.