Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ members = [
"aggregation/program",
"alu-x0/program",
"aggregation/script",
"base64/program",
"base64/script",
"bls12381/program",
"bls12381/script",
"bn254/program",
Expand Down
8 changes: 8 additions & 0 deletions examples/base64/program/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "base64-program"
version = "0.1.0"
edition = "2021"

[dependencies]
sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git" }
base64 = "0.22"
Binary file not shown.
13 changes: 13 additions & 0 deletions examples/base64/program/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#![no_main]
sp1_zkvm::entrypoint!(main);

use base64::{engine::general_purpose, Engine as _};

pub fn main() {
let encoded_string: String = sp1_zkvm::io::read();

let decoded_bytes =
general_purpose::STANDARD.decode(&encoded_string).expect("Failed to decode base64");

sp1_zkvm::io::commit(&decoded_bytes);
}
8 changes: 8 additions & 0 deletions examples/base64/script/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "base64-script"
version = "0.1.0"
edition = "2021"

[dependencies]
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git" }
tokio = { version = "1.37.0", features = ["full"] }
19 changes: 19 additions & 0 deletions examples/base64/script/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use sp1_sdk::{ProverClient, SP1Stdin, Prover};

const ELF: &[u8] = include_bytes!("/home/amit_2004/sp1/examples/target/elf-compilation/riscv64im-succinct-zkvm-elf/release/base64-program");

#[tokio::main]
async fn main() {
let client = ProverClient::from_env().await;

let mut stdin = SP1Stdin::new();
stdin.write(&"SGVsbG8sIFNQMSE=".to_string());

println!("Executing program logic (Mock Mode)...");


let (mut public_values, _execution_report) = client.execute(sp1_sdk::Elf::Static(ELF), stdin).await.expect("Execution failed");
let decoded = public_values.read::<Vec<u8>>();
println!("Decoded: {}", String::from_utf8(decoded).unwrap());
println!("Successfully verified execution logic!");
}