The Agoric platform currently uses Node.js (version 14.15.0 or higher) to evaluate Javascript smart contracts. See Node.js download instructions for details. In this example, we will be installing Node.js on a fresh install of Ubuntu 20.04:
# Download the nodesource PPA for Node.js
curl https://deb.nodesource.com/setup_14.x | sudo bash
# Download the Yarn repository configuration
# See instructions on https://legacy.yarnpkg.com/en/docs/install/
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# Update Ubuntu
sudo apt update
sudo apt upgrade -y
# Install Node.js, Yarn, and build tools
# Install jq for formatting of JSON data
sudo apt install nodejs=14.* yarn build-essential jq -y
Install Go
Agoric's Cosmos integration is built using Go and requires Go version 1.15+. In this example, we will be installing Go on the above Ubuntu 20.04 with Node.js installed:
validate go version
Validator Node from scratch.
If this is the first time you're running a validator you have two options to get your node synced up to the current upgrade : agoric-upgrade-5 .
once synced you can then continue on to upgrade to version: agoric-upgrade-5
FAQ
why can't i sync with the upgrade version agoric-upgrade-5 ?
Answer:
When our team attempted to run with the current "upgrade" ; the node complains about an error below
Next, we want to adjust the validator configuration to add the peers and seeds from the network config:
Create your service file and sync node.
To sync our node, we will use systemd, which manages the Agoric Cosmos daemon and automatically restarts it in case of failure. To use systemd, we will create a service file:
If you decide to run from the console, you can just do the following:
To start syncing:
Some Useful commands to check the state of your node
Upgrading
once you are fully synced with the previous version your node will stop and disconnect: not to worry continue to the upgrade.
note: Agoric mainnet 0 does not have the Agoric SDK enabled. read more here
Install agoric-upgrade-5.
Check to see if you're syncing
Option 2:
Your second option to get synced with the current version is to download a snapshot to cut sync time.
# First remove any existing old Go installation
sudo rm -rf /usr/local/go
# Install correct Go version
curl https://dl.google.com/go/go1.15.7.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf -
# Update environment variables to include go
cat <<'EOF' >>$HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF
source $HOME/.profile
go version
# returns go version go1.15.7 linux/amd64
BINARY UPDATED BEFORE TRIGGER! UPGRADE "agoric-upgrade-5" - in binary but not executed on chainUpgrading.
git clone https://github.com/Agoric/ag0.git
cd ag0
#checkout the previous branch for mainnet phase0 rc1
git checkout agoric-3.1
make install
ag0 version
#check response match
HEAD-a2ebcdb21418bb157f9c747a042b2a859b2a5986
# Download network config
curl https://main.agoric.net/network-config > chain.json
# Set chain name to the correct value
chainName=`jq -r .chainName < chain.json`
# Confirm value: should be something like agorictest-N.
echo $chainName
# should return
agoric-3
# Replace <your_moniker> with the public name of your node.
# NOTE: The `--home` flag (or `AG_CHAIN_COSMOS_HOME` environment variable) determines where the chain state is stored.
# By default, this is `$HOME/.agoric`.
ag0 init --chain-id $chainName <your_moniker>
# Download the genesis file
curl https://main.agoric.net/genesis.json > $HOME/.agoric/config/genesis.json
# Set peers variable to the correct value
peers=$(jq '.peers | join(",")' < chain.json)
# Set seeds variable to the correct value.
seeds=$(jq '.seeds | join(",")' < chain.json)
echo $peers
#should return
# "[email protected]:26656,[email protected]:26656"
echo $seeds
# currently there is no seeds availble tou can create your own seed nodes moving forward.
# Fix `Error: failed to parse log level`
sed -i.bak 's/^log_level/# log_level/' $HOME/.agoric/config/config.toml
# Replace the seeds and persistent_peers values
sed -i.bak -e "s/^seeds *=.*/seeds = $seeds/; s/^persistent_peers *=.*/persistent_peers = $peers/" $HOME/.agoric/config/config.toml
sudo tee <<EOF >/dev/null /etc/systemd/system/ag0.service
[Unit]
Description=Agoric Cosmos daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/go/bin/ag0 start --log_level=warn
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
# Check the contents of the file, especially User, Environment and ExecStart lines
cat /etc/systemd/system/ag0.service
# Check syncing status
ag0 status | jq .SyncInfo
# Check the amount of peers you're connect to
curl -sS http://localhost:26657/net_info | jq -r '.result.peers[] | "\(.node_info.moniker)"' | wc -l
#check connected nodes by moniker
curl -sS http://localhost:26657/net_info | grep moniker
# Tail ag0.service logs
sudo journalctl -u ag0.service -f -n 100
cd ag0
#checkout the current branch for mainnet upgrade
git checkout agoric-upgrade-5
# install ag0binary
make install
# verify ag0 version
ag0 version
#check response match
HEAD-a2a0dc089ca98b9eae50802d8ed866bf8c209b06
#start your upgraded binanry
sudo systemctl start ag0
ag0 status | jq .SyncInfo
# Ensure that the block count increments.
wget https://agoric-snapshot.s3.us-east-2.amazonaws.com/data.tar.gz
#extract folder
tar -zxvf data.tar.gz
#Replace the data folder in .agoricq
mv data ~/.agoric/