Skip to main content

Creation of a Market

As mentioned earlier, Market Creators are responsible for creation of markets. New Markets are required when an existing Market is not suitable for generating proofs for a certain circuit (that is, the app uses a whole new circuit that no other app on Kalypso uses) or when parameters like slashing rates or minimum stake are to be updated to meet a new range of guarantees.

Prerequisite artifacts

In order to create a Market, the Creator needs to have the following artifacts:

  1. Proof Verifier: Typically, a circuit-specific contract that can be generated using tooling associated with the proving system. The Proof Verifier is required to be deployed by the Creator on the Blockchain.

    In cases where the proof can’t be verified in Solidity due to gas constraints or otherwise, the Creator can create an enclave image of the verifier logic and deploy it on a AWS Nitro Enclave or Oyster Node. The Proof Verifier in such cases is a Solidity contract that simply verifies signed responses from the enclave.

  2. Proof Verification Image (only required when proofs can’t be verified on-chain): Creators need to make an authorized Proof Verification Image available to Generators so that they can request attestations to validate their proofs when it is impossible or expensive to verify proofs on the Blockchain.

  3. Input Verifier: In order to prevent Generators from being wrongfully slashed by being given Tasks where no proof can be generated for given inputs, Creators are required to provide a set of conditions that inputs should satisfy.

    Similar to the Proof Verifier, the Input Verifier is a Solidity contract that contains the verification logic itself (may work when inputs are public), or verifies signed responses from a AWS Nitro Enclave compatible enclave containing the verification logic (required when inputs are private and may also be required for public inputs to reduce gas costs). In order to decrypt private inputs, enclaves can query the relevant API exposed by the Matching Engine.

  4. Input Verification Image (only required for public inputs that can’t be verified on-chain): Contains logic to check the validity of inputs and attest to inputs being impossible to generate proofs for.

  5. Sample Prover (optional): A reference implementation of a prover that can generate valid proofs for the Market being created.

  6. Generator Image (only required when the Market being created supports private inputs): In order to prevent Generators from leaking private inputs shared with them, they are required to run a standard sandboxed image which sets protocols on how private inputs are communicated and decrypted. The Generator can still optimize the prover by plugging his own implementation while maintaining the wrapper template provided.

  7. Benchmarking Tools (optional): Generators provide pricing information and their expectations of time it would take them to generate proofs when joining a Market. To aid this process, Creators can share benchmarking tools that provide Generators with the necessary metrics.

Prerequisite parameters

In addition to the aforementioned files, Creators should determine the value of SlashingPenalty before proceeding with creation of a new Market. The value should take into consideration the preferences of Proof Requesters who will be placing Requests in that Market. It should account for the cost of attack or withholding proofs, and the opportunity cost faced by Requesters due to delays in receiving the proof.

Creating the Market

With the above files and parameters, Creators can make relevant function calls to the Kalypso Smart Contracts to create a new market.

If the circuit corresponding to the Market supports private inputs, the Creator sets the Generator Image field to a non-null value ensuring that Generators run their Prover inside the authorized Generator Image when registering in the Market.

Similarly, for public inputs that can’t be verified on-chain, the Creators sets the Input Verification Image to a non-null value ensuring that Generators can prove to the Input Verifier Smart Contracts that an authorized Input Verification Image approved their claim of inputs being invalid.