Update: The guide was update, have a look into our community- https://btsg.community/t/guide-to-joining-the-bitsong-testnet-2/32

Getting Started

First off, you’ll need to setup a server. Having a dedicated server helps ensure that your validator is highly available and doesn’t go offline. BitSong Network uses Tendermint consensus, which selects a leader for each block. If your validator is offline when it gets chosen as a leader, consensus will take longer, and you could even get slashed!

For this guide, we’ll be using a server with the following specifications:

Ubuntu 18.04 OS

2 CPUs

4GB RAM

24GB SSD

Allow incoming connections on ports 26656

Static IP address (Elastic IP for AWS, floating IP for DigitalOcean, etc)

You can get a server with these specifications on most cloud service providers (AWS, DigitalOcean, Google Cloud Platform, Linode, etc).

After logging into your server, we’ll install security updates and the required packages to run BitSong:

# Update Ubuntu

sudo apt update

sudo apt upgrade -y # Installs packages necessary to run go

sudo apt install build-essential libleveldb1v5 git unzip -y # Installs go

wget [https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz](https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz)

sudo tar -xvf go1.12.7.linux-amd64.tar.gz

sudo mv go /usr/local # Updates environmental variables to include go

cat <<EOF >> ~/.profile

export GOPATH=$HOME/go

export GO111MODULE=on

export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin

EOF source ~/.profile

To verify that go is installed:

go version # Should return go version go1.12.7 linux/amd64

Install the Go-BitSong daemon

Next, we’ll install the software needed to run the BitSong blockchain.

Note that if you are updating your server from bitsong-testnet-1 to bitsong-testnet-2, you can skip to the section ‘Updating From bitsong-testnet-1 to bitsong-testnet-2’.

# Clone your repository

git clone https://github.com/bitsongofficial/go-bitsong.git # install binaries

cd go-bitsong

git checkout v0.2.1

make install

To verify the version

bitsongd version --long # name: go-bitsong

# server_name: bitsongd

# client_name: bitsongcli

# version: 0.2.1

# commit: 1f6a83d03eef1208e58f8a1068ff1afaee16e4a8

# build_tags: netgo,ledger

# go: go version go1.12.7 linux/amd64

Now, we’ll setup the bitsongd software to run the current BitSong testnet:

# Replace <your-moniker> with the publicly viewable name for your validator.

# bitsong-testnet-2 is the name of the current testnet bitsongd init --chain-id bitsong-testnet-2 <your-moniker>

Note: bitsongd init sets the node-id of your validator. You can see this value by doing bitsongd tendermint show-node-id . The node-id value will become part of your genesis transaction, so if you are planning on submitting a genesis transaction, don’t reset your node-id by doing bitsongd unsafe-reset-all or changing your public IP address.

# Create a wallet for your node. <your-wallet-name> is just a human readable name you can use to remember your wallet. It can be the same or different than your moniker. bitsongcli keys add <your_wallet_name>

This will spit out your recovery mnemonic. Be sure to back up your mnemonic before proceeding to the next step!

Submit a genesis transaction

If you are planning on participating in the genesis of the BitSong testnet, you can follow along here and create a genesis transaction that you can submit as a pull request before launch. Otherwise, skip to the section about obtaining some coins from the faucet. If you are participating in genesis, it is expected that your validator will be up and available at all times during the testnet. If you can’t commit to this, we recommend joining via the faucet after the testnet is live.

# Create an account in genesis with 10000000000 ubtsg (10000 btsg) tokens. Don't change the amount of ubtsg tokens so that we can have equal distribution among genesis participants.

# 1 btsg = 10000000ubtsg bitsongd add-genesis-account $(bitsongcli keys show <your_wallet_name> -a) 10000000000ubtsg # Sign a gentx that creates a validator in the genesis file for your account. Note to pass your public ip to the --ip flag. bitsongd gentx --name <your_wallet_name> --amount 10000000000ubtsg --ip <your-public-ip>

This will write your genesis transaction to $HOME/.bitsongd/config/gentx/gentx-<gen-tx-hash>.json . This should be the only file in your gentx directory. If you have more than one, delete them and repeat the gentx command above.

To submit the gentx you created, fork the networks repo.

# Be sure you forked the repo at https://github.com/bitsongofficial/networks under your user name first. cd $HOME && git clone https://github.com/<YOUR-USERNAME>/networks.git && cd $HOME/networks # create a branch for your pr submission

git checkout -b genesis-<your-moniker> # check that there's only one gentx

ls $HOME/.bitsongd/config/gentx # copy your gentx

