Joining Mainnet
General instructions to join the Gitopia mainnet after network genesis.
Getting Started
Make sure the following prerequisites are completed:
- Choose the proper hardware/server configuration:
The minimum recommended hardware requirements for running a validator for the Gitopia mainnet are:
- 4 Cores (modern CPU's)
- 32GB RAM
- 1TB of storage (SSD or NVME)
- Ensure Gitopia binary,
gitopiad
is properly installed. See the installation guide for a walk-through.
Setting up the Node
These instructions will direct you on how to initialize your node, synchronize to the network and upgrade your node to a validator.
Initialize the chain
Please replace YOUR_MONIKER
with your own moniker. By default, the init command creates the ~/.gitopia
directory with subfolders config
and data
. In the /config
directory, the most important files for configuration are app.toml
and config.toml
.
gitopiad init YOUR_MONIKER --chain-id gitopia
Monikers can contain only ASCII characters. Using Unicode characters is not supported and renders the node unreachable.
The moniker can be edited in the ~/.gitopia/config/config.toml
file:
# A custom human readable name for this node
moniker = "<custom_moniker>"
Genesis File
Once the node is initialized, download the genesis file and move to the /config
directory of the Gitopia home directory.
wget https://github.com/gitopia/mainnet/raw/master/genesis.tar.gz
tar -xzf genesis.tar.gz
mv genesis.json ~/.gitopia/config/genesis.json
Make sure you have the correct genesis file.
shasum -a 256 ~/.gitopia/config/genesis.json
0cf5c55e6ea1fbcebccadba0f6dc0b83ac76d1b608487a06978956404ce33e66 genesis.json
To verify the correctness of the configuration run:
gitopiad validate-genesis
Seeds & Peers
Upon startup the node will need to connect to peers. If there are specific nodes a node operator is interested in setting as seeds or as persistent peers, this can be configured in ~/.gitopia/config/config.toml
.
Use sed
to include the seeds and peers into the configuration. You can also add them manually:
sed -i 's/seeds = ""/seeds = "ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:11356"/' ~/.gitopia/config/config.toml
You can find other seeds and peers here.
For more information on the how and why of seeds and peers, you can read this great documentation from the Tendermint maintainers.
A Note on Gas and Fees
Transactions on the Gitopia Mainnet need to include a transaction fee in order to be processed. This fee pays for the gas required to run the transaction. The formula is the following:
fees = ceil(gas * gasPrices)
The gas
is dependent on the transaction. Different transaction require different amount of gas
. The gas
amount for a transaction is calculated as it is being processed, but there is a way to estimate it beforehand by using the auto
value for the gas
flag. Of course, this only gives an estimate. You can adjust this estimate with the flag --gas-adjustment
(default 1.0
) if you want to be sure you provide enough gas
for the transaction.
The gasPrice
is the price of each unit of gas
. Each validator sets a min-gas-price
value, and will only include transactions that have a gasPrice
greater than their min-gas-price
.
The transaction fees
are the product of gas
and gasPrice
. As a user, you have to input 2 out of 3. The higher the gasPrice
/fees
, the higher the chance that your transaction will get included in a block.
For Gitopia mainnnet, the recommended gas-prices
is 0.001ulore
.
Pruning of State (Optional)
This is an optional configuration.
There are four strategies for pruning state. These strategies apply only to the state and do not apply to block storage. A node operator may want to consider custom pruning if node storage is a concern or if there is an interest in running an archive node.
To set pruning, adjust the pruning parameter in the ~/.gitopia/config/app.toml
file. The following pruning state settings are available:
everything
: Prune all saved states other than the current state.nothing
: Save all states and delete nothing.default
: Save the last 100 states and the state of every 10,000th block.custom
: Specify pruning settings with the pruning-keep-recent, pruning-keep-every, and pruning-interval parameters.
By default, every node is in default mode which is the recommended setting for most environments. If a node operator wants to change their node's pruning strategy then this must be done before the node is initialized.
In ~/.gitopia/config/app.toml
# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals
# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node)
# everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals
# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval'
pruning = "custom"
# These are applied if and only if the pruning strategy is custom.
pruning-keep-recent = "10"
pruning-keep-every = "1000"
pruning-interval = "10"
Passing a flag when starting gitopia
will always override settings in the app.toml
file. To change the node's pruning setting to everything
mode then pass the ---pruning everything
flag when running gitopiad start
.
If running the node with pruned state, it will not be possible to query the heights that are not in the node's store.
Setup Cosmovisor
Cosmovisor is a small process manager for Cosmos SDK application binaries that monitors the governance module via stdout for incoming chain upgrade proposals.
Step 1: Setup environment variables
Add the required environment variables for Cosmovisor into your profile.
cd ~
echo "export DAEMON_NAME=gitopiad" >> ~/.profile
echo "export DAEMON_HOME=$HOME/.gitopia" >> ~/.profile
source ~/.profile
Step 2: Install and provide binaries
Install Cosmovisor and provide gitopiad
binary to Cosmovisor.
# Install Cosmovisor. We will use Cosmovisor v1.0.0 as example here.
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0
# Create Cosmovisor Folders
mkdir -p ~/.gitopia/cosmovisor/genesis/bin
mkdir -p ~/.gitopia/cosmovisor/upgrades
# Load Node Binary into Cosmovisor Folder
cp ~/go/bin/gitopiad ~/.gitopia/cosmovisor/genesis/bin
Node Snapshot
We could let our node catch up to the current block but this would take a very long time. Instead we will download a snapshot of the blockchain before starting our node. Instructions on how to download snapshot and process it can be found here.
Launch Node
Create Service File
In this section we will create a script and a related service to start the node. The service will additionally ensure that the node is restarted following reboots.
Create a gitopia.service
file in the /etc/systemd/system
folder with the following code snippet. Make sure to replace USER
with your Linux user name. You need sudo previlege to do this step.
[Unit]
Description="gitopia node"
After=network-online.target
[Service]
User=USER
ExecStart=/home/USER/go/bin/cosmovisor start
Restart=always
RestartSec=3
LimitNOFILE=4096
Environment="DAEMON_NAME=gitopiad"
Environment="DAEMON_HOME=/home/USER/.gitopia"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="UNSAFE_SKIP_BACKUP=true"
[Install]
WantedBy=multi-user.target
Start Node Service
If syncing from a snapshot, do not start Cosmovisor yet.
# Enable service
sudo systemctl enable gitopia.service
# Start service
sudo service gitopia start
# Check logs
sudo journalctl -fu gitopia
Run a Mainnet Validator
Once your node has synced, it's time to create a validator. To upgrade the node to a validator, you will need to submit a create-validator
transaction:
Do not attempt to upgrade your node to a validator until the node is fully in sync
For more details on how to run your validator, follow the validator these instructions.
gitopiad tx staking create-validator \
--amount 1000000ulore \
--commission-max-change-rate "0.05" \
--commission-max-rate "0.10" \
--commission-rate "0.05" \
--min-self-delegation "1" \
--pubkey=$(gitopiad tendermint show-validator) \
--moniker <YOUR_MONIKER> \
--chain-id <chain_id> \
--from <key_name>