Selfchain
Run the node using Systemd
Chain ID | Port | Version |
---|---|---|
self-dev-1 | 113 | 0.2.2 |
Server Requirements
Component | Requirements |
---|---|
CPU | 4-8 cores CPU |
Storage | 100 GB |
Ram | 16 GB |
OS | Ubuntu 22.04+ |
RPC, API, gRPC and Snapshot
✅ RPC http://109.199.118.239:11357/
✅ API: http://109.199.118.239:11317/
✅ gRPC: http://109.199.118.239:11391/
✅ Auto Snapshot daily
- 🖼️ Validator
- 🖼️ Command
- 🖼️ Snapshot
Install
MONIKER="Yourmoniker"
- Update and install packages for compiling
sudo apt update
sudo apt install curl git jq lz4 build-essential -y
- Install Go 1.20.1
ver="1.20.1"
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
go version
- Download and install Cosmovisor
go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]
- Download and install binary
cd $HOME
curl -O https://snap.vnbnode.com/selfchain/selfchaind
sudo chmod +x selfchaind
- Setup Cosmovisor Symlinks
mkdir -p $HOME/.selfchain/cosmovisor/genesis/bin
mv selfchaind $HOME/.selfchain/cosmovisor/genesis/bin/
sudo ln -s $HOME/.selfchain/cosmovisor/genesis $HOME/.selfchain/cosmovisor/current
sudo ln -s $HOME/.selfchain/cosmovisor/current/bin/selfchaind /usr/local/bin/selfchaind
- Set Service file
sudo tee /etc/systemd/system/selfchaind.service > /dev/null << EOF
[Unit]
Description=selfchaind testnet node service
After=network-online.target
[Service]
User=$USER
ExecStart=$(which cosmovisor) run start
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.selfchain"
Environment="DAEMON_NAME=selfchaind"
Environment="UNSAFE_SKIP_BACKUP=true"
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable selfchaind
Initialize the node
- Set node configuration
selfchaind config chain-id self-dev-1
selfchaind config keyring-backend test
selfchaind config node tcp://localhost:11357
- Initialize the node
selfchaind init $MONIKER --chain-id self-dev-1
- Add Genesis File and Addrbook
wget -O $HOME/.selfchain/config/genesis.json https://raw.githubusercontent.com/hotcrosscom/selfchain-genesis/main/networks/devnet/genesis.json
wget -O $HOME/.selfchain/config/addrbook.json https://raw.githubusercontent.com/ruangnode/services/main/testnet/self-chain/addrbook.json
- Configure Seeds and Peers
SEEDS="[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:37656,[email protected]:38656,[email protected]:11356,[email protected]:26656,[email protected]:26656,[email protected]:11356"
PEERS="[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:37656,[email protected]:38656,[email protected]:11356,[email protected]:26656,[email protected]:26656,[email protected]:11356"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.selfchain/config/config.toml
- Set Pruning, Enable Prometheus, Gas Price, and Indexer
PRUNING="custom"
PRUNING_KEEP_RECENT="100"
PRUNING_INTERVAL="19"
sed -i -e "s/^pruning *=.*/pruning = \"$PRUNING\"/" $HOME/.selfchain/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \
\"$PRUNING_KEEP_RECENT\"/" $HOME/.selfchain/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \
\"$PRUNING_INTERVAL\"/" $HOME/.selfchain/config/app.toml
sed -i -e 's|^indexer *=.*|indexer = "null"|' $HOME/.selfchain/config/config.toml
sed -i 's|^prometheus *=.*|prometheus = true|' $HOME/.selfchain/config/config.toml
sed -i -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.005uself\"/" $HOME/.selfchain/config/app.toml
- Set custom ports
sed -i -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:11358\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:11357\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:11360\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:11356\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":11366\"%" $HOME/.selfchain/config/config.toml
sed -i -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:11317\"%; s%^address = \":8080\"%address = \":11380\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:11390\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:11391\"%; s%:8545%:11345%; s%:8546%:11346%; s%:6065%:11365%" $HOME/.selfchain/config/app.toml
- Start service and check the logs
sudo systemctl start selfchaind
sudo journalctl -fu selfchaind -o cat
- Snapshot
Off State Sync
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1false|" ~/.selfchain/config/config.toml
Stop Node and Reset Data
sudo systemctl stop selfchaind
cp $HOME/.selfchain/data/priv_validator_state.json $HOME/.selfchain/priv_validator_state.json.backup
rm -rf $HOME/.selfchain/data
selfchaind tendermint unsafe-reset-all --home ~/.selfchain/ --keep-addr-book
Download Snapshot
curl -L https://snap.vnbnode.com/selfchain/self-dev-1_snapshot_latest.tar.lz4 | tar -I lz4 -xf - -C $HOME/.selfchain/data
mv $HOME/.selfchain/priv_validator_state.json.backup $HOME/.selfchain/data/priv_validator_state.json
Restart Node
sudo systemctl restart selfchaind && sudo journalctl -u selfchaind -f --no-hostname -o cat
Key management Add New Wallet
selfchaind keys add wallet
Restore executing wallet
selfchaind keys add wallet --recover
List All Wallets
selfchaind keys list
Delete wallet
selfchaind keys delete wallet
Check Balance
selfchaind q bank balances $(selfchaind keys show wallet -a)
Export Key (save to wallet.backup)
selfchaind keys export wallet
Import Key (restore from wallet.backup)
selfchaind keys import wallet wallet.backup
Withdraw all rewards
selfchaind tx distribution withdraw-all-rewards --from wallet --chain-id self-dev-1 --gas auto --gas-adjustment 1.5
Withdraw rewards and commission from your validator
selfchaind tx distribution withdraw-rewards $(selfchaind keys show wallet --bech val -a) --commission --from wallet --chain-id self-dev-1 --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Delegate to Yourself
selfchaind tx staking delegate $(selfchaind keys show wallet --bech val -a) 1000000uself --from wallet --chain-id self-dev-1 --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Delegate
selfchaind tx staking delegate <TO_VALOPER_ADDRESS> 1000000uself --from wallet --chain-id self-dev-1 --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Redelegate Stake to Another Validator
selfchaind tx staking redelegate $VALOPER_ADDRESS <TO_VALOPER_ADDRESS> 1000000uself --from wallet --chain-id self-dev-1 --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Unbond
selfchaind tx staking unbond $(selfchaind keys show wallet --bech val -a) 1000000uself --from wallet --chain-id self-dev-1 --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Transfer Funds
selfchaind tx bank send wallet_ADDRESS <TO_WALLET_ADDRESS> 1000000uself --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Create New Validator
selfchaind tx staking create-validator \
--amount "1000000uself" \
--pubkey $(selfchaind tendermint show-validator) \
--moniker "MONIKER" \
--identity "KEYBASE_ID" \
--details "YOUR DETAILS" \
--website "YOUR WEBSITE" \
--chain-id self-dev-1 \
--commission-rate "0.05" \
--commission-max-rate "0.20" \
--commission-max-change-rate "0.01" \
--min-self-delegation "1" \
--gas-prices "0.005uself" \
--gas "auto" \
--gas-adjustment "1.5" \
--from wallet \
-y
Edit Existing Validator
selfchaind tx staking edit-validator \
--commission-rate 0.1 \
--new-moniker "$MONIKER" \
--identity "" \
--details "" \
--gas-prices "0.005uself" \
--gas "auto" \
--gas-adjustment "1.5" \
--from wallet \
-y
Validator info
selfchaind status 2>&1 | jq .ValidatorInfo
Get sync status
selfchaind status 2>&1 | jq .SyncInfo.catching_up
Get latest height
selfchaind status 2>&1 | jq .SyncInfo.latest_block_height
Validator Details
selfchaind q staking validator $(selfchaind keys show wallet --bech val -a)
Jailing info
selfchaind q slashing signing-info $(selfchaind tendermint show-validator)
Unjail validator
selfchaind tx slashing unjail --from wallet --chain-id self-dev-1 --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Active Validators List
selfchaind q staking validators -oj --limit=2000 | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " " + .description.moniker' | sort -gr | nl
Check Validator key
[[ $(selfchaind q staking validator $VALOPER_ADDRESS -oj | jq -r .consensus_pubkey.key) = $(selfchaind status | jq -r .ValidatorInfo.PubKey.value) ]] && echo -e "Your key status is ok" || echo -e "Your key status is error"
Signing info
selfchaind q slashing signing-info $(selfchaind tendermint show-validator)
selfchaind tx gov submit-proposal \
--title "" \
--description "" \
--deposit 1000000uself \
--type Text \
--gas-prices "0.005uself" \
--gas "auto" \
--gas-adjustment "1.5" \
--from wallet \
-y
🗳 Governance List all proposals
selfchaind query gov proposals
View proposal by id
selfchaind query gov proposal 1
Vote 'Yes'
selfchaind tx gov vote 78 yes --from wallet --chain-id self-dev-1 --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Vote 'No'
selfchaind tx gov vote 1 no --from wallet --chain-id self-dev-1 --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Vote 'Abstain'
selfchaind tx gov vote 1 abstain --from wallet --chain-id self-dev-1 --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Vote 'NoWithVeto'
selfchaind tx gov vote 1 nowithveto --from wallet --chain-id self-dev-1 --gas-prices=0.005uself --gas-adjustment 1.5 --gas "auto" -y
Remove node
sudo systemctl stop selfchaind
sudo systemctl disable selfchaind
sudo rm /etc/systemd/system/selfchaind.service
sudo systemctl daemon-reload
rm -f $(which selfchaind)
rm -rf $HOME/.selfchain
Snapshot (Automatically update daily)
Off State Sync
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1false|" ~/.selfchain/config/config.toml
Stop Node and Reset Date
sudo systemctl stop selfchaind
cp $HOME/.selfchain/data/priv_validator_state.json $HOME/.selfchain/priv_validator_state.json.backup
rm -rf $HOME/.selfchain/data
selfchaind tendermint unsafe-reset-all --home ~/.selfchain/ --keep-addr-book
Download Snapshot (auto daily update)
curl -L https://snap.vnbnode.com/selfchain/self-dev-1_snapshot_latest.tar.lz4 | tar -I lz4 -xf - -C $HOME/.selfchain/data
mv $HOME/.selfchain/priv_validator_state.json.backup $HOME/.selfchain/data/priv_validator_state.json
Restart Node
sudo systemctl restart selfchaind && sudo journalctl -u selfchaind -f --no-hostname -o cat