Skip to main content

Solidity-based

If Solidity-based proof verification contract can be written for a proving scheme, it can be directly used with Kalypso. The contract must implement the Standard Kalypso Verifier interface.

IVerifier.sol
    // SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IVerifier {
function verify(bytes calldata encodedPublicInputsAndProofs) external view returns (bool);

function verifyInputs(bytes calldata inputs) external view returns (bool);

function sampleInput() external view returns (bytes memory);

function sampleProof() external view returns (bytes memory);

function verifyAgainstSampleInputs(bytes memory proof) external view returns (bool);

function checkSampleInputsAndProof() external view returns (bool);
}
  • function verify(bytes calldata encodedPublicInputsAndProofs) is used by Kalypso's core contracts to settle the escrow between the Proof Requester and Generator.
  • function verifyInputs(bytes calldata inputs) check the syntax of public inputs. If you wish to skip this check, just return true in the function definition.
    solidity_verifier.sol

    function verifyInputs(bytes calldata inputs) external view returns(bool) {
    return true;
    }
  • function sampleInput() returns sample inputs. This is used by the Generator to test their setup before joining the Market.
  • function sampleProof() return the proof corresponding to sampleInputs().
  • function checkSampleInputsAndProof() verifies the validity of sampleProof() against sampleInputs(). This is verified when the Market is created.
  • function verifyAgainstSampleInputs(bytes memory proof) is used by Generators to check whether their setup is able to produce proofs for sampleInputs().

The linked directory contains a few examples of how to structure solidity_verifier.sol.

Once done, you can deploy solidity_verifier.sol using Remix or any other tool of your choice.