A Guide to ZK Coprocessors for Scalability

If you’re operating an on-chain application, a ZK Coprocessor is a key tool for allowing you to scale your on-chain logic while keeping gas costs low. In this post, we review what a coprocessor is, why it matters, and how you can use the Bonsai ZK coprocessor architecture to scale your application.

Computational Limitations of On-chain Applications

Having your application execute entirely on the EVM comes with drawbacks. Tasks requiring heavy computation or large stores of data require gas fees so high that using your application can quickly become cost prohibitive. This means certain features are not realistically possible on the EVM, limiting the potential of your applications.

The trick is to move computation off-chain, drastically reducing gas fees and making your application more attractive to users. Traditionally, this would require trusting the computation executed on a centralized server, sacrificing the verifiable ecosystem of Ethereum in the name of cost savings. Fortunately, ZK proofs provide a way to securely verify these off-chain results while maintaining core values of decentralization, and at a fraction of on-chain costs.

What is a Coprocessor?

A coprocessor serves as a companion to a processor, allowing for off-loading computation in a resource-constrained system. For example, running an AI model like ChatGPT on your cell phone would be unfeasible. Your phone is slow, has limited storage, you’re paying to download the massive model, and your battery life is limited. However, when you ask ChatGPT a question, it’s sent to a dedicated server where it can run cheaply and efficiently then send back an answer. In this way, ChatGPT’s servers are acting as an AI co-processor for your cell phone’s limited resources.

On the other hand, the EVM serves as a versatile platform capable of executing various operations. Analogous to a personal device, the EVM can handle diverse tasks but might not always be the most efficient for high-volume operations. And zkVM, much like a cloud computer or mainframe, is designed for general-purpose tasks but excels in speed and cost-effectiveness.

Use cases for ZK coprocessors

Many applications, such as on-chain gaming or central limit order books, need off-chain computation to be economical. However, any application logic requiring more than 250K gas can potentially reduce costs with ZK coprocessors.

DAOs are a perfect example of collective on-chain activity involving many actors and multiple smart contracts and leading to heavy computation. ZK Coprocessors for DAO governance ensure off-chain compute for cheaper gas, and verification of on-chain data among parties. With the Bonsai DAO Governor, DAO members were able to lower their gas fees by more than 50% (from $6-9, to just $2-3 per vote during July 23rd) by moving compute off-chain. We’ll release more on how we built the Bonsai Governor soon!

Another notable use-case includes Web2 to Web3 verification. For example, Bonfire Wallet allows users to create a burner wallet using WebAuthn, while Bonsai ZK Coprocessor handles off-chain compute.


Build with Bonsai

To use Bonsai as a coprocessor for Ethereum, all you need to do is:

  • Write a zkVM application that handles your app logic
  • Write a Solidity contract that asks Bonsai to run your zkVM app and what to do with the results

Then, follow the instructions in the deployment guide.

Bonsai can help whether you're looking to take heavy computations off-chain or need to generate proofs for your trustless, verifiable software. For any questions, reach out to our team on Discord!