I want to place a zero-knowledge verifier contract on zkSync to verify some functions.

For example:

x^2 + x + 5 = 245

The answer is 15, but I don't want people to see others transactions and copy it.

function solve(uint256 x) external returns(bool){
 // pseudo code:
 if((x * x) + x + 5 == 256) {
    return true;
  return false;

I'd rather have them submit a zk proof:

function verifyProof(
        uint256[2] memory a,
        uint256[2][2] memory b,
        uint256[2] memory c,
        uint256[1] memory input
    ) public view returns (bool r) {

How would I generate such a function on zkSync?

1 Answer 1


To generate a proof, you could use a tool like hardhat-circom (however it's no longer maintained), to combine your Circom & SnarkJS workflow. You'd need to:

  1. Build a circom circuit to generate the proof
  2. Compile the circuits
  3. Generate wasm and zkey files
  4. Use those to generate and output Verifier contracts

However, doing this on zkSync as of writing right now will be challenging, if not incredibly gas expensive, due to some precompiles not existing, including:

There are plans to add this next.

You can see the differences between the EVM and zkSync in the zkSync docs here.

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.