Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Cosmos IBC Packets

Sawit Trisirisatayawong edited this page May 19, 2020 · 3 revisions

IBC Compatibility Overview

In addition to our own lite client protocol, we also allow interaction with our data oracle through Cosmos' Inter-Blockchain-Communication, or IBC, protocol. This allows other IBC-compatible blockchains to request data from BandChain.

BandChain-Specific IBC Data Packets

OracleRequestPacketData

This is the data packet that the blockchain looking to send a request to BandChain's oracle must send.

Parameter Type Description
ClientID string the unique identifier of this oracle request, as specified by the client. This same unique ID will be sent back to the requester with the oracle response.
OracleScriptID int64 The unique identifier number assigned to the oracle script when it was first registered on Bandchain
Sender sdk.AccAddress The address of the message's sender.
Calldata string The data passed over to the oracle script for the script to use during its execution
AskCount int64 The number of validators that are requested to respond to this request
MinCount int64 The minimum number of validators necessary for the request to proceed to the execution phase

OracleResponsePacketData

Subsequently, this is the packet that will be relayed from BandChain back to the requester's chain. It contains information on the response parameters as well as the requested data itself.

Parameter Type Description
ClientID string The unique identifier of this oracle request, as specified by the client. This matches the ID stated in the corresponding OracleRequestPacketData
RequestID uint64 The unique identifier number of the particular request
AnsCount uint64 The number of validators that answers the request, retrieved the data, and submitted a report
RequestTime uint64 The timestamp of when the request was made
ResolveTime uint64 The timestamp of when the last validator submitted the report and the request is resolved
ResolveStatus uint8 The resolve status of the request. See here for the full list of possible values
Result []byte The aggregated value of the results returned by the validators

Requesting Data from BandChain Oracle using IBC

To make a request to BandChain's oracle using IBC, the module on some chain A looking to make the request must generate an OracleRequestPacketData data packet to be relayed. Using their chain's IBC module, they must then relay the message through to BandChain's own IBC module, which will proceed to further send it to the chain's oracle module. Once the request packet is successfully received, it will be converted into BandChain's native MsgRequestData message type, which will then be treated the same way as any other oracle data request.

Once the requested data is successfully retrieved and stored on BandChain, an OracleResponsePacketData data packet containing the result and other information about the response will be relayed back using the same IBC relayer to the chain A and the specific module that requested the data.

For more information on IBC, its architecture, and other information, please see Cosmos' Interchain Standards documentation.