Deploy a full node for Juno chain
(document last update: 13/09/23)
Cosmos based L1 network for cross-chain smart contracts.
Hardware requirements
4vCPU / 32 GB RAM (or equivalent swap file set up) / 1 TB of storage space (min)
Setup device
Install ubuntu 20.04 LTS
Update packages and upgrade device
sudo apt update && sudo apt upgrade -y
The script automates the install process
Install script:
This is my own version to automate the steps for Method 2: Manual build, the steps outlined in this guide.
Install dependencies
sudo apt-get install make build-essential gcc git jq chrony curl -y
Install Go
go 1.20.1 is needed for the current Juno (cosmos) version, to change this edit the version accordingly
wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.20.1
This script is made by osmosis-labs and installs PATH
variables to .bashrc
and sets up in a way compatible with the rest of the build. Go binary installs to $HOME/.go
and $HOME/go/bin
Run source $HOME/.bashrc
to take effect, confirm installed with go version
which should return the version installed
#to remove installation
wget -q -O - https://git.io/vQhTU | bash -s -- --remove
Install Juno Binary
Find latest version here: replace with correct version-tag example git checkout v16.0.0
# from $HOME dir
git clone https://github.com/CosmosContracts/juno
cd juno
git fetch
git checkout <version-tag>
Make the binary
make install
Confirm installed
junod version
If not setting up as a full node and syncing the data, you can add a public rpc. This adds to the client.toml
junod config node https://rpc-juno.itastakers.com:443
To interact with Juno chain via CLI, more information found here
Configuration of junod
to run as a full node, later setup with cosmovisor to handle chain upgrades seamlessly.
Initialize node
Replace `NODE_NAME` with a name of your choice
junod init <NODE_NAME> --chain-id juno-1
This will generate the following files in ~/.juno/config/
Files: priv_validator_key.json
/ node_key.json
/ genesis.json
Download Genesis file
rm ~/.juno/config/genesis.json
wget https://download.dimi.sh/juno-phoenix2-genesis.tar.gz
tar -xvf juno-phoenix2-genesis.tar.gz
mv juno-phoenix2-genesis.json $HOME/.juno/config/genesis.json
Alt source for genesis file here:
Seeds and persistent Peers
From docs: seeds, adding seeds or persistent peers can help with starting the node syncing by finding other nodes to connect to from a known list.
Add to the ~/.juno/config/config.toml
a comma separated list of seeds like so
Can find sources for peers here on Juno GitHub: or a cosmos community registry here:
Set pruning configurations
The following pruning configurations are required to work with snapshot
in app.toml
# Prune Type
pruning = "custom"
# Prune Strategy
pruning-keep-recent = "100"
pruning-keep-every = "0"
pruning-interval = "10"
in config.toml
indexer = "null"
Set Minimum gas prices:
from v16 this needs to be set or you get an error running
sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.0025ujuno,0.001ibc\/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9\"/" ~/.juno/config/app.toml
Cosmovisor: is a process management tool to handle cosmos based chain upgrades seamlessly, it looks for chain upgrades and downloads & installs at the correct block height.
Create directories for Cosmovisor
cd
mkdir -p ~/.juno/cosmovisor/genesis/bin
mkdir -p ~/.juno/cosmovisor/upgrades
create directory for corresponding binary version (change v16 accordingly)
mkdir -p ~/.juno/cosmovisor/upgrades/v16/bin
Install Cosmovisor binary
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest
this should install Cosmovisor binary to $GOPATH/bin/cosmovisor
Copy binaries to Cosmovisor
Note on versions: if using snapshot (this guide) you are downloading the latest binary, with chain data manually downloaded and placed in the correct location, cosmovisor will look from the block height the node is currently on and the corresponding binary in the upgrades folder. The binary also needs to be placed in ~/.juno/cosmovisor/genesis/bin
for first start up or an error will occur.
cp $GOPATH/bin/junod ~/.juno/cosmovisor/genesis/bin
cp $GOPATH/bin/junod ~/.juno/cosmovisor/upgrades/v16/bin/
Find the snapshot here and copy the download link:
#get packages required to unpack data
sudo apt install snapd -y
sudo snap install lz4
Download Snapshot, Replace with the correct download link
wget -O juno_8988038.tar.lz4 https://snapshots.polkachu.com/snapshots/juno/juno_8988038.tar.lz4 --inet4-only
Extract data into directory
lz4 -c -d juno_8988038.tar.lz4 | tar -x -C $HOME/.juno
# rm the compressed file
rm -v juno_8988038.tar.lz4
More info here:
echo "[Unit]
Description=Juno Daemon (cosmovisor)
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/go/bin/cosmovisor run start
Restart=always
RestartSec=3
LimitNOFILE=4096
Environment="DAEMON_NAME=junod"
Environment="DAEMON_HOME=$HOME/.juno"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_LOG_BUFFER_SIZE=512"
[Install]
WantedBy=multi-user.target" | sudo tee /lib/systemd/system/cosmovisor.service > /dev/null
Enable and Start service
sudo systemctl daemon-reload
sudo systemctl enable cosmovisor
sudo systemctl start cosmovisor
Check status and logs
sudo systemctl status cosmovisor
journalctl -u cosmovisor -f
Stop service
sudo systemctl stop cosmovisor
Make changes to service file
sudo nano /lib/systemd/system/cosmovisor.service
Check Node Sync status
# Query via the RPC (default port: 26657)
curl http://localhost:26657/status | jq .result.sync_info.catching_up
To allow Cosmovisor to auto download binaries, in the system service
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"
The reason this is usually set to false
by default is its recommended to not use “auto” for mainnet deployments currently, this is likely because Cosmovisor is still early software, for Testnet deployments set to true
Option 2: Manual Upgrade To do this manually, it will look something like these steps: here
Stop the service sudo systemctl stop junod
Git checkout
and make
the latest tag version:
Make folder in Cosmovisor for latest version.
Copy binary to folder
Restart node
Edit RPC/gRPC server configurations
Edit Configurations to ensure APIs are open and reachable on all servers, to expose externally change to `0.0.0.0` which will listen for requests from any IP.
If configuring with a sub-domain process (setup locally) then `localhost` should be used, as these API ports would only need to be exposed to the host.
Ports can be changed, if need be but will need to be changed in any other services that connect.
Open RPC: in config.toml
# TCP or UNIX socket address for the RPC server to listen on
laddr = "tcp://0.0.0.0:26657"
# TCP or UNIX socket address for the gRPC server to listen on
# NOTE: This server only supports /broadcast_tx_commit
grpc_laddr = ""
Open REST API: in app.toml
[api]
# Enable defines if the API server should be enabled.
enable = true
# Swagger defines if swagger documentation should automatically be registered.
swagger = false
# Address defines the API server to listen on.
address = "tcp://0.0.0.0:1317"
Open gRPC: in app.toml
[grpc]
# Enable defines if the gRPC server should be enabled.
enable = true
# Address defines the gRPC server address to bind to.
address = "tcp://0.0.0.0:9090"
Add Open all Ports
sudo ufw allow 26657 # RPC
sudo ufw allow 9090 # grpc
sudo ufw allow 1317 # REST
ensure do not get locked out, if on VPS
sudo ufw allow shh
sudo ufw enable
to change ports edit the port in the configuration files above, this should not be needed when setting up with TLS domain routing as NGIX will manage routing through a specified port, this port is the one you need to make sure to avoid conflict and port forward/open as needed.
More on setting up TLS Certificates here: sub-domains with NGINX