Playtesting the zkSVM

Interacting with the Prover

Please reach out to request an API key to start sending requests to the server.

The high-level flow is: 1) start the session, 2) send requests containing SVM transactions, 3) end the session to trigger proof generation, and 4) poll the endpoint to retrieve summary statistics. Use the following code as a guide for interacting with the prover.

async fn main() -> Result<(), Box<dyn Error>> {
    // Step 1: Start the session
    let session: StartSessionResponse = client
        .post(format!("{BASE_URL}/start_session")
        .header("Authorization", format!("Bearer {API_KEY}"))
        .send()
        .await?
        .json()
        .await?;
        
    println!("Session started: {}", session.id);

    // Step 2: send the transactions
    for tx in transactions {
        let response: TransactionResponse = client
            .post(format!("{BASE_URL}/transactions")
            .header("Authorization", format!("Bearer {API_KEY}"))
            .header("Session-ID", &session.id)
            .json(&tx)
            .send()
            .await?
            .json()
            .await?;

        println!(
            "Transaction ID: {}, Status: {}",
            response.transaction_id, response.status
        );
    }
  
    // Step 3: End the session and retrieve the summary
    let response: EndSessionResponse = client
        .post(format!("{BASE_URL}/end_session")
        .header("Authorization", format!("Bearer {API_KEY}"))
        .header("Session-ID", &session.id)
        .send()
        .await?
        .json()
        .await?;
      
	println!("Proving started: {}", response.status);
	
	// Step 4: Proof generation is async,
	// so periodically query the status to see if the process is complete
	for {
	    let status: PollSessionResponse = client
	        .post(format!("{BASE_URL}/poll_session")
	        .header("Authorization", format!("Bearer {API_KEY}"))
	        .header("Session-ID", &session.id)
	        .send()
	        .await?
	        .json()
	        .await?;
      
             if (status.complete) {
                 println!(
                     "Session Summary: {}\n{}\n{}",
                     status.proof, // the ZK proof
                     status.stats, // cycle count, proving time, proof type
                     status.transactions // list of transactions the proof is over
                 );
                 break;
             }
             
             sleep(1_000);
	}

    Ok(())
}

System Constraints

There are a few limitations to keep in mind. The system currently places a hard cap of 50 transactions per session due to memory constraints of the underlying zkVM, which is around 24B cycles. The server will reject requests that send additional transactions beyond 50. Not that if you start a new session, old data from previous sessions are not persisted.

The zkSVM contains several pre-installed Solana Program Library (SPL) programs, e.g. the token and token-2022 programs, but any custom programs need to be deployed before they can be interacted with.

Last updated