Proofs
Last updated
Last updated
roofs tab contains a list of proofs for a given project, sorted by time of addition. Each proof line contains the columns Status, Version, Expression, Time, Input, Proofs and Verification.
Let's look at each column in more detail.
Status can be:
New - when the proving task has just been added;
Processing - when the task is processed by the proving system;
Failed - when an error has occurred and the proving is no longer performed;
Success - when the proof is generated and can be used in the future.
Since expressions can be edited, they can have different versions. To track these changes, you can check the version number of the expression.
The name of the expression for which the proof is calculated.
Shows how much time has passed since the proof calculation job was added.
Proving input data.
The data is json, which can be opened in a separate browser tab or copied to the clipboard by clicking the appropriate buttons:
An example, input.json is presented below:
This json consists of three types of input data that are used at different stages of the calculation:
“user_inputs” - user input and precalculation result;
“plonky2_inputs” - public input and part of the private input that is passed to the plonky2 input of the proof circuit;
“verifier_inputs” - input data that is transmitted for verification in the blockchain network.
“user_inputs” consists of the following data blocks:
"block_number_start" - the number of the starting block of the selected Ethereum block range;
"block_number_end" - the number of the end block of the selected range of Ethereum blocks;
"value" - the result of precalculation of the expression in the form of an int256 number;
"expressions" - expressions entered by the user.
“plonky2_inputs” consists of the following data blocks, which describe the successive stages of the calculation:
"extract" - describes what data should be extracted from the blockchain;
“offsets” - an array of offset values that defines the location in the event byte slice in which the event parameters data is stored;
“aux_inputs” - defines an array of auxiliary data that is used, for example, as a transmission of pre-proven ChainLink prices for tokens;
“filter” - describes how data from the ‘extract’ block should be filtered;
"contract" - contains the address of the contract that generated the events used in the expression;
"topics" - contains an array of event topics that interpret the indexed event parameters;
“map” - describes the 'map' operation on the data received at the output of the 'filter' block;
"formula" - expression formula, which is presented in reverse Polish notation;
“reduce” - a data block describing the aggregation of data obtained from the previous calculation step (from the ‘map’ block);
“verify_inputs” - auxiliary intermediate data used to check the results of parallel calculations;
“start_block” - the starting block number of the selected Ethereum block range;
“end_block” - the ending block number of the selected range of Ethereum blocks;
“hash” - hash, which is used to identify various expressions in the proving system and is calculated as follows:
“verifier_inputs” consists of the following data blocks:
"block_start" - the start block hash of the selected Ethereum block range;
"block_end" - the end block hash of the selected Ethereum block range;
"value" - hex of the final value of the expression calculation;
"hash" - a hash that identifies the expression.
Data received at the proving output.
This data is json, which can be opened in a separate browser tab or copied to the clipboard by clicking the appropriate buttons
After the proof is generated, it can be verified on-chain in the Sepolia Testnet network, in which contracts for proof verification are pre-deployed.
To verify the proof, the user needs to click the “Verify” button, after which the system backend will automatically create a verification transaction and save the result in the VerificationGateway contract storage.
The backend of the Maru portal then calls the verifyAndSaveProof method of the VerificationGateway contract:
The public input consists of the previous block hash and the ending block hash of the range of blocks, the input expression hash, and the calculated value. Each value consists of 2 numbers of 256 bits.
A proof is a condensed proof of computation obtained using the zk-SNARK library gnark.
In the body of the verifyAndSaveProof function, the contract calls the verifyProof method of the Verifier contract, which supports checking the Groth16 proof that the Plonky2 proof is true.
After a successful transaction, a link to the transaction in etherscan will be displayed in the Verification column, for example, https://sepolia.etherscan.io/tx/0x2ed94332839a3fd37abee0c569209167300a93aadac832b3467c7929ceda6198
Other smart contracts can check whether Inputs have previously been verified with the corresponding proofs using the following functions:
For this check, other smart contracts do not need to know the proof, but simply pass the correct input data (input), which contains information about the block range (blockhash_prev, blockhash_end), expression (hash) and calculation result (value).