Struct risc0_zkvm::ApiClient
source · pub struct ApiClient { /* private fields */ }
Expand description
A client implementation for interacting with a zkVM server.
Implementations§
source§impl Client
impl Client
sourcepub fn new_sub_process<P: AsRef<Path>>(server_path: P) -> Result<Self>
pub fn new_sub_process<P: AsRef<Path>>(server_path: P) -> Result<Self>
Construct a Client that connects to a sub-process which implements
the server by calling the specified server_path
.
sourcepub fn with_connector(connector: Box<dyn Connector>) -> Self
pub fn with_connector(connector: Box<dyn Connector>) -> Self
sourcepub fn prove(
&self,
env: &ExecutorEnv<'_>,
opts: ProverOpts,
binary: Asset
) -> Result<Receipt>
pub fn prove( &self, env: &ExecutorEnv<'_>, opts: ProverOpts, binary: Asset ) -> Result<Receipt>
Prove the specified ELF binary.
sourcepub fn execute<F>(
&self,
env: &ExecutorEnv<'_>,
binary: Asset,
segments_out: AssetRequest,
segment_callback: F
) -> Result<SessionInfo>
pub fn execute<F>( &self, env: &ExecutorEnv<'_>, binary: Asset, segments_out: AssetRequest, segment_callback: F ) -> Result<SessionInfo>
Execute the specified ELF binary.
sourcepub fn prove_segment(
&self,
opts: ProverOpts,
segment: Asset,
receipt_out: AssetRequest
) -> Result<SegmentReceipt>
pub fn prove_segment( &self, opts: ProverOpts, segment: Asset, receipt_out: AssetRequest ) -> Result<SegmentReceipt>
Prove the specified segment.
sourcepub fn lift(
&self,
opts: ProverOpts,
receipt: Asset,
receipt_out: AssetRequest
) -> Result<SuccinctReceipt>
pub fn lift( &self, opts: ProverOpts, receipt: Asset, receipt_out: AssetRequest ) -> Result<SuccinctReceipt>
Run the lift program to transform a SegmentReceipt into a SuccinctReceipt.
The lift program verifies the rv32im circuit STARK proof inside the recursion circuit, resulting in a recursion circuit STARK proof. This recursion proof has a single constant-time verification procedure, with respect to the original segment length, and is then used as the input to all other recursion programs (e.g. join, resolve, and identity_p254).
sourcepub fn join(
&self,
opts: ProverOpts,
left_receipt: Asset,
right_receipt: Asset,
receipt_out: AssetRequest
) -> Result<SuccinctReceipt>
pub fn join( &self, opts: ProverOpts, left_receipt: Asset, right_receipt: Asset, receipt_out: AssetRequest ) -> Result<SuccinctReceipt>
Run the join program to compress two SuccinctReceipts in the same session into one.
By repeated application of the join program, any number of receipts for execution spans within the same session can be compressed into a single receipt for the entire session.
sourcepub fn resolve(
&self,
opts: ProverOpts,
conditional_receipt: Asset,
assumption_receipt: Asset,
receipt_out: AssetRequest
) -> Result<SuccinctReceipt>
pub fn resolve( &self, opts: ProverOpts, conditional_receipt: Asset, assumption_receipt: Asset, receipt_out: AssetRequest ) -> Result<SuccinctReceipt>
Run the resolve program to remove an assumption from a conditional SuccinctReceipt upon verifying a SuccinctReceipt proving the validity of the assumption.
By applying the resolve program, a conditional receipt (i.e. a receipt for an execution
using the env::verify
API to logically verify a receipt) can be made into an
unconditional receipt.
sourcepub fn identity_p254(
&self,
opts: ProverOpts,
receipt: Asset,
receipt_out: AssetRequest
) -> Result<SuccinctReceipt>
pub fn identity_p254( &self, opts: ProverOpts, receipt: Asset, receipt_out: AssetRequest ) -> Result<SuccinctReceipt>
Prove the verification of a recursion receipt using the Poseidon254 hash function for FRI.
The identity_p254 program is used as the last step in the prover pipeline before running the Groth16 prover. In Groth16 over BN254, it is much more efficient to verify a STARK that was produced with Poseidon over the BN254 base field compared to using Posidon over BabyBear.