Band Protocol
Band Protocol is a cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts.
Hardware requirements:
Official: 4 CPU x 16 GB RAM x 550 GB SSD - Ubuntu 20.04.
1. Node installation
Set Up variables
# Chain ID of Laozi Mainnet export CHAIN_ID=laozi-mainnet # Wallet name to be used as validator's account, please change this into your name (no whitespace). export WALLET_NAME=<YOUR_WALLET_NAME> # Name of your validator node, please change this into your name. export MONIKER=<YOUR_MONIKER> # URL of genesis file for Laozi Mainnet export GENESIS_FILE_URL=https://raw.githubusercontent.com/bandprotocol/launch/master/laozi-mainnet/genesis.json # Data sources/oracle scripts files export BIN_FILES_URL=https://raw.githubusercontent.com/bandprotocol/launch/master/laozi-mainnet/files.tar.gz
Step 1.1: Install Prerequisites
# install required tools sudo apt-get update && sudo apt-get upgrade -y && \sudo apt-get install -y build-essential curl wget
# Install Go sudo wget -q -O - https://git.io/vQhTU | bash source /$HOME/.bashrc
Step 1.2: Clone & Install Bandchain Laozi
# Clone Bandchain Laozi git clone https://github.com/bandprotocol/chain cd chain && git checkout v2.3.3 # Install binaries make install
Step 1.3: Initialize the Bandchain and download genesis file
cd $HOME # Initialize configuration and genesis state bandd init --chain-id $CHAIN_ID "$MONIKER" # Replace genesis file with our genesis file wget $GENESIS_FILE_URL -O $HOME/.band/config/genesis.json # Download data sources / oracle scripts files, and store in $HOME/.band/files wget -qO- $BIN_FILES_URL | tar xvz -C $HOME/.band/ # Create new account bandd keys add $WALLET_NAME
Step 1.4: Setup seeds or persistence peers of your node to the network.
seeds="[email protected]:26656,[email protected]:26656" peers="[email protected]:26656,[email protected]:26656,[email protected]:58856,[email protected]:41656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:30656,[email protected]:30656,[email protected]:30656,[email protected]:26656" sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/; s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.band/config/config.toml
Step 1.5: Create service
# Write bandd service file to /etc/systemd/system/bandd.service export USERNAME=$(whoami) sudo -E bash -c 'cat << EOF > /etc/systemd/system/bandd.service [Unit] Description=BandChain Node Daemon After=network-online.target [Service] User=$USERNAME ExecStart=/home/$USERNAME/go/bin/bandd start Restart=always RestartSec=3 LimitNOFILE=4096 [Install] WantedBy=multi-user.target EOF'
2. Setup Yoda
Based on design, validator need to send a transaction to submit reports based on certain oracle requests. The validator should send transactions to submit reports within specified timeframe. However, the method is quite tedious. Therefore, we have develop an application called Yoda
, which is a bot application that help validator automatically listen new oracle requests on Bandchain, execute data sources, and submit report to Bandchain, so validators don't have to send the transactions manually.
Step 2.1: Prerequisites
Before setting up Yoda, Lambda function executor need to be setup to execute data sources. If this step has not been done yet, please follow the instructions on following pages (select either one of these methods):
Then, check Yoda version that we have compiled. It should be v2.3.2
.
yoda version # v2.3.2
Step 2.2: Configure Yoda
Firstly, configure Yoda's basic configurations
rm -rf ~/.yoda # clear old config if exist yoda config chain-id $CHAIN_ID yoda config node http://localhost:26657 yoda config broadcast-timeout "5m" yoda config rpc-poll-interval "1s" yoda config max-try 5 yoda config validator $(bandd keys show $WALLET_NAME -a --bech val)
Secondly, add multiple reporter accounts to allow Yoda submitting transactions concurrently.
yoda keys add REPORTER_1 yoda keys add REPORTER_2 yoda keys add REPORTER_3 yoda keys add REPORTER_4 yoda keys add REPORTER_5
Thirdly, config Lambda Executor endpoint
export EXECUTOR_URL=<YOUR_EXECUTOR_URL> yoda config executor "rest:${EXECUTOR_URL}?timeout=10s"
Step 2.3: Start Yoda
We also do recommend to use systemctl
the same as bandd
.
# Write yoda service to /etc/systemd/system/yoda.service export USERNAME=$(whoami) sudo -E bash -c 'cat << EOF > /etc/systemd/system/yoda.service [Unit] Description=Yoda Daemon After=network-online.target [Service] User=$USERNAME ExecStart=/home/$USERNAME/go/bin/yoda run Restart=always RestartSec=3 LimitNOFILE=4096 [Install] WantedBy=multi-user.target EOF'
To register both bandd
and yoda
services, run the following commands.
# Register bandd daemon to systemctl sudo systemctl enable bandd # Register yoda to systemctl sudo systemctl enable yoda
Then start bandd
service which also automatically initiates yoda
# Start bandd daemon sudo systemctl start bandd
Once bandd
service has been started, logs can be queried by running journalctl -u bandd.service -f
command. You will see your node beginning to sync.
After yoda
service has been started, logs can be queried by running journalctl -u yoda.service -f
command. Log should be similar to the following log example below. Once verified, you can stop tailing the log by typing Control-C
.
... systemd[...]: Started Yoda Daemon. ... yoda[...]: I[...] ⭐ Creating HTTP client with node URI: tcp://localhost:26657 ... yoda[...]: I[...] 🚀 Starting WebSocket subscriber ... yoda[...]: I[...] 👂 Subscribing to events with query: tm.event = 'Tx'...
Step 2.4: Wait for latest blocks to be synced
This is an important step. We should wait for newly started Bandchain node to sync their blocks until the latest block is reached. The latest block can be checked on this Block Explorer.
3. Become a Validator
This step provides procedures to register the node as a validator.
Step 3.1: Fund the Validator Account
bandd keys show $WALLET_NAME
Then fund tokens into this account ready for staking.
Step 3.2: Stake Tokens with the Validator Account
bandd tx staking create-validator \ --amount 3000000uband \ --commission-max-change-rate 0.01 \ --commission-max-rate 0.2 \ --commission-rate 0.1 \ --from $WALLET_NAME \ --min-self-delegation 1 \ --moniker "$MONIKER" \ --pubkey $(bandd tendermint show-validator) \ --chain-id $CHAIN_ID
After became a validator, the validator node will be shown on Block Explorer here.
Step 3.3: Register Reporters and Become Oracle Provider
Now, Yoda have multiple reporters. In order to register the reporters to be owned by the validator, the following commands should be run.
Firstly, reporter accounts must be create on Bandchain by supplying some small amount of BAND tokens.
# Send 1uband from a wallet to each reporter. bandd tx multi-send 1uband $(yoda keys list -a) \ --from $WALLET_NAME \ --chain-id $CHAIN_ID
Secondly, register reporters to the validator, so that oracle requests for validator can be assigned to the reporters.
bandd tx oracle add-reporters $(yoda keys list -a) \ --from $WALLET_NAME \ --chain-id $CHAIN_ID
Finally, activate the validator to become an oracle provider
bandd tx oracle activate \ --from $WALLET_NAME \ --chain-id $CHAIN_ID
If all procedures are successful, then oracle provider status for the validator should be active
.
bandd query oracle validator $(bandd keys show -a $WALLET_NAME --bech val) # { # "is_active": true, # "since": ... # }
And now you have become a validator on Bandchain Laozi mainnet. Happy staking
Useful Commands:
Links:
https://www.quicksync.io/networks/band.html
https://github.com/bandprotocol/chain/releases/tag/v2.3.3
https://github.com/bandprotocol/chain/wiki/BandChain-Laozi-Mainnet:-How-to-Join-as-a-Validator
https://github.com/bandprotocol/data-source-runtime/wiki/Setup-Yoda-Runtime-Using-Google-Cloud-Function