In the overview, we presented SHARP as a component of the system that includes the STARK Prover. Here we discuss the interface between, and the role of, the StarkEx service and SHARP and present how the Cairo programming language is used.
Each batch of transactions that are proven together represent a successful execution of a Cairo program. Note that Cairo operates in the following framework:
It is stateless. i.e., the Cairo/Prover component of the system does not hold the off-chain state.
It cannot prove invalid transactions. By comparison, on L1, an invalid transaction can be executed, shown to be invalid, and reverted. If the input to the Cairo program contains an invalid transaction, the Cairo program does not complete (and, therefore, we have nothing to prove).
The StarkEx back end service has two goals that support the Cairo framework described above:
Ensure that all transactions to be executed and proved are valid according to the application business logic. This guarantees that the Cairo program will be able to complete a run with them as an input.
Prepare the input for the Cairo program and run it. This is done by first aggregating a sufficient number of valid transactions into one batch and then invoking the Cairo program with this batch of transactions as the input. In this process, the STARK Prover attests to the Cairo program's correct execution.
As a result of the modus operandi described above, we see that StarkEx works in units (and proves the validity) of batches. This is important since each batch contains a header in addition to the transactions that are used in the proof.
The flow so far describes a StarkEx deployment with its own STARK Prover. However, from StarkEx V3, all StarkEx deployments send their Cairo program execution to SHARP – the Shared Prover service.
Several claims/proofs are combined into one due to the exponential ratio between the cost of verifying a statement and the cost of executing it. Thus, verifying one proof made by SHARP will cost roughly the same as verifying one proof made by a single StarkEx, but this cost can be divided between several applications.