Brevis is a ZK coprocessor that lets smart contracts trustlessly read and run computations over the full historical state, transactions, and events of Ethereum and other supported chains. Developers write an App Circuit in Go using the Brevis SDK; the ProverNet generates a ZK proof, and an on-chain App Contract consumes the verified result.
- 01loyalty / volume-based fee tiers from on-chain history
- 02TWAP / VWAP and other historical-data DeFi primitives
- 03trustless cross-chain accounting
- 04ZK-verified analytics fed into smart contracts
- 05offloading expensive on-chain reads to a coprocessor
- go get github.com/brevis-network/brevis-sdk/sdk
- git clone https://github.com/brevis-network/brevis-sdk-golang-template
- forge install brevis-network/brevis-contracts
| Variable | Scope | Description |
|---|---|---|
| BREVIS_API_KEY | Server | API key for the Brevis ProverNet (request through the Brevis developer portal). |
| BREVIS_RPC_URL | Server | Brevis ProverNet RPC endpoint used by the SDK to submit proof requests. |
| SOURCE_CHAIN_RPC_URL | Server | RPC URL for the source chain (e.g. Ethereum mainnet) the App Circuit reads historical data from. |
Use Brevis to compute over historical chain data and consume the result on-chain. In Go, define an `AppCircuit` implementing `Define(api *sdk.CircuitAPI, in sdk.DataInput)` that asserts properties about receipts/storage/transactions, register it via `sdk.NewBrevisApp(srcChainID, BREVIS_RPC_URL)`, add raw data with `app.AddReceipt`/`AddStorage`/`AddTransaction`, then call `app.Prove(ctx, vk, pk)` to submit to ProverNet and `app.SubmitProof(ctx)` once it's ready. On-chain, your `AppContract` inherits `BrevisApp` from `brevis-contracts` and overrides `handleProofResult(bytes32 vkHash, bytes calldata circuitOutput)`, which is invoked by the Brevis gateway after verification. Use the verified `circuitOutput` to update state — e.g. credit a fee discount based on proven historical volume.
- ⚑Each Brevis App is bound to a specific verification key (vk) hash; redeploying the circuit changes the hash and your App Contract must be updated, otherwise valid proofs will be rejected.
- ⚑ProverNet is a paid, centralised-today service — every user-triggered proof costs USD-equivalent fees, so design for batching or sponsorship rather than per-user real-time proofs.
- ⚑Data input limits per circuit (number of receipts/storage/transactions) are bounded — exceeding them fails compilation; partition large queries across multiple proofs.
- ⚑Historical data lookups depend on archival access on the source chain; non-archive RPCs will silently return empty data and your circuit will assert false.
- ⚑Latency from request to on-chain callback is typically minutes, not seconds — UX must reflect async settlement, and replay/idempotency on `handleProofResult` is critical.