Quickstart
Let's create a hello world project using our newly installed Bonsol CLI.
2
3
Write a verifiable program
// src/main.rs
use risc0_zkvm::{guest::{env, sha::Impl},sha::{Sha256}};
fn main() {
let mut input_1 = Vec::new();
env::read_slice(&mut input_1);
let digest = Impl::hash_bytes(&input_1.as_slice());
env::commit_slice(digest.as_bytes());
}cargo build
Compiling say_hello v0.1.0 (/Users/chris/say_hello)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.74s4
Build the verifiable program
$ bonsol build --zk-program-path .
Build complete{
"name": "say_hello",
"binaryPath": "./target/riscv-guest/riscv32im-risc0-zkvm-elf/docker/say_hello/say_hello",
"imageId": "6700902caf52fb56277157db725faa5c1aeac0c08221d2e13e27430da2f77136",
"inputOrder": [
"Public"
],
"signature": "k7XUcgk94oxsLpLZwzCQ3SdrZ5tq4TsCPW8paBC4JnDtKXMknwJ7MMENXs5ijFL2wDKAzFLrvFKGZCpFMPmRfo9",
"size": 116744
}5
Deploy the verifiable program
$ solana config get
Config File: /Users/<user>/.config/solana/cli/config.yml
RPC URL: https://api.devnet.solana.com
WebSocket URL: wss://api.devnet.solana.com/ (computed)
Keypair Path: /Users/<user>/.config/solana/id.json
Commitment: confirmed$ bonsol deploy s3 \
--bucket <bucket-name> \
--access-key <access-key> \
--secret-key <secret-key> \
--manifest-path <path-to-manifest.json>
Uploaded to S3 url https://bonsol.s3.us-east-1.amazonaws.com/say_hello-6700902caf52fb56277157db725faa5c1aeac0c08221d2e13e27430da2f77136Deploying to Solana, which will cost real money. Are you sure you want to continue? (y/n)
y
6700902caf52fb56277157db725faa5c1aeac0c08221d2e13e27430da2f77136 deployed6
Last updated