Chapter 3
Estimated time: 20 mins
Yoda is a program that BandChain's validator node use to fulfill data requests when they're selected to do so.
Yoda's main job is to listen for incoming oracle requests on BandChain and to execute the corresponding data sources listed within the oracle request. Once the data source is executed and it's results recieved and parsed, the end-results are then collated and packaged into a MsgReportData
, stored in a local pending list then broadcasted onto BandChain.
A data source is the most fundamental unit in BandChain’s oracle system. It describes a proceduce, like a Python script, to retrieve and process a raw data point from a external source.
Anyone is able to deploy and register a data source on BandChain through sending a MsgCreateDataSource
message to BandChain and if an owner is specified, the owner is able to edit a data source through sending a MsgEditDataSource
message to BandChain.
An oracle script is a turing-complete executable program that is at the heart of BandChain. It encodes a set of raw data requests, which is then sent to the data sources, and aggregates the raw data returned from the data sources into a final report.
When an oracle script is called and executed, a data proof is also produced. This proof is a Merkle proof that shows the existence of the final result of the data request on BandChain. In addition to the actual result of the request, the proof also contains information on the request parameters such as the script hash, the time of execution and the number of validators that responded. This proof can then be used by any smart contract on other blockchains to verify that the existence of the data on BandChain and to retrieve the results stored.
Similarly to a data source, anyone is able to deploy or edit an oracle script on BandChain through sending a MsgCreateOracleScript
or MsgEditDataSource
message to BandChain.
During the preperation phase, an oracle script is used to request external data from validators through yoda.
During the execution phase, an oracle script processes the reported data from the validators and returns the output. The processing an oracle script can be done in a variety of ways but a common approach is to medianize the results.
MsgRequestData
needs to be broadcasted in a transaction to BandChain.MsgReportData
containing the data sources results.MsgReportData
is then broadcasted in a message signed by the validator and broadcasted.MsgReportData
is delivered, the reports are then checked to assure that the minimum number of validators have reported the data and once that is assured, the request is added to the PendingResolveList
.