Skip to content

Latest commit

 

History

History
 
 

emerynet

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Join our telegram Join our discord Visit our website

Deploy your VPS using our referral link to get 20€ bonus

Deploy your VPS using our referral link to get 100$ free bonus for 60 days

Deploy your VPS using our referral link to get 100$ free bonus

agoric node setup for testnet — agoric-emerynet-2

Explorer:

https://emerynet.explorer.agoric.net/

Usefull tools and references

To set up monitoring for your validator node navigate to Set up monitoring and alerting for agoric validator

To migrate your validator to another machine read Migrate your validator to another machine

Set up your agoric fullnode

Option 1 (automatic)

You can setup your agoric fullnode in few minutes by using automated script below. It will prompt you to input your validator node name!

wget -O agoric.sh https://raw.githubusercontent.com/kj89/testnet_manuals/main/agoric/emerynet/agoric.sh && chmod +x agoric.sh && ./agoric.sh

Option 2 (manual)

You can follow manual guide if you better prefer setting up node manually

Post installation

When installation is finished please load variables into system

source $HOME/.bash_profile

Next you have to make sure your validator is syncing blocks. You can use command below to check synchronization status

ag0 status 2>&1 | jq .SyncInfo

Upgrade binaries to agoric-upgrade-7

sudo systemctl stop agoricd
cd $HOME && rm $HOME/ag0 -rf
git clone https://github.com/Agoric/ag0
cd ag0
git checkout agoric-upgrade-7
make build
sudo cp $HOME/ag0/build/ag0 /usr/local/bin

State sync your node

SNAP_RPC="https://agoric-testnet-rpc.polkachu.com:443"
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ; \
s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.agoric/config/config.toml

ag0 tendermint unsafe-reset-all --home $HOME/.agoric
sudo systemctl restart agoricd && journalctl -fu agoricd -o cat

Create wallet

To create new wallet you can use command below. Don’t forget to save the mnemonic

ag0 keys add $WALLET

(OPTIONAL) To recover your wallet using seed phrase

ag0 keys add $WALLET --recover

To get current list of wallets

ag0 keys list

Save wallet info

Load wallet and valoper variables into system

AGORIC_WALLET_ADDRESS=$(ag0 keys show $WALLET -a)
AGORIC_VALOPER_ADDRESS=$(ag0 keys show $WALLET --bech val -a)
echo 'export AGORIC_WALLET_ADDRESS='${AGORIC_WALLET_ADDRESS} >> $HOME/.bash_profile
echo 'export AGORIC_VALOPER_ADDRESS='${AGORIC_VALOPER_ADDRESS} >> $HOME/.bash_profile
source $HOME/.bash_profile

Fund your wallet

In order to create validator first you need to fund your wallet with testnet tokens. To top up your wallet:

Create validator

Before creating validator please make sure that you have at least 1 bld (1 bld is equal to 1000000 ubld) and your node is synchronized

To check your wallet balance:

ag0 query bank balances $AGORIC_WALLET_ADDRESS

If your wallet does not show any balance than probably your node is still syncing. Please wait until it finish to synchronize and then continue

To create your validator run command below

ag0 tx staking create-validator \
  --amount 75000000ubld \
  --from $WALLET \
  --commission-max-change-rate "0.01" \
  --commission-max-rate "0.2" \
  --commission-rate "0.07" \
  --min-self-delegation "1" \
  --pubkey  $(ag0 tendermint show-validator) \
  --moniker $NODENAME \
  --chain-id $AGORIC_CHAIN_ID

Security

To protect you keys please make sure you follow basic security rules

Set up ssh keys for authentication

Good tutorial on how to set up ssh keys for authentication to your server can be found here

Basic Firewall security

Start by checking the status of ufw.

sudo ufw status

Sets the default to allow outgoing connections, deny all incoming except ssh and 26656. Limit SSH login attempts

sudo ufw default allow outgoing
sudo ufw default deny incoming
sudo ufw allow ssh/tcp
sudo ufw limit ssh/tcp
sudo ufw allow 26656,26660/tcp
sudo ufw enable

Monitoring

To monitor and get alerted about your validator health status you can use my guide on Set up monitoring and alerting for agoric validator

Calculate synchronization time

This script will help you to estimate how much time it will take to fully synchronize your node
It measures average blocks per minute that are being synchronized for period of 5 minutes and then gives you results

wget -O synctime.py https://raw.githubusercontent.com/kj89/testnet_manuals/main/agoric/tools/synctime.py && python3 ./synctime.py

Get list of validators

ag0 q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl

Get currently connected peer list with ids

curl -sS http://localhost:26657/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr)"' | awk -F ':' '{print $1":"$(NF)}'

Usefull commands

Service management

Check logs

journalctl -fu agoricd -o cat

Start service

systemctl start agoricd

Stop service

systemctl stop agoricd

Restart service

systemctl restart agoricd

Node info

Synchronization info

ag0 status 2>&1 | jq .SyncInfo

Validator info

ag0 status 2>&1 | jq .ValidatorInfo

Node info

ag0 status 2>&1 | jq .NodeInfo

Show node id

ag0 show-node-id

Wallet operations

List of wallets

ag0 keys list

Recover wallet

ag0 keys add $WALLET --recover

Delete wallet

ag0 keys delete $WALLET

Get wallet balance

ag0 query bank balances $AGORIC_WALLET_ADDRESS

Transfer funds

ag0 tx bank send $AGORIC_WALLET_ADDRESS <TO_AGORIC_WALLET_ADDRESS> 10000000ubld

Voting

ag0 tx gov vote 1 yes --from $WALLET --chain-id=$AGORIC_CHAIN_ID

Staking, Delegation and Rewards

Delegate stake

ag0 tx staking delegate $AGORIC_VALOPER_ADDRESS 750000000ubld --from=$WALLET --chain-id=$AGORIC_CHAIN_ID --gas=auto

Unbound stake

ag0 tx staking unbond $AGORIC_VALOPER_ADDRESS 750000000ubld --from=$WALLET --chain-id=$AGORIC_CHAIN_ID --gas=auto

Redelegate stake from validator to another validator

ag0 tx staking redelegate <srcValidatorAddress> <destValidatorAddress> 10000000ubld --from=$WALLET --chain-id=$AGORIC_CHAIN_ID --gas=auto

Withdraw all rewards

ag0 tx distribution withdraw-all-rewards --from=$WALLET --chain-id=$AGORIC_CHAIN_ID --gas=auto

Withdraw rewards with commision

ag0 tx distribution withdraw-rewards $AGORIC_VALOPER_ADDRESS --from=$WALLET --commission --chain-id=$AGORIC_CHAIN_ID

Validator management

Edit validator

ag0 tx staking edit-validator \
--moniker=$NODENAME \
--identity=1C5ACD2EEF363C3A \
--website="http://kjnodes.com" \
--details="Providing professional staking services with high performance and availability. Find me at Discord: kjnodes#8455 and Telegram: @kjnodes" \
--chain-id=$AGORIC_CHAIN_ID \
--from=$WALLET

Unjail validator

ag0 tx slashing unjail \
  --broadcast-mode=block \
  --from=$WALLET \
  --chain-id=$AGORIC_CHAIN_ID \
  --gas=auto

Delete node

This commands will completely remove node from server. Use at your own risk!

sudo systemctl stop agoricd
sudo systemctl disable agoricd
sudo rm /etc/systemd/system/agoricd.service -rf
sudo rm $(which ag0) -rf
sudo rm $HOME/.agoric* -rf
sudo rm $HOME/ag0 -rf
sudo sed -i '/emerynet/d' ~/.bash_profile