# Cosmos Full Node

By [GLCstaked](https://paragraph.com/@glcstaked) · 2023-06-24

---

**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 Blockchains
-----------------------------------

Cosmos is an ever-expanding ecosystem of interoperable and sovereign blockchain apps and services, built for a decentralized future.

https://cosmos.network

![](https://storage.googleapis.com/papyrus_images/88334329699a86a95f456817018a71a687b3284de7abee2ff4e5b724d7c53bfd.jpg)

](https://cosmos.network/)

**Hardware 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 LTS

[

Ubuntu 20.04.6 LTS (Focal Fossa)
--------------------------------

CD images for Ubuntu 20.04.6 LTS (Focal Fossa)

https://www.releases.ubuntu.com



](https://www.releases.ubuntu.com/focal/)

**Update packages and upgrade device**

    sudo 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**

PEDNING

1\. Install Cosmos Binary
-------------------------

### Method 1: Install Script

PENDING

### Method 2: Manual Build

**Install Dependencies**

    sudo 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/.go

    wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.20.3
    source $HOME/.bashrc
    

Alternative method: instructions from cosmos docs [here](https://hub.cosmos.network/main/getting-started/installation.html#install-go):

**Install Cosmos Binary**

Find Releases [here](https://github.com/cosmos/gaia/releases):

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/gaiad`

2\. Cosmos CLI
--------------

PENDING

3\. Configure Cosmos Node
-------------------------

**Initiate the Chain**

This creates the initial config files in working folder \`.gaia\`

    gaiad init <custom-moniker>
    

![moniker can be edited here ](https://storage.googleapis.com/papyrus_images/0dd14f2c5904c9c70e47db5a316981a098f02587bb03410f9a98fa35f274e340.png)

moniker can be edited here

**Obtain Genesis**

    cd
    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](https://github.com/cosmos/chain-registry/blob/master/cosmoshub/chain.json): 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 addrbook**

    wget https://dl2.quicksync.io/json/addrbook.cosmos.json
    mv addrbook.cosmos.json ~/.gaia/config/addrbook.json
    

4\. Set up Cosmovisor
---------------------

_Cosmovisor 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](https://github.com/cosmos/cosmos-sdk/tree/main/tools/cosmovisor)

**Create directories for cosmovisor**

    cd
    mkdir -p ~/.gaia/cosmovisor/genesis/bin
    mkdir -p ~/.gaia/cosmovisor/upgrades
    

create directory for corresponding binary version

    mkdir -p ~/.gaia/cosmovisor/upgrades/v10/bin
    

**Install Cosmovisor**

    go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest
    

Binary installs to `$HOME/go/bin/cosmovisor`

Confirm installed with `cosmovisor version`

![The error is because variables are not set, don’t worry as these are set in the service file](https://storage.googleapis.com/papyrus_images/4dd039b4b28514619a4b4e726e3ba85a9bee606e0a8e825100f1f10578428721.png)

The error is because variables are not set, don’t worry as these are set in the service file

**Copy 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 Data
-----------------------

This 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](https://quicksync.io/)

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 file

    sudo apt-get install wget liblz4-tool aria2 jq -y
    

Using pruned snapshot data, find the URL from [here](https://quicksync.io/networks/cosmos.html) (using one of the hosted examples)

![On 'Download' right click and copy clean link](https://storage.googleapis.com/papyrus_images/6d4f01c8abe632131c1e93b0e48ad4422eadb7791aff02368126d0177e98f2b3.png)

On 'Download' right click and copy clean link

    SNAPURL="https://dl2.quicksync.io/cosmoshub-4-pruned.20230624.0310.tar.lz4"
    cd $HOME/.gaia/
    wget -O - $SNAPURL | lz4 -d | tar -xvf –
    

![download will look similar](https://storage.googleapis.com/papyrus_images/e0c349afe087626d92daebc7eedef008ca5000d93549a9a9a81efd9cfe50ee4d.png)

download will look similar

### Syncing 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](https://hub.cosmos.network/main/hub-tutorials/join-mainnet.html#releases-upgrades):

6\. Set up SystemD
------------------

Setup System service to run cosmosvisor

    sudo 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 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
    

**Make changes to the service**

    sudo nano /etc/systemd/system/cosmovisor.service
    

![If configured correctly logs should look similar](https://storage.googleapis.com/papyrus_images/3ec532a3d0e8979f9581c78ec48eed128a7a54203c9f50783f1ac10e204fe23c.png)

If configured correctly logs should look similar

---

*Originally published on [GLCstaked](https://paragraph.com/@glcstaked/cosmos-full-node)*
