Corda Blockchain Querying Mechanism
R3 Corda has a concept of ‘Vault’.
Vault contains the data extracted from the ledger stored in a relational model which can be easily queried.
It keeps track on the both states :
· Spent (consumed)
· Unspent (unconsumed)
We can query the data with the help of Vault Query API.
The API provides both static (snapshot) and dynamic (snapshot with streaming updates) methods for a defined set of filter criteria:
· We can use ‘queryBy’ to obtain a current snapshot of data (for a given query criteria).
· We can use ‘trackBy’ to obtain both a current snapshot and a future stream of updates (for a given query criteria).
I have also attached the diagram of Vault to understand the concept.
· A Vault Query API is exposed to developers using standard Corda RPC and CorDapp plugin mechanisms.
· A vault update API is internally used by transaction recording flows.
· The vault database schemas are directly accessible via JDBC for customers joins and queries.