Skip to main content

Protocol Messages

Pre-Requisite Readings

Native Cosmos SDK Messages

Stemming from its Cosmos SDK foundation, BandChain supports all types of messages that are native to the SDK.

BandChain Specific Messages

Apart from the messages that stems from the Cosmos SDK, BandChain also supports a number of messages native to its data oracle system. These messages' specification is presented below.

MsgCreateDataSource

Deploys and registers a new data source to BandChain. Once registered, the data source is assigned a unique int64 identifier which can be used to refer to it forever.

Parameters

ParameterTypeDescription
Sendersdk.AccAddressThe address of the message's sender. Note that the sender does not need to be the same as the owner
Ownersdk.AccAddressThe address of the entity who will be responsible for maintaining the data source
NamestringThe human-readable string name for this data source
DescriptionstringThe description of this data source
Executable[]byteThe content of executable to be run by block upon receiving a data request for this data source. The executable can be in any format, as long as it is accepted by the general public.
Treasurysdk.AccAddressTreasury is the account address who receive data source fee from requester.
Feesdk.CoinsFee is the data source fee per AskCount that data provider will receive from requester.

MsgEditDataSource

Edits an existing data source given the unique int64 identifier (i.e. dataSourceID). The sender must be the owner of the data source for the transaction to succeed.

Parameters

ParameterTypeDescription
DataSourceIDint64The unique identifier number assigned to the data source when it was first registered
Sendersdk.AccAddressThe address of the message's sender. Note that the sender does not need to be the same as the owner
Ownersdk.AccAddressThe address of the entity who will be responsible for maintaining the data source
NamestringThe human-readable string name for this data source
DescriptionstringThe description of this data source
Executable[]byteThe content of executable to be run by block validators upon receiving a data request for this data source. The executable can be in any format, as long as it is accepted by the general public.
Treasurysdk.AccAddressTreasury is the account address who receive data source fee from requester.
Feesdk.CoinsFee is the data source fee per AskCount that data provider will receive from requester.

MsgCreateOracleScript

Deploys a new oracle script to BandChain's network. Once registered, the script is assigned a unique int64 identifier which can be used to refer to it forever.

Parameters

ParameterTypeDescription
Sendersdk.AccAddressThe address of the message's sender. Note that the sender does not need to be the same as the owner
Ownersdk.AccAddressThe address of the entity who will be responsible for maintaining the oracle script
NamestringThe human-readable string name for this oracle script
DescriptionstringThe description of this oracle script
Code[]byteThe Owasm-compiled binary attached to this oracle script
SchemastringThe schema detailing the inputs and outputs of this oracle script, as well as the corresponding types
Source Code URLstringThe URL for the source code of this oracle script

MsgEditOracleScript

Edits an existing oracle script given the unique int64 identifier (i.e. oracleScriptID). The sender must be the owner of the oracle script for the transaction to succeed.

Parameters

ParameterTypeDescription
OracleScriptIDint64The unique identifier number assigned to the oracle script when it was first registered on Bandchain
Sendersdk.AccAddressThe address of the message's sender. Note that the sender does not need to be the same as the owner
Ownersdk.AccAddressThe address of the entity who will be responsible for maintaining the oracle script
NamestringThe human-readable string name for this oracle script
DescriptionstringThe description of this oracle script
Code[]byteThe Owasm-compiled binary attached to this oracle script
SchemastringThe schema detailing the inputs and outputs of this oracle script, as well as the corresponding types
Source Code URLstringThe URL for the source code of this oracle script

MsgRequestData

Requests a new data based on an existing oracle script. A data request will be assigned a unique identifier once the transaction is confirmed. After sufficient validators report the raw data points. The results of the data requests will be written and stored permanently on BandChain for future uses.

Parameters

ParameterTypeDescription
OracleScriptIDint64The unique identifier number assigned to the oracle script when it was first registered on Bandchain
Sendersdk.AccAddressThe address of the message's sender.
CalldatastringThe data passed over to the oracle script for the script to use during its execution
AskCountint64The number of validators that are requested to respond to this request
MinCountint64The minimum number of validators necessary for the request to proceed to the execution phase
ClientIDstringthe 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.

MsgReportData

Reports raw data points for the given data request. Each data point corresponds to a data source query issued during the data request script's execution of prepare function.

Parameters

ParameterTypeDescription
RequestIDint64The unique identifier number of the particular request
Validatorsdk.ValAddressThe reporting validator's actual validator address
Reportersdk.AccAddressThe address the reporting validator uses to sign when submitting the report
Data[]struct'{ externalDataId: int64, data: []byte }'The array of raw data points. Each item corresponds to a data source query.

MsgAddReporter

Registers an address to the list of addresses available to a validator when signing and submitting a report.

Parameters

ParameterTypeDescription
ValidatorAddresssdk.ValAddressThe address of the validator wishing to add the reporter address to their list
ReporterAddresssdk.AccAddressThe address to add to the validator's available addresses

MsgRemoveReporter

Remove a previously registered address from the list of addresses available to a validator when signing and submitting a report.

Parameters

ParameterTypeDescription
ValidatorAddresssdk.ValAddressThe address of the validator wishing to add the reporter address to their list
ReporterAddresssdk.AccAddressThe address to remove from the validator's available addresses