# Cosmos Full Node **Published by:** [GLCstaked](https://paragraph.com/@glcstaked/) **Published on:** 2023-06-24 **URL:** https://paragraph.com/@glcstaked/cosmos-full-node ## Content Deploy a full node for cosmos chain Cosmos hub is the economic centre of the Interchain cosmos ecosystem. Full node is a node that does not build blocks (non-validating) but stores the chain state and allows direct access to the network. NOTE: full node refers to a non-archival implementation of the node.Cosmos: The Internet of BlockchainsCosmos is an ever-expanding ecosystem of interoperable and sovereign blockchain apps and services, built for a decentralized future.https://cosmos.networkHardware requirements Running a full archive node can be resource intensive, as the state is +1.6TB. for a default full node using quicksync (snapshot) which this guide will cover 1TB would suffice, but 2TB will allow large buffer. current Cosmos Hub mainnet `cosmoshub-4` Minimum: 16GB / 1TB Storage SSD / 4vCPU (8threads) Recommended: 32GB RAM / 2TB Storage SSD / 4vCPU (8threads) Setup device Install ubuntu 20.04 LTSUbuntu 20.04.6 LTS (Focal Fossa)CD images for Ubuntu 20.04.6 LTS (Focal Fossa)https://www.releases.ubuntu.comUpdate packages and upgrade devicesudo apt update && sudo apt upgrade -y Configure swap 32GB RAM is more than suitable for cosmos, however it is a good idea to have swap configured to allow a buffer to be used in Storage. Chain upgrades via cosmovisor can be very memory intensive. See this guide for how to do this: PENDING Depending on storage used you can choose to configure 16GB or 32GB and set swappiness parameter to 10 to use swap only when the RAM usage is really high. Open Ports PEDNING1. Install Cosmos BinaryMethod 1: Install ScriptPENDINGMethod 2: Manual BuildInstall Dependenciessudo apt install git build-essential ufw curl jq snapd make jq tar clang pkg-config libssl-dev gcc -y Install Go Current cosmos binary requires v1.20.+ go, the following method is using a useful go install script by osmosis-labs, installs PATH variables to .bashrc and sets up in a way compatible with the rest of the build. Go binary installs to $HOME/.gowget -q -O - https://git.io/vQhTU | bash -s -- --version 1.20.3 source $HOME/.bashrc Alternative method: instructions from cosmos docs here: Install Cosmos Binary Find Releases here: Latest stable release is v10.0.1, must use Go v1.20 to build, to start with this binary must use statesync or quicksync (snapshot)git clone -b v10.0.1 https://github.com/cosmos/gaia.git cd gaia && make install # confirm install gaiad version –long Binary installs to $HOME/go/bin/gaiad2. Cosmos CLIPENDING3. Configure Cosmos NodeInitiate the Chain This creates the initial config files in working folder `.gaia`gaiad init <custom-moniker> moniker can be edited hereObtain Genesiscd wget https://raw.githubusercontent.com/cosmos/mainnet/master/genesis/genesis.cosmoshub-4.json.gz gzip -d genesis.cosmoshub-4.json.gz mv genesis.cosmoshub-4.json ~/.gaia/config/genesis.json Optional: Set seeds and peers Registry Here: This helps the node find peers quicker by setting persistent peers, syntax as follows:# Comma separated list of seed nodes to connect to seeds = "<seed node id 1>@<seed node address 1>:26656,<seed node id 2>@<seed node address 2>:26656" # Comma separated list of nodes to keep persistent connections to persistent_peers = "<node id 1>@<node address 1>:26656,<node id 2>@<node address 2>:26656" Optional: Download quicksync addrbookwget https://dl2.quicksync.io/json/addrbook.cosmos.json mv addrbook.cosmos.json ~/.gaia/config/addrbook.json 4. Set up CosmovisorCosmovisor is a process manager developed to relieve node operators of having to manually intervene every time there is an upgrade. Cosmovisor monitors the governance module for upgrade proposals; it will take care of downloading the new binary, stopping the old one, switching to the new one, and restarting. Info on cosmovisor operation: https://github.com/cosmos/cosmos-sdk/tree/main/tools/cosmovisor Create directories for cosmovisorcd mkdir -p ~/.gaia/cosmovisor/genesis/bin mkdir -p ~/.gaia/cosmovisor/upgrades create directory for corresponding binary versionmkdir -p ~/.gaia/cosmovisor/upgrades/v10/bin Install Cosmovisorgo install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest Binary installs to $HOME/go/bin/cosmovisor Confirm installed with cosmovisor versionThe error is because variables are not set, don’t worry as these are set in the service fileCopy binary to working folder in cosmovisor directory 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 ~/.gaia/cosmovisor/genesis/bin for first start up or an error will occur.cp $GOPATH/bin/gaiad ~/.gaia/cosmovisor/genesis/bin cp $GOPATH/bin/gaiad ~/.gaia/cosmovisor/upgrades/v10/bin/ 5. Download Chain DataThis install method is using snapshot data, this means downloading the blockchain history directly from a trusted source, many community members host this data example: chainlayer This is much quicker than syncing and verifying from genesis, which can be done should you decide, but requires a slightly different install method. Download liblz4-tool to handle the compressed filesudo apt-get install wget liblz4-tool aria2 jq -y Using pruned snapshot data, find the URL from here (using one of the hosted examples)On 'Download' right click and copy clean linkSNAPURL="https://dl2.quicksync.io/cosmoshub-4-pruned.20230624.0310.tar.lz4" cd $HOME/.gaia/ wget -O - $SNAPURL | lz4 -d | tar -xvf – download will look similarSyncing from genesis: (if not using snapshot)To sync an archive or full node from scratch, it is important to note that you must start with V4.2.1 (opens new window)and proceed through different upgrades, more info here:6. Set up SystemDSetup System service to run cosmosvisorsudo tee /etc/systemd/system/cosmovisor.service > /dev/null <<EOF [Unit] Description=Gaia Daemon After=network-online.target [Service] Environment="DAEMON_HOME=$HOME/.gaia" Environment="DAEMON_NAME=gaiad" Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false" Environment="DAEMON_RESTART_AFTER_UPGRADE=true" User=$USER ExecStart=${HOME}/go/bin/cosmovisor run start Restart=always RestartSec=3 LimitNOFILE=4096 [Install] WantedBy=multi-user.target EOF Enable and Start servicesudo systemctl daemon-reload sudo systemctl enable cosmovisor sudo systemctl start cosmovisor Check status and logssudo systemctl status cosmovisor journalctl -u cosmovisor -f Make changes to the servicesudo nano /etc/systemd/system/cosmovisor.service If configured correctly logs should look similar ## Publication Information - [GLCstaked](https://paragraph.com/@glcstaked/): Publication homepage - [All Posts](https://paragraph.com/@glcstaked/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@glcstaked): Subscribe to updates