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
    # Migration of GuanYu Testnet #4 to Laozi Testnet #1 This document describes procedures to upgrade Bandchain from GuanYu testnet #4 to a Laozi testnet #1. We will perform these steps together at following block and date ```env GUANYU_HALTED_BLOCK=183838 LAOZI_GENESIS_DATE="2021-05-13T15:00:00Z" ``` ## Setup environment ```bash! # Laozi's genesis date export GENESIS_DATE="2021-05-13T15:00:00Z" # GuanYu's halted block export HALTED_BLOCK=183838 # validator's wallet export WALLET_NAME=<YOUR_WALLET> # Laozi's new node name export MONIKER=<YOUR_MONIKER> export CHAIN_ID_LAOZI=band-laozi-testnet1 export CHAIN_ID_GUANYU=band-guanyu-testnet4 export PERSISTENT_PEERS_LAOZI="f4f5d520a65e4b0c64b9f139758ec36e595ef843@35.240.194.225:26656,2056308116c741434d61a7bd482bac1c3ceb306a@35.244.13.157:26656" export PERSISTENT_PEERS_GUANYU="9d6c18be762b76c5eded626e70d343ddaaacb361@34.87.136.8:26656,74a3d65ea7ba44e4ef617d72faece1a627819703@35.200.195.237:26656" ``` ## Migrate Validator ### 1. Stop current node by running the command below ```bash= sudo systemctl stop bandd.service sudo systemctl stop yoda.service ``` ### 2. Upgrade GuanYu node to the latest version preparing for exporting genesis file Since there is latest patch that improve exporting genesis file method, latest version of GuanYu Bandchain is required. ```bash= cd bandchain/chain git checkout master git pull git checkout v1.3.0-rc0 make install ``` Please make sure that `bandd` and `bandcli` is now the latest version. ```bash= bandd version --long # name: bandchain # server_name: bandd # client_name: bandcli # version: 1.3.0-rc0 # commit: 49e2ae8f644eeceb814c2dab005dec400ce0f8e7 # build_tags: ledger # go: go version go1.14.15 linux/amd64 ``` ### 3. Export genesis file & wallet The following information will be included in the genesis file ```bash= cd $HOME bandd export --for-zero-height --height $HALTED_BLOCK > guanyu_testnet3_genesis.json ``` If wallet exists in exisitng chain, they can be exported. ```bash= bandcli keys export $WALLET_NAME ``` After run the command, it will ask to input password to encrypt the private key. Then, private key will be displayed on terminal, similar to the example below. ```bash # # -----BEGIN TENDERMINT PRIVATE KEY----- # ... # -----END TENDERMINT PRIVATE KEY----- # ``` Copy the result similar to above and save to a file. ```bash= vim $HOME/${WALLET_NAME}_privkey.txt ``` ### 4. Verify integrity genesis file. Expected hash of the genesis file will be announced on Band Protocol's discord channel). In order to preserve consistency of generating hash, all fields in JSON content should be sorted. This can be done by using `jq` command. Then, pipe the output to `shasum` to produce hash. ```bash= sudo apt-get update sudo apt-get install -y jq jq -S -c -M '' guanyu_testnet3_genesis.json | shasum -a 256 # fa1087294e54f230c492ecbe89fd7bc97b32bb27309d71a140a06453cff936af ``` We will announce a SHA256 hash to be compared with your hash, so, **Please compare them before further steps**. ### 5. Install Laozi version of bandd (**v2.0.0-rc0**). After genesis file of GuanYu is exported, new version of bandd **v2.0.0-rc0** will be used to begin initializing and run the new Laozi node. This can be done by executing the following commands. ```bash= # Remove old version of go (1.14) rm -r $HOME/go/bin sudo rm -r /usr/local/go # Install new version of go (1.15) wget https://dl.google.com/go/go1.15.8.linux-amd64.tar.gz sudo tar -C /usr/local -xzf go1.15.8.linux-amd64.tar.gz echo "export PATH=\$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.profile source $HOME/.profile # Clone Laozi code from new repository and build bandd and yoda git clone https://github.com/bandprotocol/chain.git cd chain git checkout v2.0.0-rc0 make install ``` Make sure that `bandd` version is the latest Laozi version. ```bash= bandd version --long # name: bandchain # server_name: bandd # version: 2.0.0-rc0 # commit: da9bad3e887a764bedde27dca89ba670c3122a4b # build_tags: ledger # go: go version go1.15.8 linux/amd64 ``` ### 6. Migrate the exported genesis file to be compatible with Laozi Bandchain Since GuanYu Bandchain uses Cosmos SDK v0.39 while Laozi Bandchain uses Cosmos SDK v0.42, Migrating the genesis file is required for compatibility. After migrated the genesis file, please make sure that SHA256 hash of the file is valid. ```bash= cd $HOME bandd migrate guanyu_testnet3_genesis.json --chain-id=$CHAIN_ID_LAOZI --genesis-time=$GENESIS_DATE > laozi_testnet1_genesis.json jq -S -c -M '' laozi_testnet1_genesis.json | shasum -a 256 # 0a6289b4b047af32647caeb1de8ab170d91e838beb4169447ae0af81b6135e6a ``` We will announce a SHA256 hash to be compared with your hash, so, **Please compare them before further steps**. ### 7. Initialize Laozi Bandchain node Init the Laozi node and copy configuration files from QuanYu folder (.bandd) to Laozi folder (.band). ```bash= bandd init $MONIKER --chain-id $CHAIN_ID_LAOZI cp $HOME/.bandd/config/priv_validator_key.json $HOME/.band/config cp $HOME/.bandd/config/node_key.json $HOME/.band/config cp -r $HOME/.bandd/files $HOME/.band mv laozi_testnet1_genesis.json $HOME/.band/config/genesis.json ``` Import the exported key to the node. When importing the key, it will ask for password to decrypt the key. ```bash= # Only import if you have exported key bandd keys import $WALLET_NAME $HOME/${WALLET_NAME}_privkey.txt # Please make sure that the key has been imported successfully bandd keys list # If key has been import successfully, then delete the file rm $HOME/${WALLET_NAME}_privkey.txt ``` After imported the key. Make sure that the key has been imported successfully by running the command `bandd keys list`. ### 8. Update persistence peers of your node to BandChain peers. This can be done by editing `persistent_peers` property in `$HOME/.band/config/config.toml`. ```bash= sed -E -i \ "s/persistent_peers = \".*\"/persistent_peers = \"$PERSISTENT_PEERS_LAOZI\"/" \ $HOME/.band/config/config.toml ``` ### 9. Finally, start Laozi Bandchain ```bash= sudo systemctl start bandd ``` Log output can be showed with `journalctl -u bandd.service -f`. If genesis time is future, the node will wait until reach the genesis time to start the first block. Log should be displayed similar to following log ``` ... INF Starting Node service impl=Node ... INF Genesis time is in the future. Sleeping until then... genTime=2021-04-23T11:00:00Z ``` If all goes well, the node daemon should have been started syncing after pass agreed block time. **You may continue seting up Yoda to 1st step, then wait for genesis block to begin, then start the 3th step of Yoda Migation.** ``` ... INF starting ABCI with Tendermint . . . ... INF committed state app_hash=... height=1 module=state num_txs=0 ... INF indexed block height=1 module=txindex ``` ## Migrate Yoda Keyring folder of Yoda should be renamed to `keyring-test`. ### 1. Migrate keyring ```bash= # PLEASE MAKE SURE THAT NO TRALING SLASH IN BOTH PATHS mv $HOME/.yoda/keyring-test-band $HOME/.yoda/keyring-test ``` ### 2. Start Yoda First let's config Yoda to use the new chain ID. ```bash= yoda config chain-id $CHAIN_ID_LAOZI ``` Then, start the Yoda. ```bash= sudo systemctl start yoda ``` type `journalctl -u yoda.service -f` to view Yoda log. ### 3. Send MsgActivate to reactivate yourself as an oracle provider ```bash= bandd tx oracle activate \ --from $WALLET_NAME \ --chain-id $CHAIN_ID_LAOZI ``` Now, block explorer can be accessed [here](https://laozi-testnet1.cosmoscan.io) to check your validator status. And that is all about upgrading Bandchain node to the new era. Happy staking :). ## Recovery Procedures In case we need to rollback to GuanYu testnet #4, please follow these steps. ### 1. Stop current node by running the command below ```bash= sudo systemctl stop bandd sudo systemctl stop yoda ``` ### 2. Install go 1.14 ```bash= rm -r $HOME/go/bin sudo rm -r /usr/local/go # Install go sudo tar -C /usr/local -xzf go1.14.15.linux-amd64.tar.gz echo "export PATH=\$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.profile source $HOME/.profile ``` ### 3. Bring back `bandd` **v1.2.7a** and `yoda` ```bash= cd bandchain/chain git checkout v1.2.7a make install # PLEASE MAKE SURE THAT NO TRALING SLASH IN BOTH PATHS mv $HOME/.yoda/keyring-test $HOME/.yoda/keyring-test-band ``` ### 4. Update persistence peers of your node to BandChain peers. ```bash= sed -E -i \ "s/persistent_peers = \".*\"/persistent_peers = \"${PERSISTENT_PEERS_GUANYU}\"/" \ $HOME/.bandd/config/config.toml ``` ### 5. Restart bandd service ```bash= sudo systemctl start bandd ``` Tail the log output with `journalctl -u bandd.service -f`. If all goes well, you should see that the node daemon has started syncing on wenchang-mainnet chain again. ``` ... bandd: I[..] starting ABCI with Tendermint module=main ... bandd: I[..] Executed block module=state height=xx validTxs=0 invalidTxs=0 ... bandd: I[..] Committed state module=state height=xx txs=0 appHash=... ... ``` ### 6. Re-config & Start Yoda Set Yoda chain ID to the old ID, then start it. ```bash= yoda config chain-id $CHAIN_ID_GUANYU sudo systemctl start yoda ```

    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