Pre-Genesis (Joining as a Genesis Validator)

Running the SGE Node

This section explains how to install and set up the SGE Node and run a validator node.

Getting the Binary

  • Install the SGE Network application

  • Initialize node

Getting The Pre-Genesis

After the installation is a success. The first thing to do is initialize the SGE node. For this, remove all previous data of the SGE node.

Once the system is clean, initialize the node with the following command:

sged init <node_moniker> --chain-id sgenet-1

Now that the node is initialized, we need to replace the generated genesis.json file with the pre-genesis file from this repo.

Head over to sgenet-1 within this repo and get the pre-genesis.json file. Replace the ~/.sge/config/genesis.json file with this pre-genesis.json file. Make sure to rename the file to genesis.json.

We are now ready to proceed to the next step and create Genesis transactions.

Submitting a Genesis Transaction

Now that we have our Node setup, first, create (or recover) a new SGE Account.

sged keys add <key_name>

Now that we have the keys to an SGE wallet account, let's go ahead and add it to the Genesis file as a Genesis account

sged add-genesis-account <key_name> <amount>

For example

sged add-genesis-account val1 1000000000000usge

Now that we have some balance in the genesis account, the next step is to make a genesis transaction to create a new validator with our account.

This will add the genesis transaction to a gentx-xxxx.json file.

sged gentx <key_name> <staking_amount> \
  --chain-id <chain_id> \
  --commission-max-change-rate 0.01 \
  --commission-max-rate 0.2 \
  --commission-rate 0.05 \
  --min-self-delegation 1 \
  --moniker <validator_moniker>

Once you have the gentx file, make a PR to gentxs to include your Genesis transaction.

Registering Peer IDs

You will need to register your Peer ID as well in order for other nodes to connect with your node. To do so, first, get your Node ID.

sged tendermint show-node-id

Now, get your public IP. The Gossip protocol of your node runs on port 26656 by default.

So, your final combined peer ID should be of the format:

<node_id>@<public_ip>:<gossip_port>

For Example

e1fc6bc72db2c38e55751d350a72eba699a58f2d@44.203.79.229:26656

Now make a PR to peers dir to add your peer ID to the list.

Getting The Genesis File

Once everyone has submitted their genesis transactions, the SGE team will collect all these genesis transactions and generate the genesis.json the file that will be used to start the chain.

Once generated, all the genesis validators will be notified and you can get the genesis file from here.

Download this file and replace the ~/.sge/config/genesis.json file with this new Genesis file.

Starting the SGE Node

We are now ready to start your SGE Node. To start your node run

sged start --minimum-gas-prices [desired-gas-price(ex. 0.001usge)]

Note that the chain may not immediately start generating new blocks because 67% voting power has not yet been achieved. That is, other validators have not yet started their nodes.

New block generation will start as soon as 67% of voting power is achieved, even if the rest 33% of validators are not yet online. This means that if they do not join soon enough they will be slashed and jailed for missing blocks.

Install system.d service file

nano /etc/systemd/system/sged.service

Please following contents(the working dir may be changed as needed)

[Unit]
Description=Sge Network node
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu
ExecStart=/usr/local/sbin/sged start
Restart=on-failure
RestartSec=10
LimitNOFILE=40960

[Install]
WantedBy=multi-user.target

Reload unit files in the systemd

sudo systemctl daemon-reload

Last updated