Launching Brevis V2: Generalized ZK Coprocessor for Data-driven dApps

Today we are excited to launch Brevis V2 mainnet alpha. Brevis is a highly efficient ZK coprocessor that empowers smart contracts to read from the full set of historical on-chain data from all supported blockchains and is able to run customizable computations on that data in a completely trust-free way. 

Developers can now build powerful data-driven dApps with three simple steps: 

  1. Data Access: Developers can trustlessly specify access to the full historical on-chain data, such as block headers, account data, storage slots, transactions, and transaction receipts (events), from Ethereum and other supported chains.
  2. Computation: Developers then can build and deploy their generalized and customized business logic using Brevis’s programmable SDK. Brevis runs the computation and generates a ZK proof off-chain for the results.
  3. Using the Results: The computation results, along with the ZK proof, are submitted back on-chain through standard callback functions for application smart contracts to seamlessly verify and consume.

Brevis is developer-friendly and does not require any prior ZK knowledge in order to use. This is due to the fact that Brevis’s SDK has abstracted away many low-level circuit framework details and only focuses on easy-to-use APIs and high-level functions. In addition, Brevis is highly scalable and can handle large-scale use cases dealing with hundreds of thousands of data points with low latency and low costs. What’s more, Brevis is cross-chain in nature. In this release, developers can access and run computations on Ethereum’s historical data from any supported EVM blockchain due to Brevis’s ZK light client support for Ethereum.

Building on Brevis is future-compatible with Brevis coChain which utilizes EigenLayer to enable new features and significantly reduce ZK coprocessing costs. 

Brevis V2 alpha mainnet is live on Ethereum now. To build data-driven and ZK computing features in your dApp, please refer to the Brevis SDK documentation

So How Exactly Does It Work?

To build a Brevis-powered dApp is very easy! On a more technical note, developers simply need to implement the following three things using Brevis’s SDK:

  1. The Data Access Module to specify the historical blockchain data needed by the App Contract. 
  2. The App Circuit to specify the computation logic to run on the specified historical on-chain data.
  3. The App Contract to receive and process the ZK-verified computation results.

These 3 modules are highlighted in green in the diagram below:

To give an example of exactly how this could work, we can look at how a DEX could utilize Brevis to calculate and utilize the historical trading volume of a set of traders (App Service) directly in smart contracts, all trustlessly!

Data Access Module code snippet

The first step is to identify and get the data required to run the business logic. Using the Brevis SDK, developers can easily specify what the needed data is for the computation logic in the Data Access Module. In the DEX trading volume example, the data would be all related swap events. The supported data types are block headers, account data, storage slots, transactions, and transaction receipts (events). Oftentimes, to get this raw data, developers will use off-chain indexing solutions such as Dune Analytics or Alchemy. 

App Circuit code sample

Based on the data access specification, developers can now build their App Circuit to run the business logic. For the DEX example, its App Circuit will be able to generate a proof of trading volumes by summing up all trade transactions of specified traders during the specified time period.

The DEX’s App Service then sends these 2 pieces of data, the data access specification and the computation proof, to the Brevis Service, where Brevis will generate ZK proofs of 2 aspects:

  1. That the raw data specified in the request does exist in the history of the blockchain. 
  2. The corresponding computation results on top of this data are correct. 

The Brevis Service will then combine these two proofs into a single one that simultaneously asserts both the validity of the data and the computation results. Then the computation results and the corresponding ZK proof will be verified on-chain in Brevis Contracts

In the context of the DEX example, the final proof can be used to convince a verifier that if (say) a certain user made 350 trades on the DEX and the total trading volume of all of those trades was $3M, that all of that is true. 

Once the verification is successful, Brevis Contracts will call the callback function on the App Contract, which will handle the results by matching it with the original request.

Brevis’s App Circuit SDK is built on top of the amazing gnark framework by Linea team from Consensys. Therefore, aside from the high-level abstractions, advanced developers can also use the full gnark functionality easily with Brevis.

What’s Next?

We have a lot of exciting stuff coming up soon after the initial launch. We already have another 10x performance improvement cooking in the cutting-edge dev branch and new features in the SDK to support more customized data types are coming in the next couple of weeks. Cross-chain support for more blockchains and L2s is also rolling out soon. Of course, Brevis coChain, a fundamentally new ZK coprocessor architecture is expected to launch in the next couple of months as well. And a few other pleasant surprises… 😉

If you are interested in building data-driven features for your dApps or running powerful computation off-chain based on historical on-chain data, we are just one message away! Feel free to reach out to us via our community channels and partner outreach forms

Discover more from Brevis Network

Subscribe now to keep reading and get access to the full archive.

Continue reading