Skip to content

oracle bandchain support #1344

@Pantani

Description

@Pantani

Headline

BandChain’s Oracle module is a communication module built-in compliance with IBC protocol which can query data points of various types from BandChain. In addition, other chains can ask our Oracle module for real-time information according to their needs.

Describe the solution you'd like

  • Create and start your own oracle consumer cosmos blockchain
$ starport scaffold chain github.com/tendermint/bandchain
$ starport module create consuming --ibc --oracle

We can use only the --oracle flag. This is automatically set the ibc flag to true

  • Connect the relayer
$ starport relayer configure -a \
--target-rpc "http://rpc-laozi-testnet2.bandchain.org:26657" \
--target-faucet "https://laozi-testnet2.bandchain.org/faucet/request" \
--target-port "oracle" \
--target-gasprice "0uband" \
--target-prefix "band" \
--target-version "bandchain-1" \
--source-rpc "http://localhost:26657" \
--source-faucet "http://localhost:4500" \
--source-port "consuming" \
--source-gasprice "0.0stake" \
--source-prefix "cosmos"  \
--source-version "bandchain-1"

$ starport relayer connect
  • Request and verify data from the Bandchain blockchain
$ bandchaind tx consuming oracle-data 37 4 3 --channel channel-0 --symbols "BTC,ETH,XRP,BCH" --multiplier 1000000 --fee-limit 30uband --request-key "random_string" --prepare-gas 200000 --execute-gas 200000 --from alice --chain-id bandchain

$ bandchaind query consuming last-oracle-id
request_id: "101276"

$ bandchaind query consuming oracle-result 101276

Describe alternatives you've considered

  • We can scaffold oracle support into an existing module
$ starport oracle --module consuming

pros: you can scaffold an oracle module if you forget the --oracle flag to create them
cons: too much verification and placeholder must be create

Considerations

This oracle packet requires a lot of gas. The TS relayer hardcodes the gas limit when relaying a packet, unlike the go-relayer that can dynamically change the gas limit. TS relayer releases a new version which you can optionally set the gas limit. Setting this to be around 600,000 should fix the problem.
To be able to calculate the gas limit like go-relayer dynamically, TS relayer has to wait for an update from CosmJS according to this issue

To avoid this bug, we must use the go-relayer until we update the TS relayer libraries

TODO:

  • Test integration;
  • Template Files;
  • Module message handlers (OnAcknowledgementPacket and OnRecvPacket);
  • Proto buffer placholders;
  • Keeper placeholders;
  • Types placeholders;
  • Client placeholders;
  • Scaffold OBI encode;

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions