If you already know about Dig, then you can continue. If not, then you can visit the official Website below.
Basically, DigChain is a blockchain-based governance project aimed at linking real estate to blockchain in form of Real Estate NFT and providing a new way for investors to earn doing the same things. But it is more than just real estate and aimed at the governance of small baby blockchains. You can check GitHub for more
So, lets come back to Validator
Prerequisites
- Ubuntu 20.04
- Go installed
- GCC installed (for go build tools)
Server with
Min requirements
- 2 vCPU
- 4GB RAM
- 100GB+ SSD
Recommended requirements
- 4 vCPU
- 8GB RAM
- 100GB+SSD
Note: Recommended requirements are for long term but if you plan on keeping economics low, then minimum will work for now
Steps to run
1. Install Software for Os
Do upgrades before starting
sudo apt-get update && sudo apt upgrade -y
Install compilation tools
sudo apt-get install make build-essential gcc git jq chrony -y
Install Go
wget https://golang.org/dl/go1.17.5.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.17.5.linux-amd64.tar.gz
Make it globally available by adding path to your profile
cat <<EOF >> ~/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF
now load config and check if go works fine
source ~/.profile
go version
go version go1.17.5 linux/amd64
2. Install Dig go package
clone repo and install package with go
git clone https://github.com/notional-labs/dig.git
cd dig/
git checkout master
go install ./...
cd ~
As we did already imported path in previous step, you can ignore this. But if command not works. then do export
export PATH=$PATH:~/go/bin
export GOPATH=~/go
3. Init moniker node and generate genesis
replace nodename by your name
digd init <nodename> --chain-id dig-1
Note: remember to add chain-id as it identify main chain
now import genesis file from git to your config
wget -O ~/.dig/config/genesis.json https://github.com/notional-labs/dig/raw/master/networks/mainnets/dig-1/genesis.json
4. Create a System Service to run Dig node
Save the below file as dig.service under /etc/systemd/system
[Unit]
Description=Dig Node
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/home
ExecStart= /root/go/bin/digd start --p2p.seeds 37b2839da4463b22a51b1fe20d97992164270eba@62.171.157.192:26656,e2c96b96d4c3a461fb246edac3b3cdbf47768838@65.21.202.37:6969 --p2p.persistent_peers 33f4788e1c6a378b929c66f31e8d253b9fd47c47@194.163.154.251:26656,64eccffdc60a206227032d3a021fbf9dfc686a17@194.163.156.84:26656,be7598b2d56fb42a27821259ad14aff24c40f3d2@172.16.152.118:26656,f446e37e47297ce9f8951957d17a2ae9a16db0b8@137.184.67.162:26656,ab2fa2789f481e2856a5d83a2c3028c5b215421d@144.91.117.49:26656,e9e89250b40b4512237c77bd04dc76c06a3f8560@185.214.135.205:26656,1539976f4ee196f172369e6f348d60a6e3ec9e93@159.69.147.189:26656,85316823bee88f7b05d0cfc671bee861c0237154@95.217.198.243:26656,eb55b70c9fd8fc0d5530d0662336377668aab3f9@185.194.219.128:2665
Restart=on-failure
StartLimitInterval=0
RestartSec=3
LimitNOFILE=65535
LimitMEMLOCK=209715200
[Install]
WantedBy=multi-user.target
Reload daemon
systemctl daemon-reload
Start the node
systemctl start dig.service
Check status
systemctl status dig.service
Check if Node is in Sync
journalctl -u dig -f
Note: To create a validator you need to be in sync so check if you can see block creation. Usually, it takes around 30 mins to sync
5. Generate Wallet Keys
Enter the command to create a key pair
digd keys add <key-name>
where keyname can be any name you want
Note: By default, the key gets generated in the test backend. You can specify a different backend from os/file/test using -- keyring-backend flag
Note down the mnemonic key somewhere safe in case you want to migrate or recover your wallet.
To recover the key, just issue the below command and enter the mnemonic passphrase
dig keys add <key-name> --recover
6. Create a Transaction to declare a Validator
enter below command (you can customize params though)
digd tx staking create-validator --moniker="yourname" --from keyname --pubkey="$(digd tendermint show-validator)" --amount="1000000udig" --commission-max-rate="0.10" --commission-max-change-rate="0.05" --commission-rate="0.05" --fees 0udig --gas auto --min-self-delegation 1 --chain-id dig-1
where yourname can be replaced by name which you want to show for your validator and keyname is the key name that we created in step 5
Note: You need to have some dig tokens in your wallet before you can do any transaction. You can add atleast 5 DIG before continuing.
Optional : You can also change your identification details
digd tx staking edit-validator --from <keyname> --fees 0udig --gas auto --identity keybase --website="your site" --chain-id dig-1
Here the keybase value is Pgp key generated from keybase.io keybase.io
Congrats, your validator is now up.
You can check my validator here
Also, you can check a list of all validators here
Bonus Commands
To claim Rewards
digd tx distribution withdraw-rewards $(digd keys show --bech=val -a <keyname>) --from <keyname> --chain-id dig-1
To claim Rewards and Commission
digd tx distribution withdraw-rewards $(digd keys show --bech=val -a <keyname>) --from <keyname> --chain-id dig-1 --commission
If the validator is jailed, try unjailing
digd tx slashing unjail --from=$(digd keys show <keyname> -a) --chain-id dig-1 --fees 10000udig --gas 10000
This was all for today. I will keep on posting updated articles, as soon as there is a new update to the Dig blockchain and its tools. You can follow me at Blurt Blog
blurt.blog@tekraze
or my official Blog