Data Access Module
Query onchain data from Brevis SDK.
Last updated
Query onchain data from Brevis SDK.
Last updated
First, let's walk through the workflow for adding historical receipt/tx/storage data to your app via the which offers a convenient way for NodeJS to interact with the and Brevis' system.
Depending on your project, you may want to first query an indexer, such as Dune, an Ethereum node, or your own service, to acquire the raw data (such as transactions) according to your business logic. This part is not handled by the Brevis SDK.
So why can't we just use the indexer data directly on chain?
If you directly post the data from an indexer to your contract without any validity proofs, your users would be trusting the entity who posted this data to behave correctly. Brevis's core role is to replace this trust of data validity on one party with a ZK proof so no one can fabricate data and computation results.
For example, if your AppCircuit is defined as
In your Typescript program you would need to assign the custom input as
After you acquire the raw data, you add the data to the proofReq
. The data you add here is closely tied to how you data slots for your circuit and is available in CircuitInput
passed in to your Define
function.
If you define for your circuit, you need to fully assign them here in ProofRequest
.
The types of the custom input you assign in ProofRequest
must match what you define in your app circuit. All are allowed here through the following functions.
The data you add here will be available for use in your
Read more about .
For advanced developers, there is also a way to access the receipt/tx/storage data via the . See for details.