Nathachai Jaiboon
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Bandchain GuanYu Testnet #4: How to Join as a Validator This document describes methods on how to join as a validator in GuanYu testnet #4. ## Step 1: Setting Up Validator Node This step provides procedures to install Bandchain's executable and sync blocks with other peers. Assuming to run on Ubuntu 20.04 LTS allowing connection on port `26656` for P2P connection. Before beginning instructions, following variables should be set to be used in further instructions. ```bash= # Chain ID of testnet #4 export CHAIN_ID=band-guanyu-testnet4 # 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> # Persistent peers for P2P communication export PERSISTENT_PEERS="9d6c18be762b76c5eded626e70d343ddaaacb361@34.87.136.8:26656,74a3d65ea7ba44e4ef617d72faece1a627819703@35.200.195.237:26656" # URL of genesis file for GuanYu testnet #4 export GENESIS_FILE_URL=https://raw.githubusercontent.com/bandprotocol/launch/master/band-guanyu-testnet4/genesis.json # Data sources/oracle scripts files export BIN_FILES_URL=https://raw.githubusercontent.com/bandprotocol/launch/master/band-guanyu-testnet4/files.tar.gz # Faucet endpoint export FAUCET_URL=https://guanyu-testnet4.bandchain.org/faucet/request ``` ### Step 1.1: Install Prerequisites The following application is required for Building and running Bandchain node. - Go 1.14 - make, gcc, g++ (can be obtained from `build-essential` package on linux) - wget, curl for downloading files ```bash= # install required tools sudo apt-get update && \ sudo apt-get upgrade -y && \ sudo apt-get install -y build-essential curl wget # Install Go 1.14.15 wget https://dl.google.com/go/go1.14.15.linux-amd64.tar.gz tar xf go1.14.15.linux-amd64.tar.gz sudo mv go /usr/local/go # Set Go path to $PATH variable echo "export PATH=\$PATH:/usr/local/go/bin:~/go/bin" >> $HOME/.profile source ~/.profile ``` Go binary should be at `/usr/local/go/bin` and any executable compiled by `go install` command should be at `~/go/bin` ### Step 1.2: Clone & Install Bandchain GuanYu ```bash= # Clone Bandchain GuanYu version v1.2.7a git clone https://github.com/bandprotocol/bandchain cd bandchain/chain git checkout v1.2.7a # Install binaries to ~/go/bin make install ``` ### Step 1.3: Initialize the Bandchain ```bash= 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/.bandd/config/genesis.json # Download data sources / oracle scripts files, and store in $HOME/.bandd/files wget -qO- $BIN_FILES_URL | tar xvz -C $HOME/.bandd/ ``` ### Step 1.4: Setup Peers ```bash= # Add persistent peers to config.toml sed -E -i \ "s/persistent_peers = \".*\"/persistent_peers = \"${PERSISTENT_PEERS}\"/" \ $HOME/.bandd/config/config.toml ``` ### Step 1.5: Start Running Bandchain We do recommend to run bandchain node as a daemon, which can be setup using `systemctl`. Run the following command to create a new daemon for `bandd` (This script work on non-root user). ```bash= # 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 --rpc.laddr tcp://0.0.0.0:26657 Restart=always RestartSec=3 LimitNOFILE=4096 [Install] WantedBy=multi-user.target EOF' ``` To register and start the daemon, run the following command. ```bash= # Register bandd daemon to systemctl sudo systemctl enable bandd # 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. ### Step 1.5: 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](https://guanyu-testnet4.cosmoscan.io). ## Step 2: Become a Validator This step provides procedures to register the node as a validator. ### Step 2.1: Create new Account to be Used as Validator ```bash= # Create new account bandcli keys add $WALLET_NAME # Request new coins from faucet curl --location --request POST "${FAUCET_URL}" \ --header 'Content-Type: application/json' \ --data-raw "{ \"address\": \"$(bandcli keys show $WALLET_NAME -a)\" }" ``` ### Step 2.2: Stake Tokens with the Validator Account ```bash= bandcli 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](https://guanyu-testnet4.cosmoscan.io/validators). ## Step 3: 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 3.1: Prerequisites Before setting up Yoda, a REST endpoint 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): - [AWS Lambda Function](https://github.com/bandprotocol/bandchain/wiki/AWS-lambda-executor-setup). - [Google Cloud Function](https://github.com/bandprotocol/bandchain/wiki/Google-Cloud-Function-executor-setup) Then, check Yoda version that we have compiled. It should be `v1.2.7a`. ```bash= yoda version # 1.2.7a ``` ### Step 3.2: Configure Yoda Firstly, configure Yoda's basic configurations ```bash= rm -rf ~/.yoda # clear old config if exist yoda config chain-id $CHAIN_ID yoda config node http://localhost:26657 yoda config validator $(bandcli keys show $WALLET_NAME -a --bech val) yoda config broadcast-timeout "5m" yoda config rpc-poll-interval "1s" yoda config max-try 5 ``` Secondly, add multiple reporter accounts to allow Yoda submitting transactions concurrently. ```bash= 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 Executor REST endpoint ```bash= export EXECUTOR_URL=<YOUR_EXECUTOR_URL> yoda config executor "rest:${EXECUTOR_URL}?timeout=10s" ``` ### Step 3.3: Start Yoda We also do recommend to use `systemctl` the same as `bandd`. ```bash= # 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' ``` Then, register and start the service ```bash= # Register yoda to systemctl sudo systemctl enable yoda # Start the Yoda service sudo systemctl start yoda ``` Once `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`. ```bash= ... 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 3.4: 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. ```bash= # Send 1uband from a wallet to each reporter. bandcli 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. ```bash= bandcli tx oracle add-reporters $(yoda keys list -a) \ --from $WALLET_NAME \ --chain-id $CHAIN_ID ``` Finally, activate the validator to become an oracle provider ```bash= bandcli 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`. ```bash= bandcli query oracle validator $(bandcli keys show -a $WALLET_NAME --bech val) # { # "is_active": true, # "since": ... # } ``` And now you have become a validator on Bandchain GuanYu testnet #4. Happy staking :chart_with_upwards_trend:, and may the **HODL** be with you.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully