/stratos-chain-testnet

stratos block testnet genesis and config

Primary LanguageGo

stratos-chain-testnet

Stratos block testnet genesis and config.

The latest version is v0.10.0, with a new chain-id mesos-1.

Prepare environment to run node

0. Create user account(optional)

To create a separated and more secure environment, it is recommended to create a separated user account to run node.

sudo adduser stratos --home /home/stratos

Once user is created, login the system using stratos account and proceed with installation steps in context of that user

1. Download release binary files

Get stchaind binary files

cd $HOME
wget https://github.com/stratosnet/stratos-chain/releases/download/v0.10.0/stchaind

These binary files are built using linux amd64, so if you prefer to run a node on a different kernel, please follow step 1.1 to build binaries.

For ease of use, we recommend you save these files in your $HOME folder. In the following, we suppose you are in the $HOME folder.

  • Check the granularity
# Check granularity
md5sum stchain*

## Expected output
##  e7e52a3831f8c22864badbf4c268adb5 stchaind
  • Add execute permission to the binary downloaded
chmod +x stchaind

1.1 Compile the binary with source code

Make sure you have Go 1.19+ installed (link).

 git clone https://github.com/stratosnet/stratos-chain.git
 cd stratos-chain
 git checkout tags/v0.10.0
 make build

The binary file stchaind can be found in build folder. Then, move these two binary files to $HOME

mv build/stchaind ./

Install the binary files to $GOPATH/bin

make install

2. Get the genesis and config file

Initialize the node

./stchaind init "<node name you prefer>"

# ignore the output since you need to download the genesis file 

Download genesis.json and config.toml files

wget https://raw.githubusercontent.com/stratosnet/stratos-chain-testnet/main/genesis.json
wget https://raw.githubusercontent.com/stratosnet/stratos-chain-testnet/main/config.toml

Change moniker(optional if you don't want to become validator)

In config.toml file, at Line #16, there is a “moniker” field. Change it to any name you like. It’s your node name on the network.

# A custom human readable name for this node
moniker = "<node name you prefer>"

Move the config.toml and genesis.json files to .stchaind/config/ folder

mv config.toml .stchaind/config/
mv genesis.json .stchaind/config/

By default, the two binary executable files stchaind as well as the directory .stchaind have been saved or created in the $HOME folder. The .stchaind folder contains the node's configurations and data.

3. Run the node

There are three ways to run your Stratos-chain full-node. Please choose ONE of them to start the node.

  • stchaind start command

    # Make sure we are inside the home directory
    cd $HOME
    
    # run your node
    ./stchaind start
    
    # Use `Ctrl+c` to stop the node.
  • Run node in background

    # Make sure we are inside the home directory
    cd $HOME
    
    # run your node in backend
    ./stchaind start 2>&1 >> chain.log & 

    Use an editor to check your node log at chain.log

    Use the following Linux Command to stop your node.

    pkill stchaind
  • Run node as a service

    All below steps require root privileges

    • Create the service file Create the /lib/systemd/system/stratos.service file with the following content

      [Unit]
      Description=Stratos Chain Node
      After=network-online.target
      
      [Service]
      User=stratos
      ExecStart=/home/stratos/stchaind start --home=/home/stratos/.stchaind
      Restart=on-failure
      RestartSec=3
      LimitNOFILE=8192
      
      [Install]
      WantedBy=multi-user.target

      In the [service] section

      • User is your system login username
      • ExecStart designates the absolute path to the binary executable stchaind
      • --home is the absolute path to your node folder.
      • We used the default values for these variables. If you use a different username, group or folder to hold your node data instead of the default values, please modify these values according to your situations. Make sure the above values are correct.
    • Start your service Once you have successfully created the service, you need to enable and start it by running

      systemctl daemon-reload
      systemctl enable stratos.service
      systemctl start stratos.service
    • Service operations

      • Check the service status

        systemctl status stratos.service
      • Check service log

        journalctl -u stratos.service -f 
        
        # exit with ctrl+c
      • Stop the service

        systemctl stop stratos.service

Operations

Once the node finishes catching-up, you can operate the node for various transactions(tx) and queries.

In the following, we list some of commonly-used operations. More details and examples can be found here.

Create an account

./stchaind keys add --hd-path "m/44'/606'/0'/0/0" --keyring-backend test  <your wallet name>

Example

./stchaind keys add --hd-path "m/44'/606'/0'/0/0" --keyring-backend test  wallet1

After executed the above command, a .stchaind will be created in your $HOME folder.

Faucet

Faucet will be available at https://faucet-mesos.thestratos.org/ to get test tokens

curl --header "Content-Type: application/json" --request POST --data '{"denom":"stos","address":"your wallet address"} ' https://faucet-mesos.thestratos.org/credit

Check balance (you need to wait for your node catching up with the network)

./stchaind query account <your wallet address>

Check node status

./stchaind status

Try your first tx - send transaction

./stchaind tx send <from account address | name> <to address> <amount> --keyring-backend=<keyring's backend> --chain-id=<current chain-id> --gas=<gas amount> --gas-prices=<gas-price>
./stchaind tx bank send user0 st1sqzsk8mplv5248gx6dddzzxweqvew8rtst96fx 1gwei --chain-id=mesos-1  --keyring-backend=test --gas=auto --gas-prices=10000000wei
# then input y for the pop up to confirm send
  • In testing phase, --keyring-backend="test"
  • In testing phase, chain-id may change when updating, which can be found on this page, right next to the search bar at the top of the page. The current chain-id is mesos-1.

Becoming a validator(optional)

After the following steps have been done, Any participant in the network can signal that they want to become a validator. Please refer to How to Become a Validator for more details about validator creation, delegation as well as FAQ.

  • download related files
  • start your node to catch up to the latest block height(synchronization)
  • create your Stratos Chain Wallet
  • Faucet or send an amount of tokens to this wallet

References