Chapter 1
Estimated time: 12 mins
The Cosmos SDK is presently the most widely utilized framework for developing blockchain applications. A crucial necessity for such apps is an oracle. As decentralized applications (dApps) rely heavily on real-world data, ensuring the accuracy of this data holds significant importance.
It would be advantageous for your Cosmos SDK app to possess a built-in oracle that obtains data from BandChain via IBC. By importing the pricefeed module implemented by Band Protocol.
Below is an overview of how the pricefeed is retrieved when requesting data to BandChain.
However, inside the pricefeed module workflow, its workflow can be broken down into two main parts:
The initial step for the pricefeed module is to obtain information about the symbols that require price data from BandChain on every n block. This is accomplished by submitting the UpdateSymbolRequest
Proposal.
The Proposal submitted to update tasks for the pricefeed module consists of three components - the name of the symbol, the Oracle script ID required to obtain the price, and the block interval for requesting the data every n block.
Upon the proposal's approval, the pricefeed module will request price data from BandChain based on the SymbolRequest that was updated through the proposal.
At a high level, the workflow will be as follows. First, the pricefeed module creates an IBC packet to request data from BandChain. Then, relayers will pick up the IBC packet and relay it on BandChain.
After BandChain processes the request, it will send an acknowledgement message along with request_id
back. And, when the result of the request is finalized, BandChain will send a new IBC packet that contains the final data back. Relayers will listen and pick up those packets and relay them to your Cosmos SDK app.
After this stage, your Cosmos SDK app can safely use the data obtained from BandChain in its application at every n blocks interval. If the Cosmos SDK app requires additional data, it can submit an update symbols request proposal at any time.