Task
This section explains how Tasks and Markets are managed internally.
Task Book Structure
When a request is created on-chain, the Matching Engine (ME) indexes it and stores it in its memory as cache for faster assignment to provers. The task book is a data structure that stores tasks, which are matched orders generated by the matching engine. It serves as a unified repository for task management, providing essential information about task status. The following data is stored in the Matching Engine's enclave memory:
[
{
"assignmentDeadline": 100,
"deadline": 1000,
"reward": "1000 USDC",
"publicInputs": [...],
"privateInputs": [...],
},...
]
- assignmentDeadline: Number of blocks within which the matching engine should assign the task to a generator.
- deadline: Deadline for the generator to generate the proof.
- reward: Amount to be paid to the generator when the trade is settled.
- publicInput: List of public zkApp inputs.
- privateInputs: List of private zkApp inputs. Private inputs are encrypted using matching engine keys and are not available outside the matching engine enclave.
When the Matching Engine (ME) finds the right prover, it assigns the request to the prover along with transmitting the encrypted request to the prover's enclave. The Matching Engine uses the attestation proofs of the generator's enclave to ensure that the confidentiality of the requests is maintained. The request when assigned to a prover can be visualized as below:
[
{
"proverId": "proverID",
"deadline": "10 sec or (currentBlock+X) block",
"reward": "1000$ usdc",
"generatorId": "genID",
"publicInputs": [...],
"privateInputs": [...],
"proverKey": "0x00"
},...
]
- proverId: Address or identity information of the prover who placed the ASK order.
- deadline: Deadline for submitting the task results, calculated from the time the task is published on the chain.
- reward: Amount to be paid to the generator when the trade is settled.
- generatorId: Identifier or address of the generator to whom the task is allocated.
- publicInputs: List of public zkApp inputs.
- privateInputs: List of private zkApp inputs, encrypted using the generator's oyster public key and not available outside the prover's enclave.
- proverKey: Public key of the prover used to re-encrypt results, if needed by the generator.
Solver (Proof Generator)
Proof Generators can register and identify themselves using their attestation and key on Kalypso Contracts. In general, a generator can participate in multiple markets but is required to allocate exactly one enclave to a market (when it is a confidential market).
{
"totalCompute": "100%",
"generatorPublicKey": "0x1234",
"markets": [
{
"MarketId": "marketX",
"Time": "10 sec",
"Fees": "1000 USDC",
"ComputeAllocation": "10%",
"generatorPublicKey": "gen_a"
},
{
"MarketId": "marketY",
"Time": "2 sec",
"Fees": "900 USDC",
"ComputeAllocation": "25%",
"generatorPublicKey": "gen_b"
}
]
}
- totalCompute: This is a relative number and advised to be kept close to 100%.
- generatorPublicKey: This is the generator's public key via which the requests assigned to the generator are encrypted. This is an asymmetric ECIES public key.
- MarketId: Market ID of the generator to be part of.
- Fees: Price per request the generator will charge.
- ComputeAllocation: Percentage of compute allocated to a request of that market.
Proof Verifier
The Proof Verifier is the core logic of a market that enables the escrow settlement. This application-specific verifier helps settle the escrow. Don't worry if you need one; our team will help you create one quickly and easily.