aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zkvms/risc0/Cargo.lock135
-rw-r--r--zkvms/risc0/default.nix1
-rw-r--r--zkvms/risc0/host/Cargo.toml2
-rw-r--r--zkvms/risc0/host/src/main.rs72
-rw-r--r--zkvms/sp1/Cargo.lock21
-rw-r--r--zkvms/sp1/default.nix1
-rw-r--r--zkvms/sp1/host/Cargo.toml2
-rw-r--r--zkvms/sp1/host/src/main.rs92
-rw-r--r--zkvms_host_io/Cargo.lock260
-rw-r--r--zkvms_host_io/Cargo.toml8
-rw-r--r--zkvms_host_io/src/lib.rs35
11 files changed, 532 insertions, 97 deletions
diff --git a/zkvms/risc0/Cargo.lock b/zkvms/risc0/Cargo.lock
index 145227c..176a442 100644
--- a/zkvms/risc0/Cargo.lock
+++ b/zkvms/risc0/Cargo.lock
@@ -39,6 +39,56 @@ dependencies = [
]
[[package]]
+name = "anstream"
+version = "0.6.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "is_terminal_polyfill",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
+
+[[package]]
+name = "anstyle-parse"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
+dependencies = [
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle-query"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
+dependencies = [
+ "windows-sys 0.59.0",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "3.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
+dependencies = [
+ "anstyle",
+ "once_cell",
+ "windows-sys 0.59.0",
+]
+
+[[package]]
name = "anyhow"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -419,6 +469,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
+name = "clap"
+version = "4.5.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783"
+dependencies = [
+ "clap_builder",
+ "clap_derive",
+]
+
+[[package]]
+name = "clap_builder"
+version = "4.5.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "clap_lex",
+ "strsim",
+]
+
+[[package]]
+name = "clap_derive"
+version = "4.5.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c"
+dependencies = [
+ "heck 0.5.0",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.96",
+]
+
+[[package]]
+name = "clap_lex"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
+
+[[package]]
+name = "colorchoice"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
+
+[[package]]
name = "const-oid"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -543,7 +639,7 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de78e66ac9061e030587b2a2e75cc88f22304913c907b11307bca737141230cb"
dependencies = [
- "heck",
+ "heck 0.4.1",
"proc-macro-error",
]
@@ -740,6 +836,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
+name = "heck"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+
+[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -760,6 +862,7 @@ dependencies = [
"risc0-zkvm",
"serde",
"tracing-subscriber 0.3.19",
+ "zkvms_host_io",
]
[[package]]
@@ -1014,6 +1117,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708"
[[package]]
+name = "is_terminal_polyfill"
+version = "1.70.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
+
+[[package]]
name = "itertools"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1112,9 +1221,9 @@ checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
[[package]]
name = "log"
-version = "0.4.22"
+version = "0.4.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
+checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
[[package]]
name = "malloc_buf"
@@ -1960,6 +2069,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
+name = "strsim"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
+
+[[package]]
name = "subtle"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2297,6 +2412,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
+name = "utf8parse"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+
+[[package]]
name = "valuable"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2771,3 +2892,11 @@ version = "0.1.0"
dependencies = [
"guests_macro",
]
+
+[[package]]
+name = "zkvms_host_io"
+version = "0.1.0"
+dependencies = [
+ "clap",
+ "num-traits",
+]
diff --git a/zkvms/risc0/default.nix b/zkvms/risc0/default.nix
index f9b5dac..4f43a54 100644
--- a/zkvms/risc0/default.nix
+++ b/zkvms/risc0/default.nix
@@ -17,6 +17,7 @@ let
./.
../../guests
../../guests_macro
+ ../../zkvms_host_io
../../Vertices-010.in
]);
};
diff --git a/zkvms/risc0/host/Cargo.toml b/zkvms/risc0/host/Cargo.toml
index 5074af1..ff28294 100644
--- a/zkvms/risc0/host/Cargo.toml
+++ b/zkvms/risc0/host/Cargo.toml
@@ -10,3 +10,5 @@ risc0-zkp = { path = "/nix/store/l1rxg23rrrdwi9cf6rc82mqavklvqc18-risc0-unstable
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
serde = "1.0"
+
+zkvms_host_io = { path = "../../../zkvms_host_io" }
diff --git a/zkvms/risc0/host/src/main.rs b/zkvms/risc0/host/src/main.rs
index ec1eca3..4077a44 100644
--- a/zkvms/risc0/host/src/main.rs
+++ b/zkvms/risc0/host/src/main.rs
@@ -1,4 +1,5 @@
-use risc0_zkvm::{default_prover, default_executor, ExecutorEnv};
+use zkvms_host_io::{read_args, RunType::{ Execute, Prove, Verify }};
+use risc0_zkvm::{default_prover, default_executor, ExecutorEnv, Receipt};
use risc0_zkp::core::digest::Digest;
use hex::FromHex;
@@ -7,12 +8,10 @@ static HELLO_GUEST_ELF: &[u8] = include_bytes!("./guest");
// https://github.com/risc0/risc0/blob/881e512732eca72849b2d0e263a1242aba3158af/risc0/build/src/lib.rs#L255
static HELLO_GUEST_ID: &str = env!("GUEST_ID");
-fn main() {
- let args: Vec<String> = std::env::args().collect();
-
- let (graph, colors, coloring): (Vec<Vec<bool>>, u32, Vec<Vec<u32>>) = include!(env!("INPUTS"));
+type Input = (Vec<Vec<bool>>, u32, Vec<Vec<u32>>);
- let env = ExecutorEnv::builder()
+fn build_env((graph, colors, coloring): &Input) -> ExecutorEnv {
+ ExecutorEnv::builder()
.write(&graph)
.unwrap()
.write(&colors)
@@ -20,41 +19,54 @@ fn main() {
.write(&coloring)
.unwrap()
.build()
- .unwrap();
+ .unwrap()
+}
+
+fn prove(env: ExecutorEnv) -> Receipt {
+ default_prover()
+ .prove(env, HELLO_GUEST_ELF)
+ .expect("Error occured")
+ .receipt
+}
+
+fn journal(receipt: Receipt) -> bool {
+ receipt
+ .journal
+ .decode()
+ .unwrap()
+}
+
+fn main() {
+ let run_info = read_args();
+ let env = build_env(&run_info.input);
- match args[1].as_str() {
- "execute" => {
+ match run_info.run_type {
+ Execute => {
let exec = default_executor();
- let output = exec.execute(env, HELLO_GUEST_ELF).unwrap().receipt_claim.unwrap().output.value().unwrap();
+ let output = default_executor()
+ .execute(env, HELLO_GUEST_ELF)
+ .unwrap()
+ .receipt_claim
+ .unwrap()
+ .output
+ .value()
+ .unwrap();
println!("{:#?}", output);
},
- "prove" => {
- // Obtain the default prover.
- let prover = default_prover();
-
- // Produce a receipt by proving the specified ELF binary.
- let receipt = prover.prove(env, HELLO_GUEST_ELF).expect("Error occured").receipt;
-
- // Extract journal of receipt
- let journal: bool = receipt.journal.decode().unwrap();
- // Print, notice, after committing to a journal, the private input became public
- println!("Output from journal: {:?}", journal);
+ Prove => {
+ let receipt = prove(env);
+ println!("Output from journal: {:?}", journal(receipt));
},
- "verify" => {
+ Verify => {
// https://github.com/risc0/risc0/blob/881e512732eca72849b2d0e263a1242aba3158af/risc0/build/src/lib.rs#L197-L199
- let guest_id: Digest = Digest::from_hex(HELLO_GUEST_ID).expect("");
- // https://github.com/risc0/risc0/blob/881e512732eca72849b2d0e263a1242aba3158af/risc0/build/src/lib.rs#L278
-
- let prover = default_prover();
- let receipt = prover.prove(env, HELLO_GUEST_ELF).unwrap().receipt;
+ let guest_id: Digest = Digest::from_hex(HELLO_GUEST_ID).unwrap();
+ let receipt = prove(env);
receipt.verify(guest_id).unwrap();
- let journal: bool = receipt.journal.decode().unwrap();
- println!("Output from verify: {:?}", journal);
+ println!("Output from verify: {:?}", journal(receipt));
},
- _ => println!("No arguments provided! Expected execute, prove or verify!"),
}
}
diff --git a/zkvms/sp1/Cargo.lock b/zkvms/sp1/Cargo.lock
index c3abeae..3b29c89 100644
--- a/zkvms/sp1/Cargo.lock
+++ b/zkvms/sp1/Cargo.lock
@@ -2012,9 +2012,9 @@ dependencies = [
"hex",
"serde",
"serde_json",
- "sp1-helper",
"sp1-sdk",
"tracing",
+ "zkvms_host_io",
]
[[package]]
@@ -2565,9 +2565,9 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.22"
+version = "0.4.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
+checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
[[package]]
name = "lru"
@@ -4376,13 +4376,6 @@ dependencies = [
]
[[package]]
-name = "sp1-helper"
-version = "3.4.0"
-dependencies = [
- "sp1-build",
-]
-
-[[package]]
name = "sp1-primitives"
version = "3.4.0"
dependencies = [
@@ -5865,3 +5858,11 @@ version = "0.1.0"
dependencies = [
"guests_macro",
]
+
+[[package]]
+name = "zkvms_host_io"
+version = "0.1.0"
+dependencies = [
+ "clap",
+ "num-traits",
+]
diff --git a/zkvms/sp1/default.nix b/zkvms/sp1/default.nix
index 6baee1f..9b42e58 100644
--- a/zkvms/sp1/default.nix
+++ b/zkvms/sp1/default.nix
@@ -17,6 +17,7 @@ let
./.
../../guests
../../guests_macro
+ ../../zkvms_host_io
../../Vertices-010.in
]);
};
diff --git a/zkvms/sp1/host/Cargo.toml b/zkvms/sp1/host/Cargo.toml
index 40722b6..6ab50a3 100644
--- a/zkvms/sp1/host/Cargo.toml
+++ b/zkvms/sp1/host/Cargo.toml
@@ -11,3 +11,5 @@ clap = { version = "4.0", features = ["derive", "env"] }
tracing = "0.1.40"
hex = "0.4.3"
alloy-sol-types = "0.7.7"
+
+zkvms_host_io = { path = "../../../zkvms_host_io" }
diff --git a/zkvms/sp1/host/src/main.rs b/zkvms/sp1/host/src/main.rs
index bed7c29..28cc319 100644
--- a/zkvms/sp1/host/src/main.rs
+++ b/zkvms/sp1/host/src/main.rs
@@ -1,69 +1,53 @@
-use clap::Parser;
-use sp1_sdk::{ProverClient, SP1Stdin};
+use zkvms_host_io::{read_args, RunType::{ Execute, Prove, Verify }};
+use sp1_sdk::{ProverClient, EnvProver, SP1Stdin, SP1ProofWithPublicValues, SP1VerifyingKey};
/// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM.
pub const FIBONACCI_ELF: &[u8] = include_bytes!("./guest");
-/// The arguments for the command.
-#[derive(Parser, Debug)]
-#[clap(author, version, about, long_about = None)]
-struct Args {
- #[clap(long)]
- execute: bool,
+type Input = (Vec<Vec<bool>>, u32, Vec<Vec<u32>>);
- #[clap(long)]
- prove: bool,
-}
-
-fn main() {
- // Setup the logger.
- sp1_sdk::utils::setup_logger();
-
- // Parse the command line arguments.
- let args = Args::parse();
-
- if args.execute == args.prove {
- eprintln!("Error: You must specify either --execute or --prove");
- std::process::exit(1);
- }
-
- // Setup the prover client.
- let client = ProverClient::new();
-
- // Setup the inputs.
+fn build_stdin((graph, colors, coloring): &Input) -> SP1Stdin {
let mut stdin = SP1Stdin::new();
-
- let (graph, colors, coloring): (Vec<Vec<bool>>, u32, Vec<Vec<u32>>) = include!(env!("INPUTS"));
-
stdin.write(&graph);
stdin.write(&colors);
stdin.write(&coloring);
+ stdin
+}
- if args.execute {
- // Execute the program
- let (output, report) = client.execute(FIBONACCI_ELF, &stdin).run().unwrap();
- println!("Program executed successfully.");
-
- // Read the output.
- let decoded = output;
- println!("{:?}", decoded);
-
- // Record the number of cycles executed.
- println!("Number of cycles: {}", report.total_instruction_count());
- } else {
- // Setup the program for proving.
- let (pk, vk) = client.setup(FIBONACCI_ELF);
+fn prove(client: &EnvProver, stdin: SP1Stdin) -> (SP1ProofWithPublicValues, SP1VerifyingKey) {
+ let (pk, vk) = client.setup(FIBONACCI_ELF);
+ let proof = client
+ .prove(&pk, &stdin)
+ .run()
+ .expect("failed to generate proof");
+ (proof, vk)
+}
- // Generate the proof
- let proof = client
- .prove(&pk, &stdin)
- .run()
- .expect("failed to generate proof");
+fn main() {
+ let run_info = read_args();
+ let stdin = build_stdin(&run_info.input);
- println!("Successfully generated proof!");
+ sp1_sdk::utils::setup_logger();
+ let client = ProverClient::new();
- // Verify the proof.
- client.verify(&proof, &vk).expect("failed to verify proof");
- println!("Successfully verified proof!");
+ match run_info.run_type {
+ Execute => {
+ let (output, report) = client.execute(FIBONACCI_ELF, &stdin).run().unwrap();
+
+ println!("Program executed successfully.");
+ println!("{:?}", output);
+ println!("Number of cycles: {}", report.total_instruction_count());
+ },
+ Prove => {
+ let _ = prove(&client, stdin);
+ println!("Successfully generated proof!");
+ },
+ Verify => {
+ let (proof, vk) = prove(&client, stdin);
+ println!("Successfully generated proof!");
+
+ client.verify(&proof, &vk).expect("failed to verify proof");
+ println!("Successfully verified proof!");
+ },
}
}
diff --git a/zkvms_host_io/Cargo.lock b/zkvms_host_io/Cargo.lock
new file mode 100644
index 0000000..86caff9
--- /dev/null
+++ b/zkvms_host_io/Cargo.lock
@@ -0,0 +1,260 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "anstream"
+version = "0.6.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "is_terminal_polyfill",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
+
+[[package]]
+name = "anstyle-parse"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
+dependencies = [
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle-query"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
+dependencies = [
+ "windows-sys",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "3.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
+dependencies = [
+ "anstyle",
+ "once_cell",
+ "windows-sys",
+]
+
+[[package]]
+name = "autocfg"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
+
+[[package]]
+name = "clap"
+version = "4.5.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783"
+dependencies = [
+ "clap_builder",
+ "clap_derive",
+]
+
+[[package]]
+name = "clap_builder"
+version = "4.5.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "clap_lex",
+ "strsim",
+]
+
+[[package]]
+name = "clap_derive"
+version = "4.5.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c"
+dependencies = [
+ "heck",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "clap_lex"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
+
+[[package]]
+name = "colorchoice"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
+
+[[package]]
+name = "heck"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+
+[[package]]
+name = "is_terminal_polyfill"
+version = "1.70.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
+
+[[package]]
+name = "num-traits"
+version = "0.2.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.20.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.93"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.38"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "strsim"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
+
+[[package]]
+name = "syn"
+version = "2.0.96"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
+
+[[package]]
+name = "utf8parse"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+
+[[package]]
+name = "windows-sys"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "zkvms_host_io"
+version = "0.1.0"
+dependencies = [
+ "clap",
+ "num-traits",
+]
diff --git a/zkvms_host_io/Cargo.toml b/zkvms_host_io/Cargo.toml
new file mode 100644
index 0000000..b4d6e8e
--- /dev/null
+++ b/zkvms_host_io/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "zkvms_host_io"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+clap = { version = "4.5.26", features = ["derive"] }
+num-traits = "0.2.19"
diff --git a/zkvms_host_io/src/lib.rs b/zkvms_host_io/src/lib.rs
new file mode 100644
index 0000000..29723db
--- /dev/null
+++ b/zkvms_host_io/src/lib.rs
@@ -0,0 +1,35 @@
+use clap::{Parser, ValueEnum};
+use num_traits::NumCast;
+
+#[derive(Parser, Debug)]
+#[command(version, about, long_about = None)]
+struct Cli {
+ /// What the ZKVM is going to do
+ run_type: RunType,
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
+pub enum RunType {
+ Execute,
+ Prove,
+ Verify,
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub struct RunWith<T> {
+ pub run_type: RunType,
+ pub input: T,
+}
+
+fn read_input() -> (Vec<Vec<bool>>, u32, Vec<Vec<u32>>) {
+ include!(env!("INPUTS"))
+}
+
+pub fn read_args() -> RunWith<(Vec<Vec<bool>>, u32, Vec<Vec<u32>>)> {
+ let cli = Cli::parse();
+
+ RunWith {
+ run_type: cli.run_type,
+ input: read_input(),
+ }
+}