coChain Mode
Alternative optimistic model with Brevis coChain network.
A Brevis app can be deployed in the "pure-ZK" and "OP" (aka coChain) models. This section provides a detailed introduction to the two deployment models.
The aforementioned sections have introduced the workflow for the "pure-ZK" model. In this section, we describe how to deploy your Brevis app under the coChain model to enable use cases like "proof-of-completeness" and achieve fine-grained tradeoffs between trust assumptions and costs/latency.
To deploy in the coChain model, the developer should first follow the same steps as in the "pure-ZK" model to define data access, write an application circuit, and integrate with the smart contract (the "Compiling & Proving" part can be skipped for the coChain Model since no actual proving is needed if no challenge occurs).
Then, the developer needs to contact the Brevis team and send their application circuit source code offline to the Brevis team. The Brevis team will wrap the circuit as a Go plugin and dynamically deploy the plugin in our coChain PoS network. Once it's done, the validators in our coChain network will be able to dry run the circuit and verify the circuit outputs are indeed calculated with the on-chain data as defined in the data access module (the coChain network will also verify the on-chain data). Then, the coChain-verified computation result can be used in the developers' app smart contract.
There are some differences when using the Brevis SDK in the coChain model as compared to the "pure-ZK" model:
In the coChain model, the app service is not required to actually run the circuit proving. The dry run result is enough for submission to Brevis with an option parameter set with OP-related values.
In the coChain model, the option parameter in
BrevisRequest.sendRequest
should be set with OP-related values.In the coChain model, the
handelOpProofResult
interface should be implemented by the developer's custom app smart contract instead of thehandelProofResult
interface as in the "pure-ZK" model.In the coChain model,
challengeWindow
should be set in the developer's custom app smart contract. Note that each request won't be fulfilled on-chain until the corresponding challenge window has passed.
Contract Integration in the coChain Model
As described above, a few additional things should be implemented in the contract to develop a contract that integrates with the coChain mode.
Below is an example that extends the MyAppContract in the previous section to make it usable for the coChain mode.
Last updated