Bonsai REST SDK
A library to handle HTTP REST requests to the Bonsai-alpha prover interface
Example Usage
use Duration;
use Client;
use ;
use to_vec;
// serialize a given input for the guest
let input_data = to_vec.unwrap;
let input_data = cast_slice.to_vec;
// Construct the bonsai_sdk client from the BONSAI_ENDPOINT env var
let client = from_env?;
// Upload the ELF file of the guest to the prover
let elf_path = new;
let img_id = client.upload_img_file?;
// Optionally you can upload a MemoryImage as well, but bincode encoded:
// let program = Program::load_elf(METHOD_NAME_ELF, MEM_SIZE as u32)?;
// let image = MemoryImage::new(&program, PAGE_SIZE as u32)?;
// let image = bincode::serialize(&image).context("Failed to serialize memoryimg")?;
// client.upload_img(image)?
// Upload the serialized input
let input_id = client.upload_input?;
// Start the prover session by referencing the img_id and input_id
let session = client.create_session?;
// Monitor the status of the prover session waiting for possible exit status
loop