Skip to main content

Build applications with the Bonsai starter template

How to use this project

Our "Hello, World!" project is intended as a starter template for anyone writing an application using Bonsai. The project repository is here. Everyone is welcome to explore the project source and ask questions on our public Discord, but in order to run this program, you'll need access to the Bonsai proving service. We'll be launching a public version soon, but for now we recommend you sign up for our Bonsai waitlist.

What's in our "Hello, World!" example

This repository implements an application on Ethereum utilizing the Bonsai network as a coprocessor to the smart contract application. It provides a starting point for building powerful new applications on Ethereum that offload computationally intensive or difficult to implement tasks to a RISC Zero guest zkVM, with verified results sent to your Ethereum contract.

Getting Started

Start building your application by forking the Bonsai starter template.


You'll need the following dependencies:

Write Your Application

Get started writing your application by modifying these key files:

  • Replace contracts/contracts/HelloBonsai.sol with your on-chain application logic.
  • Replace methods/guest/src/bin/ with your Bonsai coprocessor logic.

Associated build configuration files and tests are discussed along with the project structure below.

Build the Project

Running the following will build the project, including Ethereum contracts and RISC Zero guest program.

cargo build

Run Tests

Running the following will run all tests, including tests for Ethereum contracts and the RISC Zero guest program.

cargo test

Project Structure

├── Cargo.toml
├── cli
│   ├── Cargo.toml
│   └── src
│   └── bin
│   ├──
│   └──
├── contracts
│   ├── Cargo.toml
│   ├──
│   ├── contracts
│   │   ├── HelloBonsai.sol
│   │   ├── IBonsaiProxy.sol
│   │   └── test
│   │   └── MockBonsaiProxy.sol
│   ├── src
│   │   └──
│   └── tests
│   └──
└── methods
├── Cargo.toml
├── guest
│   ├── Cargo.toml
│   └── src
│   └── bin
│   └──
└── src


Ethereum contracts are in the contracts directory.

Solidity can be found in contracts/contracts including the application source and an interface and mock implementation of the Bonsai proxy.

The build configuration is in contracts/ Contracts are built and tested with Cargo with the Rust ethers libraries.

Tests are defined in contracts/tests. They are written in Rust and run against Ganache.


RISC Zero guest programs are defined in the methods directory.


A starter CLI is provided to help deploy contracts to Ethereum and RISC Zero guest programs to Bonsai. Additionally the CLI includes example commands to interact with the smart contract via ethers.