cp $HOME/.bitsongd/config/gentx/* $HOME/networks/bitsong-testnet-2/ # add and commit your changes

git add bitsong-testnet-2/*

git commit -m "feat: gentx for <your-moniker>" # Push your branch to the remote repositor

git push -u origin genesis-<your-moniker>

Now go to BitSong’s Networks GitHub repo and select New Pull Request

Create a pull request for <github-username>/networks:genesis-<your-moniker> against the master branch of the BitSong Networks repo.

New Pull Request Click on “compare across forks”

base repository: bitsongofficial/networks

base: master head repository: <YOUR-USERNAME>/networks

compare: genesis-<your-moniker>

We’ll make sure to promptly review your PR, let you know if there are any issues, and merge it in!

Please note that all genesis transactions must be submitted by August 11, 2019 at 15:00 UTC. If you don’t submit a genesis transaction, don’t worry! After the testnet is launched, we’ll make a faucet available to easily request testnet tokens.

Launching the testnet 🚀

We will release the genesis file by August 11, 2019 at 18:00 UTC. You can read about the genesis file params here.

Validators can download the genesis file and start their node anytime after the genesis file is released. The chain will be set to launch August 12, 2019 at 15:00 UTC.

To start validating the testnet after the genesis has been released, run the following commands:

# Delete the old genesis

rm -f ~/.bitsongd/config/genesis.json # Copy the genesis file to the bitsongd directory

wget https://raw.githubusercontent.com/bitsongofficial/networks/master/bitsong-testnet-2/genesis.json -P ~/.bitsongd/config # create a systemd file to run the bitsongd daemon

# replace <your_user> where necessary

sudo tee /etc/systemd/system/bitsongd.service > /dev/null <<EOF

[Unit]

Description=BitSong Network Daemon

After=network-online.target [Service]

User=<your_user>

ExecStart=/home/<your_user>/go/bin/bitsongd start

Restart=always

RestartSec=3

LimitNOFILE=4096 [Install]

WantedBy=multi-user.target

EOF # Start the node

sudo systemctl enable bitsongd

sudo systemctl start bitsongd

To check on the status of the node

bitsongcli status

sudo journalctl -u bitsongd -f

After the BitSong Network blockchain reaches a quorum, the testnet will be officially launched!

If a quorum is not reached by 15:00 UTC on August 12, we will coordinate further communication through the BitSong validator Discord Validator Chat.

Joining the Testnet Via Faucet

At launch, transactions will not be enabled on bitsong-testnet-2. Transactions should be enabled via governance around August 15rd, 2019 at 18:00 UTC.

To join the BitSong testnet after launch, you can use our faucet. To install the testnet software, follow this guide up to the section titled ’Submitting a genesis transaction’.

To start your node:

# Delete the old genesis

rm -f ~/.bitsongd/config/genesis.json # Copy the genesis file to the bitsongd directory

wget https://raw.githubusercontent.com/bitsongofficial/networks/master/bitsong-testnet-2/genesis.json -P ~/.bitsongd/config # create a systemd file to run the bitsongd daemon

# replace <your_user> where necessary

sudo tee /etc/systemd/system/bitsongd.service > /dev/null <<EOF

[Unit]

Description=BitSong Network Daemon

After=network-online.target [Service]

User=<your_user>

ExecStart=/home/<your_user>/go/bin/bitsongd start

Restart=always

RestartSec=3

LimitNOFILE=4096 [Install]

WantedBy=multi-user.target

EOF # Start the node

sudo systemctl enable bitsongd

sudo systemctl start bitsongd

To get testnet coins:

# Get the address of your wallet

bitsongcli keys show -a <your_wallet_name> # Go to the faucet https://faucet.bitsong.io and paste your address

# Confirm that your account is funded bitsongcli q account $(bitsongcli keys show -a <your_wallet_name>)

To create a validator:

# Set your node to wait for transactions to confirm bitsongcli config broadcast-mode block # Create the validator

# Be sure to replace <your-wallet-name> and <your-moniker> bitsongcli tx staking create-validator \

--amount=1000000000ubtsg \

--pubkey=$(bitsongd tendermint show-validator) \

--moniker=<your-moniker> \

--chain-id=bitsong-testnet-2 \

--commission-rate="0.10" \

--commission-max-rate="0.20" \

--commission-max-change-rate="0.01" \

--min-self-delegation="1" \

--from=<your-wallet-name>



# Confirm that you have voting power (look at the last value in the output. It should show voting power > 0) bitsongcli status

Updating From bitsong-testnet-1 To bitsong-testnet-2

If you are using the same server for bitsong-testnet-1 as bitsong-testnet-2, you can follow the following workflow. Some of these steps depend on how you are running bitsongd , but this should give a sufficient overview.

Stop the running bitsongd instance and remove . This will take your validator down from bitsong-testnet-1

# It's okay if this command errors sudo kill -9 $(lsof -ti :26656) && sudo kill -9 $(lsof -ti :1317) && sudo systemctl stop bitsongd

rm -rf ~/.bitsong*

Update Go-BitSong Daemon

cd $HOME/go-bitsong

git fetch && git checkout v0.2.1

make install # Verify the version by doing

bitsongd version --long

Create a new validator node

# Replace <your-moniker> with the publicly viewable name you want for your validator.

bitsongd init --chain-id bitsong-testnet-2 <your-moniker> # Create a wallet for your node. <your-wallet-name> is just a human readable name you can use to remember your wallet. It can be the same or different than your moniker. bitsongcli keys add <your_wallet_name>

Follow the section titled ‘Submitting a Genesis Transaction

Summary