CLI Commands
The Bonsol CLI is a command-line interface for creating, building, deploying, and interacting with verifiable programs on Solana.
General Usage
Most Bonsol commands accept the following global arguments:
-cor--config: Path to the config file-kor--keypair: Path to the keypair file-uor--rpc-url: URL for the Solana RPC
If these arguments aren't provided, Bonsol will use the default Solana config located in ~/.config/solana/. For example:
bonsol -k ./keypair.json -u http://localhost:8899 [COMMAND]Commands
init: Creating a New Bonsol Program
Initialize a new Bonsol project with the following command:
bonsol init --project-name <PROJECT_NAME> [--dir <DIR>]Options:
-n,--project-name <PROJECT_NAME>: Name of your new project (required)-d,--dir <DIR>: Directory where the project will be created
This command creates a new Bonsol program structure in the specified directory.
build: Building a Bonsol ZK Program
Build your zero-knowledge program using:
Options:
-z,--zk-program-path <ZK_PROGRAM_PATH>: Path to a ZK program folder containing a Cargo.toml (required)
This command builds your ZK program and creates a manifest.jsonfile in the program directory, containing all necessary information for deployment. Example manifest.json:
deploy: Deploying a Bonsol ZK Program
After building your ZK program, you can deploy it using various storage options:
Commands:
s3: Deploy using an AWS S3 bucketurl: Deploy with a custom URL (e.g. localhost)
execute: Requesting Execution
Request execution of your ZK program:
Options:
The execution request file should be a JSON file with the following structure:
-f,--execution-request-file <EXECUTION_REQUEST_FILE>: Path to execution request JSON file-p,--program-id <PROGRAM_ID>: Program ID-e,--execution-id <EXECUTION_ID>: Execution ID-x,--expiry <EXPIRY>: Expiry for the execution-m,--tip <TIP>: Tip amount for execution-i,--input-file <INPUT_FILE>: Override inputs in execution request file-w,--wait: Wait for execution to be proven-t,--timeout <TIMEOUT>: Timeout in seconds
The execution request file should be a JSON file with the following structure:
If you pass the --wait flag, the CLI will wait for execution completion and display the result:
prove: Local Proving with the CLI
Perform local proving against a deployed program:
Options:
-m,--manifest-path <MANIFEST_PATH>: Path to the manifest file-p,--program-id <PROGRAM_ID>: Program ID-i <INPUT_FILE>: Input file-e,--execution-id <EXECUTION_ID>: Execution ID (required)-o <OUTPUT_LOCATION>: Output location for the proof
You can provide inputs in a JSON file:
Or pipe inputs directly:
If proving succeeds, the CLI will save a serialized RISC-0 receipt file named <execution_id>.bin in the current directory or the specified output location.
💡 Note: Only private local inputs are supported for the prove command.\
Last updated