---
# System prepended metadata

title: Osmosis-Band Price feed Data(test-net)
tags: [Templates, Book]

---

# Documentation
#### Fetch Price Feed data on osmosis smart contract from bandchain


---------------------------------------
### Table of Contents
_______________________________________
- [Testnet Setup](#Testnet-Setup)
    - [Install osmosisd tool](#Install-osmosisd-tool)
    - [Initialize osmosis test node](#Initialize-osmosis-test-node)
    - [Update Configuration](#Update-Configuration)
    - [Sync with testnet](#Sync-with-testnet)
    - [Run test-net node](#Run-test-net-node)
    - [Configure osmosid client](#Configure-osmosid-client)
    - [Add wallets with funds](#Add-wallets-with-funds)
________________________
- [Price Feed Contract](#Price-Feed-Contract)
    - [Clone Repository](#Clone-Repository)
    - [Build Contract](#Build-Contract)
    - [Upload Contract](#Upload-Contract)
    - [Initialize Contract](#Initialize-Contract)
    - [Useful Commands]()
    
_______________________________________
- [Hermes Relayer](#Hermes-Relayer)
    - [Install Rust Dependencies](#Install-Dependencies)
    - [Build & setup Hermes](#Build-amp-setup-Hermes)
    - [Add keys](#Add-keys)
    - [Configure](#Configure)
    - [Health Check](#Health-Check)
    - [Run Relayer service](#Run-Relayer-service)
    - [Useful Commands](#Useful-Commands1)
_______________________________________
- [Get Price Data](#Get-Price-Data)

_______________________________________
_______________________________________

## Testnet Setup

#### Install osmosisd tool
&nbsp;&nbsp;&nbsp;&nbsp; Clone the official reposiroty
```bash=
git clone https://github.com/osmosis-labs/osmosis.git 
```

&nbsp;&nbsp;&nbsp;&nbsp;Checkout to a version **v25.0.0-rc0**

```bash=
git checkout v25.0.0-rc0 
```

&nbsp;&nbsp;&nbsp;&nbsp;Run the following command to build **osmosisd** command tool.

```bash=
make install 
```

&nbsp;&nbsp;&nbsp;&nbsp;This will generate a **osmosisd** file inside **build** directory.
&nbsp;&nbsp;&nbsp;&nbsp;Copy this **osmosisd** file to system file path. Example command

```bash=
 cp ./build/osmosisd /usr/local/bin/osmosisd 
```

&nbsp;&nbsp;&nbsp;&nbsp;Check osmosisd version.

```bash=
 osmosisd version 
 ```



#### Initialize osmosis test node


``` bash=
MONIKER=my-node
osmosisd init $MONIKER --chain-id osmo-test-5 --home $HOME/.osmosisd osmosisd init <your-key-name> --chain-id osmo-test-5
```
&nbsp;&nbsp;&nbsp;&nbsp;This will generate `genesis.json`, `app.toml`,`client.toml`,`config.toml` and some other files inside `~/.osmosisd/config` directory.
#### Update Configuration
&nbsp;&nbsp;&nbsp;&nbsp;1) Please update `laddr` value to `tcp://0.0.0.0:26657` under 
&nbsp;&nbsp;&nbsp;&nbsp;**RPC Server Configuration Options** in `~/.osmosisd/config/config.toml` file.

&nbsp;&nbsp;&nbsp;&nbsp;2) Please update `address` value to `0.0.0.0:9090` under **gRPC Configuration** in `~/.osmosisd/config/app.toml` file.

&nbsp;&nbsp;&nbsp;&nbsp;3) Please update `address` value to `tcp://0.0.0.0:1317` under **API Configuration** in `~/.osmosisd/config/app.toml` file.

&nbsp;&nbsp;&nbsp;&nbsp;This will help you to make **RPC**, **gRPC**, AND **LCD** service to acess publicly.

&nbsp;&nbsp;&nbsp;&nbsp;**Note:** Assign domains to these services.

#### Sync with testnet
&nbsp;&nbsp;&nbsp;&nbsp;Please visit https://snapshots.testnet.osmosis.zone/ to get the latest snapshot of osmosis-testnet.
&nbsp;&nbsp;&nbsp;&nbsp;Use proviced snapshot link to download latest snap and extract to `~/.osmosisd` directory.

&nbsp;&nbsp;&nbsp;&nbsp;Example command...

```bash=
wget -q -O - https://osmosis.fra1.digitaloceanspaces.com/osmo-test-5/snapshots/v25/osmotest5_7394867.tar.lz4 | lz4 -d | tar -C $HOME/.osmosisd -xvf -
```

&nbsp;&nbsp;&nbsp;&nbsp;Please keep pacence this will took long time depending on the file size to be downloaded.

#### Run test-net node
&nbsp;&nbsp;&nbsp;&nbsp;Use following commands to validate genesis file and run node in testnet state.
```bash=
osmosisd validate-genesis
osmosisd start
```

&nbsp;&nbsp;&nbsp;&nbsp;Please make sure you are receiving latest block heights.
#### Configure osmosid client
&nbsp;&nbsp;&nbsp;&nbsp;Use following command to update osmosisd clint application configuration.
```bash=
osmosisd config chain-id osmo-test-5 
osmosisd config node <your-rpc-domain-here> 
```
&nbsp;&nbsp;&nbsp;&nbsp;Check and confirm abbove changes appied successfully.
```bash=
osmosisd status 
```

#### Add wallets with funds
&nbsp;&nbsp;&nbsp;&nbsp;We have osmosis official git repository in our local machine.
&nbsp;&nbsp;&nbsp;&nbsp;Run following command.

```bash=
make localnet-keys 
```
&nbsp;&nbsp;&nbsp;&nbsp;This will generate accounts which is  pre-configured with one validator and 9 accounts with ION and OSMO balances.

&nbsp;&nbsp;&nbsp;&nbsp;Accounts are as follows...

| Account	| Address	| Mnemonic|
|-----------|-----------|---------|
|lo-val	| osmo1phaxpevm5wecex2jyaqty2a4v02qj7qmlmzk5a osmovaloper1phaxpevm5wecex2jyaqty2a4v02qj7qm9v24r6	| satisfy adjust timber high purchase tuition stool faith fine install that you unaware feed domain license impose boss human eager hat rent enjoy dawn |
|lo-test1	| osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks	| notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius |
| lo-test2	| osmo18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vv |	quality vacuum heart guard buzz spike sight swarm shove special gym robust assume sudden deposit grid alcohol choice devote leader tilt noodle tide penalty |
| lo-test3	| osmo1qwexv7c6sm95lwhzn9027vyu2ccneaqad4w8ka	| symbol force gallery make bulk round subway violin worry mixture penalty kingdom boring survey tool fringe patrol sausage hard admit remember broken alien absorb |
| lo-test4	| osmo14hcxlnwlqtq75ttaxf674vk6mafspg8xwgnn53	| bounce success option birth apple portion aunt rural episode solution hockey pencil lend session cause hedgehog slender journey system canvas decorate razor catch empty |
|lo-test5	| osmo12rr534cer5c0vj53eq4y32lcwguyy7nndt0u2t	| second render cat sing soup reward cluster island bench diet lumber grocery repeat balcony perfect diesel stumble piano distance caught occur example ozone loyal |
| lo-test6	| osmo1nt33cjd5auzh36syym6azgc8tve0jlvklnq7jq	| spatial forest elevator battle also spoon fun skirt flight initial nasty transfer glory palm drama gossip remove fan joke shove label dune debate quick |
| lo-test7	| osmo10qfrpash5g2vk3hppvu45x0g860czur8ff5yx0	| noble width taxi input there patrol clown public spell aunt wish punch moment will misery eight excess arena pen turtle minimum grain vague inmate |
| lo-test8	| osmo1f4tvsdukfwh6s9swrc24gkuz23tp8pd3e9r5fa |	cream sport mango believe inhale text fish rely elegant below earth april wall rug ritual blossom cherry detail length blind digital proof identify ride |
| lo-test9	| osmo1myv43sqgnj5sm4zl98ftl45af9cfzk7nhjxjqh	| index light average senior silent limit usual local involve delay update rack cause inmate wall render magnet common feature laundry exact casual resource hundred |
| lo-test10	| osmo14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgk	| prefer forget visit mistake mixture feel eyebrow autumn shop pair address airport diesel street pass vague innocent poem method awful require hurry unhappy shoulder |


## Price Feed Contract
#### Clone Repository
&nbsp;&nbsp;&nbsp;&nbsp; Please clone cw-band repository from official bandprotocol github.

```bash=
git clone https://github.com/bandprotocol/cw-band.git
```
#### Build Contract
&nbsp;&nbsp;&nbsp;&nbsp;Change directory to above cloned repository.

```bash=
cd cw-band/
```
&nbsp;&nbsp;&nbsp;&nbsp; **docker** is required to build and generate  optimized `.wasm` file.
&nbsp;&nbsp;&nbsp;&nbsp; For docker installation please follow their official guide from [This link](https://docs.docker.com/desktop/install/ubuntu/)
&nbsp;&nbsp;&nbsp;&nbsp;
```bash=
docker run --rm -v "$(pwd)":/code   --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target   --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry   cosmwasm/workspace-optimizer:0.12.7
```
&nbsp;&nbsp;&nbsp;&nbsp;Above command will generate `price_feed.wasm   `file inside `artifacts/` directory.
#### Upload Contract
&nbsp;&nbsp;&nbsp;&nbsp;Please run the following command to upload/deploy **wasm** file and get **CODE_ID.**
&nbsp;&nbsp;&nbsp;&nbsp;
``` bash=
DEPLOYER=lo-test2
CHAIN_ID=osmo-test-5
TX=$(osmosisd tx wasm store artifacts/price_feed.wasm  --from $DEPLOYER --chain-id=osmo-test-5 --gas-prices 0.05uosmo --gas auto --gas-adjustment 1.3 -b sync --output json -y | jq -r '.txhash')
CODE_ID=$(osmosisd query tx $TX --output json | jq -r '.events | map(select(.type == "store_code"))[0].attributes | map(select(.key == "code_id"))[0].value')
echo "Your contract code_id is $CODE_ID"
```
&nbsp;&nbsp;&nbsp;&nbsp;Above code will print out the **CODE_ID** of deployed wasm file.
#### Initialize Contract
&nbsp;&nbsp;&nbsp;&nbsp; Please run the following command to initialize contract for the above deployed `wasm` file.

```bash=
INITIAL_STATE='{"ask_count":"16","client_id":"cw-band-price-feed","execute_gas":"500000","fee_limit":[{"amount":"100000","denom":"uband"}],"min_count":"10","minimum_sources":4,"oracle_script_id":"360","prepare_gas":"100000"}'
osmosisd tx wasm instantiate $CODE_ID $INITIAL_STATE --amount 5uosmo  --label "Price feed contract" --from $DEPLOYER --chain-id $CHAIN_ID --gas-prices 0.1uosmo --gas auto --gas-adjustment 1.3 -y --no-admin
CONTRACT_ADDR=$(osmosisd query wasm list-contract-by-code $CODE_ID --output json | jq -r '.contracts[0]')
echo "Your contract address is $CONTRACT_ADDR"
```
&nbsp;&nbsp;&nbsp;&nbsp; The above command will initialize to get data from bandchain laozi-testnet6 network. 
&nbsp;&nbsp;&nbsp;&nbsp; Here we are using `oracle_script_id` **360** price-feed data. 
&nbsp;&nbsp;&nbsp;&nbsp; Please follow oracle script link [Here](https://laozi-testnet6.cosmoscan.io/oracle-script/360)
#### Useful Commands

## Hermes Relayer
#### Install Dependencies 
```bash=
# Update repository and install go
sudo apt-get install build-essential
wget https://dl.google.com/go/go1.22.3.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
source .profile 
go version
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustc version
cargo version
```

#### Build & setup Hermes
```bash=
cargo install ibc-relayer-cli --bin hermes --locked
```
#### Add keys
```bash=
hermes keys add --chain band-laozi-testnet6 --mnemonic-file <band.mnemonic> --hd-path "m/44'/494'/0'/0/0"
hermes keys add --chain osmo-test-5 --mnemonic-file <osmosis.mnemonic> --hd-path "m/44'/494'/0'/0/0"
```
#### Configure
```yam=
# This is an example configuration for Hermes. It is meant to be
# used as a reference, _NOT_ for configuring a production relayer. 
# If you're looking to configure a production relayer for some chains, 
# try using the `hermes config auto` command to generate a config 
# file that serves as the starting point for configuring Hermes.

# The global section has parameters that apply globally to the relayer operation.
[global]

# Specify the verbosity for the relayer logging output. Default: 'info'
# Valid options are 'error', 'warn', 'info', 'debug', 'trace'.
log_level = 'trace'

# Specify the mode to be used by the relayer. [Required]
[mode]

# Specify the client mode.
[mode.clients]

# Whether or not to enable the client workers. [Required]
enabled = true

# Whether or not to enable periodic refresh of clients. [Default: true]
# This feature only applies to clients that underlie an open channel.
# For Tendermint clients, the frequency at which Hermes refreshes them is 2/3 of their
# trusting period (e.g., refresh every ~9 days if the trusting period is 14 days).
# Note: Even if this is disabled, clients will be refreshed automatically if
#      there is activity on a connection or channel they are involved with.
refresh = true

# Whether or not to enable misbehaviour detection for clients. [Default: true]
misbehaviour = true

# Specify the connections mode.
[mode.connections]

# Whether or not to enable the connection workers for handshake completion. [Required]
enabled = true

# Specify the channels mode.
[mode.channels]

# Whether or not to enable the channel workers for handshake completion. [Required]
enabled = true

# Specify the packets mode.
[mode.packets]

# Whether or not to enable the packet workers. [Required]
enabled = true

# Parametrize the periodic packet clearing feature.
# Interval (in number of blocks) at which pending packets
# should be periodically cleared. A value of '0' will disable
# periodic packet clearing. [Default: 100]
clear_interval = 100

# Whether or not to clear packets on start. [Default: true]
clear_on_start = true

# Toggle the transaction confirmation mechanism.
# The tx confirmation mechanism periodically queries the `/tx_search` RPC
# endpoint to check that previously-submitted transactions
# (to any chain in this config file) have been successfully delivered.
# If they have not been, and `clear_interval = 0`, then those packets are
# queued up for re-submission.
# If set to `false`, the following telemetry metrics will be disabled:
# `acknowledgment_packets_confirmed`, `receive_packets_confirmed` and `timeout_packets_confirmed`.
# [Default: false]
tx_confirmation = false

# Auto register the counterparty payee on a destination chain to
# the relayer's address on the source chain. This can be used
# for simple configuration of the relayer to receive fees for
# relaying RecvPacket on fee-enabled channels.
# For more complex configuration, turn this off and use the CLI
# to manually register the payee addresses.
# [Default: false]
auto_register_counterparty_payee = false

# Set the maximum size for the memo field in ICS20 packets.
# If the size of the memo field is bigger than the configured
# one, the packet will not be relayed.
# The filter can be disabled by setting `enabled = false`.
# [Default: "32KiB"]
#ics20_max_memo_size = { enabled = true, size = "32KiB" }

# Set the maximum size for the receiver field in ICS20 packets.
# If the size of the receiver field is bigger than the configured
# one, the packet will not be relayed.
# The filter can be disabled by setting `enabled = false`.
# [Default: "2KiB"]
#ics20_max_receiver_size = { enabled = true, size = "2KiB" }

# The REST section defines parameters for Hermes' built-in RESTful API.
# https://hermes.informal.systems/rest.html
[rest]

# Whether or not to enable the REST service. Default: false
enabled = false

# Specify the IPv4/6 host over which the built-in HTTP server will serve the RESTful
# API requests. Default: 127.0.0.1
host = '0.0.0.0'

# Specify the port over which the built-in HTTP server will serve the restful API
# requests. Default: 3000
port = 3000


# The telemetry section defines parameters for Hermes' built-in telemetry capabilities.
# https://hermes.informal.systems/telemetry.html
[telemetry]

# Whether or not to enable the telemetry service. Default: false
enabled = false

# Specify the IPv4/6 host over which the built-in HTTP server will serve the metrics
# gathered by the telemetry service. Default: 127.0.0.1
host = '0.0.0.0'

# Specify the port over which the built-in HTTP server will serve the metrics gathered
# by the telemetry service. Default: 3001
port = 3001

[telemetry.buckets]
# Specify the range of the 10 histogram buckets in ms for the `tx_latency_submitted` metric.
# Default: { start = 500, end = 10000, buckets = 10 }
# The default will give the following buckets:
# [500, 2450, 4400, 6350, 8300, 10250, 12200, 14150, 16100, 18050, 20000]
# latency_submitted = { start = 500, end = 20000, buckets = 10 }

# Specify the range of the 10 histogram buckets in ms for the `tx_latency_confirmed` metric.
# Default: { start = 1000, end = 20000, buckets = 10 }
# The default will give the following buckets:
# [1000, 3900, 6800, 9700, 12600, 15500, 18400, 21300, 24200, 27100, 30000]
# latency_confirmed = { start = 1000, end = 30000, buckets = 10 }

# The tracing server section defines parameters for Hermes' server allowing updates to the tracing directives.
#
# https://hermes.informal.systems/advanced/troubleshooting/log-level.html#overriding-the-tracing-filter-during-runtime
[tracing_server]
# Whether or not to enable the tracing server. Default: false
enabled = false

# Specify the port over which the built-in TCP server will serve the directives. Default: 5555
port = 5555

# A chains section includes parameters related to a chain and the full node to which
# the relayer can send transactions and queries.
[[chains]]

# Specify the chain ID. Required
id = 'osmo-test-5'

# Specify the chain type, currently only `CosmosSdk` is supported.
# Default: CosmosSdk
type = "CosmosSdk"

# Whether or not this is a CCV consumer chain. Default: false
# Only specify true for CCV consumer chain, but NOT for sovereign chains.
ccv_consumer_chain = false

# Specify the RPC address and port where the chain RPC server listens on. Required
rpc_addr = 'https://rpc.osmosis-test-5.stockdex.io:443/'

# Specify the GRPC address and port where the chain GRPC server listens on. Required
grpc_addr = 'https://grpc.osmosis-test-5.stockdex.io:443/'

# The type of event source to use for getting events from the chain.
#
# This setting can take two types of values, as an inline table:
# 
# a) Push: for receiving IBC events over WebSocket.
#
#      `{ mode = 'push', url = 'ws://127.0.0.1:26657/websocket', batch_delay = '500ms' }`
#
#    where
#
#    - `url` is the WebSocket URL to connect to. Required
#    - `batch_delay` is the delay until event batch is
#      emitted in the absence of NewBlock event. Default: 500ms
#      Lower values will result in faster event processing, improving the latency of Hermes,
#      but may split the events into more batches than necessary, requiring more client updates
#      to be submitted, yielding higher costs. Higher values will result in slower event
#      processing, increasing the latency of Hermes, but are more likely to batch events together.
#      The default value provides good latency while minimizing the number of client updates needed.

# b) Pull: for polling for IBC events via the `/block_results` RPC endpoint.
#
#     `{ mode = 'pull', interval = '1s', max_retries = 4 }`
#
#    where
#
#    - `interval` is the interval at which to poll for blocks. Default: 1s
#    - `max_retries` is the maximum number of retries to collect events for each block. Default: 4
#
#    This mode should only be used in situations where Hermes misses events that it should be
#    receiving, such as when relaying for CosmWasm-enabled chains which emit IBC events without
#    the `message` attribute. Without this attribute, the WebSocket is not able to catch these
#    events, so the `/block_results` RPC must be used instead.
#
#   event_source = { mode = 'push', url = 'wss://rpc.osmosis-test-5.stockdex.io/websocket', batch_delay = '500ms' }
event_source = { mode = 'pull', interval = '1s', max_retries = 4 }

# Specify the maximum amount of time (duration) that the RPC requests should
# take before timing out. Default: 10s (10 seconds)
# Note: Hermes uses this parameter _only_ in `start` mode; for all other CLIs,
# Hermes uses a large preconfigured timeout (on the order of minutes).
rpc_timeout = '10s'

# Experimental: Whether or not the full node is trusted.
#
# If not trusted, Hermes will verify headers included in the `ClientUpdate` message using the light client.
#
# Note: If the full node is configured as trusted then, in addition to headers not being verified,
#       the verification traces will not be provided.
#       This may cause failure in client updates after significant change in validator sets.
#
# Default: false
trusted_node = false

# Specify the prefix used by the chain. Required
account_prefix = 'osmo'

# Specify the name of the private key to use for signing transactions. Required
# See the Adding Keys chapter for more information about managing signing keys:
#   https://hermes.informal.systems/documentation/commands/keys/index.html#adding-keys
key_name = 'testkey'

# Specify the folder used to store the keys. Optional
# If this is not specified then the hermes home folder is used.
# key_store_folder = '$HOME/.hermes/keys'

# Specify the address type which determines:
# 1) address derivation;
# 2) how to retrieve and decode accounts and pubkeys;
# 3) the message signing method.
# The current configuration options are for Cosmos SDK and Ethermint.
#
# Example configuration for chains based on Ethermint library:
#
# address_type = { derivation = 'ethermint', proto_type = { pk_type = '/ethermint.crypto.v1.ethsecp256k1.PubKey' } }
#
# Default: { derivation = 'cosmos' }, i.e. address derivation as in Cosmos SDK.
# Warning: This is an advanced feature! Modify with caution.
address_type = { derivation = 'cosmos' }

# Specify the store prefix used by the on-chain IBC modules. Required
# Recommended value for Cosmos SDK: 'ibc'
store_prefix = 'ibc'

# Gas Parameters
# 
# The term 'gas' is used to denote the amount of computation needed to execute
# and validate a transaction on-chain. It can be thought of as fuel that gets 
# spent in order to power the on-chain execution of a transaction.
#
# Hermes attempts to simulate how much gas a transaction will expend on its 
# target chain. From that, it calculates the cost of that gas by multiplying the
# amount of estimated gas by the `gas_multiplier` and the `gas_price`
# (estimated gas * `gas_multiplier` * `gas_price`) in order to compute the 
# total fee to be deducted from the relayer's wallet.
# 
# The `simulate_tx` operation does not always correctly estimate the appropriate
# amount of gas that a transaction requires. In those cases when the operation 
# fails, Hermes will attempt to submit the transaction using the specified 
# `default_gas` and `max_gas` parameters. In the case that a transaction would 
# require more than `max_gas`, it doesn't get submitted and a 
# `TxSimulateGasEstimateExceeded` error is returned.

# Specify the default amount of gas to be used in case the tx simulation fails,
# and Hermes cannot estimate the amount of gas needed.
# Default: 100 000
default_gas = 100000

# Specify the maximum amount of gas to be used as the gas limit for a transaction.
# If `default_gas` is unspecified, then `max_gas` will be used as `default_gas`.
# Default: 400 000
max_gas = 4000000

# Specify the price per gas used of the fee to submit a transaction and
# the denomination of the fee. 
# 
# The specified gas price should always be greater or equal to the `min-gas-price`
# configured on the chain. This is to ensure that at least some minimal price is 
# paid for each unit of gas per transaction.
# 
# Required
gas_price = { price = 0.025, denom = 'uosmo' }

# Multiply this amount with the gas estimate, used to compute the fee
# and account for potential estimation error.
#
# The purpose of multiplying by `gas_multiplier` is to provide a bit of a buffer
# to catch some of the cases when the gas estimation calculation is on the low
# end. 
# 
# Example: With this setting set to 1.1, then if the estimated gas
# is 80_000, then gas used to compute the fee will be adjusted to
# 80_000 * 1.1 = 88_000.
#
# Default: 1.1, ie. the gas is increased by 10%
# Minimum value: 1.0
gas_multiplier = 1.1

# Query the current gas price from the chain instead of using the static `gas_price` from the config.
# Useful for chains which have [EIP-1559][eip]-like dynamic gas price. 
#
# At the moment, only chains which support the `osmosis.txfees.v1beta1.Query/GetEipBaseFee`
# query can be used with dynamic gas price enabled.
#
# See this page in the Hermes guide for more information:
# https://hermes.informal.systems/documentation/configuration/dynamic-gas-fees.html
# 
# Default: { enabled = false, multiplier = 1.1, max = 0.6 }
dynamic_gas_price = { enabled = false, multiplier = 1.1, max = 0.6 }

# Specify how many IBC messages at most to include in a single transaction.
# Default: 30
max_msg_num = 30

# Specify the maximum size, in bytes, of each transaction that Hermes will submit.
# Default: 2097152 (2 MiB)
max_tx_size = 2097152

# How many packets to fetch at once from the chain when clearing packets.
# Default: 50
query_packets_chunk_size = 50

# Specify the maximum amount of time to tolerate a clock drift.
# The clock drift parameter defines how much new (untrusted) header's time
# can drift into the future. Default: 5s
clock_drift = '5s'

# Specify the fallback value for the maximum time per block for this chain.
# The block time together with the clock drift are added to the source drift to estimate
# the maximum clock drift when creating a client on this chain. Default: 30s
# When validating the configuration, Hermes will query the /genesis RPC endpoint in order
# to retrieve the `max_expected_time_per_block` and use it as the `max_block_time`.
# If the query fails, the configured `max_block_time` is used instead.
# For cosmos-SDK chains a good approximation is `timeout_propose` + `timeout_commit`
# Note: This MUST be the same as the `max_expected_time_per_block` genesis parameter for Tendermint chains.
max_block_time = '30s'

# Specify the amount of time to be used as the light client trusting period.
# It should be significantly less than the unbonding period
# (e.g. unbonding period = 3 weeks, trusting period = 2 weeks).
#
# Default: 2/3 of the `unbonding period` for Cosmos SDK chains
trusting_period = '3days'

# The rate at which to refresh the client referencing this chain,
# expressed as a fraction of the trusting period.
#
# Default: 1/3 (ie. three times per trusting period)
client_refresh_rate = '1/3'

# Specify the trust threshold for the light client, ie. the minimum fraction of validators
# which must overlap across two blocks during light client verification.
#
# Warning: This is an advanced feature! Modify with caution.
#
# Default: 2/3
trust_threshold = '2/3'

# Specify a string that Hermes will use as a memo for each transaction it submits
# to this chain. The string is limited to 50 characters. Default: '' (empty).
# Note: Hermes will append to the string defined here additional
# operational debugging information, e.g., relayer build version.
memo_prefix = ''

# If this is set to a string, it will overwrite the memo used by Hermes for each transaction
# it submits to this chain.
# Default: not set.
# This is used for chains which have a very small character limit for the memo,
# and the additional information appended by Hermes would overflow that limit.
# memo_overwrite = ''

# This section specifies the filters for policy based relaying.
#
# Default: no policy / filters, allow all packets on all channels.
#
# Only packet filtering based on channel identifier can be specified.
# A channel filter has two fields:
# 1. `policy` - one of two types are supported:
#       - 'allow': permit relaying _only on_ the port/channel id in the list below,
#       - 'deny': permit relaying on any channel _except for_ the list below.
# 2. `list` - the list of channels specified by the port and channel identifiers.
#             Optionally, each element may also contains wildcards, for eg. 'ica*'
#             to match all identifiers starting with 'ica' or '*' to match all identifiers.
#
# Example configuration of a channel filter, only allowing packet relaying on
# channel with port ID 'transfer' and channel ID 'channel-0', as well as on
# all ICA channels.
#
# [chains.packet_filter]
# policy = 'allow'
# list = [
#   ['ica*', '*'],
#   ['transfer', 'channel-0'],
# ]

# This section specifies the filters for incentivized packet relaying.
# Default: no filters, will relay all packets even if they
# are not incentivized.
#
# It is possible to specify the channel or use wildcards for the
# channels.
# The only fee which can be parametrized is the `recv_fee`.
#
# Example configuration of a filter which will only relay incentivized
# packets, with no regards for channel and amount.
#
# [chains.packet_filter.min_fees.'*']
# recv = [ { amount = 0 } ]
#
# Example configuration of a filter which will only relay packets if they are
# from the channel 'channel-0', and they have a `recv_fee` of at least 20 stake
# or 10 uatom.
#
# [chains.packet_filter.min_fees.'channel-0']
# recv = [ { amount = 20, denom = 'stake' }, { amount = 10, denom = 'uatom' } ]

# Specify that the transaction fees should be paid from this fee granter's account.
# Optional. If unspecified (the default behavior), then no fee granter is used, and
# the account specified in `key_name` will pay the tx fees for all transactions
# submitted to this chain.
# fee_granter = ''

# Specify the CometBFT compatibility mode to use.
# The following behaviours are applied whether the `compat_mode` is configured or not:
#   * compat_mode is specified and the version queried from /status is the same as the one configured: Use that version without log output
#   * compat_mode is specified but the version queried from /status differs: The CompatMode configured is used, but a warning log is outputted
#   * compat_mode is not specified but /status returns a correct version: The CompatMode retrieved from the endpoint is used
#   * compat_mode is not specified and /status does not return a valid version: Hermes stops and outputs an error informing the user a compat_mode needs to be configured
# Possible values: [`0.34`, `0.37`]
# compat_mode = '0.34'

# Specify the a clear interval for the chain.
# This will override the global clear interval for this chain only, allowing different intervals for each chain.
# clear_interval = 50

# Specify packet sequences which should not be cleared, per channel.
#
# For each channel, specify a list of sequences which should not be cleared, eg.
#
#   excluded_sequences = [
#     ['channel-0', [1, 2, 3]],
#     ['channel-1', [4, 5, 6]]
#  ]
#
# Default: No filter
# excluded_sequences = []

[[chains]]
id = 'band-laozi-testnet6'
rpc_addr = 'https://rpc.laozi-testnet6.bandchain.org:443/'
grpc_addr = 'https://laozi-testnet6.bandchain.org:443/'
# event_source = { mode = 'push', url = 'wss://rpc.laozi-testnet6.bandchain.org/websocket', batch_delay = '500ms' }
event_source = { mode = 'pull', interval = '1s', max_retries = 4 }
rpc_timeout = '10s'
trusted_node = false
account_prefix = 'band'
key_name = 'testkey'
store_prefix = 'ibc'
default_gas = 100000
max_gas = 4000000
gas_price = { price = 0.025, denom = 'uband' }
gas_multiplier = 1.1
max_msg_num = 30
max_tx_size = 2097152
clock_drift = '5s'
max_block_time = '30s'
trusting_period = '3days'
trust_threshold = '2/3'
address_type = { derivation = 'cosmos' }

```
#### Health Check
```bash=
hermes health-check
```
#### Run Relayer service
##### Create Channel
```bash=
hermes create channel --a-chain band-laozi-testnet6 --b-chain osmo-test-5 --a-port oracle --b-port wasm.osmo1n5tknme9q7k8xysm7d2t34z00ktg3jvkm9m7mq7u8s9jm6w777sqjtwepu --order unordered --channel-version bandchain-1 --new-client-connection
```
Above command will took some time to create the channels between band and osmo testnet and provide following output. which will have channel-ids.
```json=
SUCCESS Channel {
    ordering: Unordered,
    a_side: ChannelSide {
        chain: BaseChainHandle {
            chain_id: ChainId {
                id: "band-laozi-testnet6",
                version: 0,
            },
            runtime_sender: Sender { .. },
        },
        client_id: ClientId(
            "07-tendermint-1154",
        ),
        connection_id: ConnectionId(
            "connection-1001",
        ),
        port_id: PortId(
            "oracle",
        ),
        channel_id: Some(
            ChannelId(
                "channel-861",
            ),
        ),
        version: Some(
            Version(
                "bandchain-1",
            ),
        ),
    },
    b_side: ChannelSide {
        chain: BaseChainHandle {
            chain_id: ChainId {
                id: "osmo-test-5",
                version: 5,
            },
            runtime_sender: Sender { .. },
        },
        client_id: ClientId(
            "07-tendermint-3556",
        ),
        connection_id: ConnectionId(
            "connection-3116",
        ),
        port_id: PortId(
            "wasm.osmo1n5tknme9q7k8xysm7d2t34z00ktg3jvkm9m7mq7u8s9jm6w777sqjtwepu",
        ),
        channel_id: Some(
            ChannelId(
                "channel-7977",
            ),
        ),
        version: Some(
            Version(
                "bandchain-1",
            ),
        ),
    },
    connection_delay: 0ns,
}
```
##### Run hermes relayer
```bash=
hermes start
```


## Get Price Data


#### Update Price Data onchain.

```bash=
osmosisd tx wasm execute osmo1n5tknme9q7k8xysm7d2t34z00ktg3jvkm9m7mq7u8s9jm6w777sqjtwepu '{"request":{"symbols": ["BTC"] }}' --from lo-val -y --chain-id=osmo-test-5 --gas-prices 0.01uosmo --gas auto --gas-adjustment 1.3
```

#### Query price data
```bash=
osmosisd query wasm contract-state smart osmo1n5tknme9q7k8xysm7d2t34z00ktg3jvkm9m7mq7u8s9jm6w777sqjtwepu '{"get_rate":{"symbol":"BTC"}}' --chain-id osmo-test-5
```
