Course Content

Chapter 0: Introduction




Chapter 3: How to deploy/edit an Data script



Chapter 3

How to deploy/edit an Data script

Estimated time: 26 mins


Deploy tools

In order to deploy or edit a data 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 a data script, we need to create MsgCreateOracleScript message and broadcast the message to BandChain.

MsgCreateOracleScript contains 7 parameters:

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

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

MsgEditOracleScript contains 8 parameter:

ParameterTypeDescription string
OracleScriptIDint64The data source identifier
NamestringThe name of the data script to be deployed
DescriptionstringA description of the data script
SchemabytesThe data script's OBI schema
Source Code URLstringAn optional absolute URI to the data script's source code
CodestringThe data script's WebAssembly binary code. Can be raw or gzip compressed
OwnerstringThe address of owner for the data 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: "[do-not-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 data script on BandChain?

Previous Chapter

How to create an data script