Course Content

Chapter 0: Introduction




Chapter 3: How to deploy/edit an oracle script



Chapter 3

How to deploy/edit an oracle script

Estimated time: 26 mins


Deploy tools

In order to deploy or edit an oracle script, either our online IDE: Band Builder or our SDK's pyband and bandchain.js can be used.

Messages

Deploy message

In order to deploy an oracle script, we need to create MsgCreateOracleScript message and broadcast the message to BandChain.

MsgCreateOracleScript contains 7 parameters:

ParameterTypeDescription
NamestringThe name of the oracle script to be deployed
DescriptionstringA description of the oracle script
SchemabytesThe oracle script's OBI schema
Source Code URLstringAn optional absolute URI to the oracle script's source code
CodestringThe oracle script's WebAssembly binary code. Can be raw or gzip compressed
OwnerstringThe address of owner for the oracle script to be deployed
SenderstringThe address of the message sender
Edit message

After an oracle script is deployed, its parameters can be updated if need be. To update an oracle script, we can broadcast a MsgEditOracleScript message to BandChain.

MsgEditOracleScript contains 8 parameter:

ParameterTypeDescription string
OracleScriptIDint64The data source identifier
NamestringThe name of the oracle script to be deployed
DescriptionstringA description of the oracle script
SchemabytesThe oracle script's OBI schema
Source Code URLstringAn optional absolute URI to the oracle script's source code
CodestringThe oracle script's WebAssembly binary code. Can be raw or gzip compressed
OwnerstringThe address of owner for the oracle script to be deployed
SenderstringThe address of the message sender

where the following field can be set as ["do-not-modify] in their respective types if no changes are required from the current value:

  • name: "[do-not-modify]"
  • description: "[do-not-modify"]"
  • schema: "[stringot-modify]"
  • source_code_url: "[do-not-modify]"
  • code: b"[do-not-modify]"

In order to broadcast these messages, our online IDE, Band Builder can be used to both write the data source and deploy it. Alternatively, our SDK's bandchain.js and pyband can also be used.

Examples on how to form a transaction to send messages on pyband can be found here and an example for bandchain.js can be found here.

Quiz

What message needs to be sent to initialize an oracle script on BandChain?

Previous Chapter

How to create an oracle script