Default: Merkle Inclusion Proofs
By default, Boundless delivers proofs on-chain as merkle inclusion proofs:- Proofs are batched together are aggregated into a single Groth16 proof.
- The aggregated proof is verified once on-chain
- Individual proofs are verified through cheap merkle inclusion proofs into this root
Requesting a specific proof type
While merkle inclusion proofs are efficient for on-chain verification, there may be cases where you need to access the underlying proof instead of a merkle inclusion proof. For example:- Cross-chain verification where you need to verify the proof on a different chain
- Integration with other systems that expect a specific proof type
- Custom verification logic that requires the full proof
proof_type to ProofType::Groth16:
proof_type to ProofType::Blake3Groth16:
Note: Blake3 Groth16 proofs require is only supported with the ClaimDigestMatch predicate, meaning that you should only use this if you do not require the journal to be delivered on-chain.
Considerations
When choosing between proof types, consider:-
Gas Costs
- Merkle inclusion proofs are much cheaper to verify on-chain
- Raw Groth16 proofs require full SNARK verification each time. This will increase the price of the proof
-
Use Case Requirements
- If you only need on-chain verification, use the default merkle inclusion proof
- If you need cross-chain verification or raw proof data, use Groth16
- If you need to compose the proof by verifying it within another zkVM guest program, use Groth16
- If you don’t need the journal to be authenticated, consider using the ClaimDigestMatch predicate
Predicate Types
When constructing a Proof Request, we can set aRequirement with some predicate type. The available predicate types are DigestMatch, PrefixMatch, and ClaimDigestMatch.
These predicates ensure that the journal of our guest program match what we expect.
Specifying the DigestMatch and PrefixMatch predicates will require delivery of the journal when a request is being fulfilled.
There are times where we are building an application that does not require the journal to be delivered on-chain.
If this is the case, ClaimDigestMatch will save potentially a lot of gas, since Provers will not need to submit potentially large journals on-chain.
Example: Proof Composition using Proof Types
In the Proof Composition example, we demonstrate how to compose a proof from multiple proofs. Composing a proof requires us to verify a previously generated Groth16 proof within the zkVM guest program. This requires us to request a raw Groth16 proof from the Boundless Market. In the composition example, we first request a raw Groth16 proof from the Boundless Market using theECHO guest program.
IDENTITY zkVM guest program, and verify the proof.