# Osmosis Full Node

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

---

**Deploy a full node for Osmosis chain**

_Document Last Update: 13/09/23_

Osmosis is a Cosmos-based chain for decentralized exchange of IBC integrated assets it’s the largest DEX in the Cosmos ecosystem.

[

Osmosis
-------

Swap, earn, and build on the leading decentralized Cosmos exchange.

https://osmosis.zone

![](https://storage.googleapis.com/papyrus_images/a2711d1ac23e06aef92b2fb3ebcf95557c0b2be9139b98b5590d3d1783e0204f.png)

](https://osmosis.zone/)

**Hardware requirements**

4vCPU / 32 GB RAM (or equivalent swap file set up) / 1 TB of storage space (min)

To setup Swap space see [here](https://github.com/GLCNI/RPC-node-deployments/blob/main/additional/swap_space.md):

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

1\. Install Osmosis Binary
--------------------------

### Method 1: Install Script (easy)

The script automates the install process

**Install script:**

[https://github.com/GLCNI/RPC-node-deployments/tree/main#osmosis](https://github.com/GLCNI/RPC-node-deployments/tree/main#osmosis)

This is my own version to automate the steps for ‘Method 2: Manual build’, the steps outlined in this guide.

**Install Script by Osmosis Labs:**

(Note this currently is not working (but will be updated soon) 20/6/23)

    curl -sL https://get.osmosis.zone/install > i.py && python3 i.py
    

### Method 2: Manual build

**Install dependencies**

    sudo apt install git build-essential ufw curl jq snapd make jq tar clang pkg-config libssl-dev –y
    

**Install Go**

Install go latest version, if there are issues with the build it may be an older go version is needed for the corresponding osmosis binary, see the command to remove installation for this.

    wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.20.5
    

_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`

Run `source /home/<user>/.bashrc` to take effect, the confirm installed with

    go version
    

To remove installation

    wget -q -O - https://git.io/vQhTU | bash -s -- --remove
    

**Install Osmosis Binary**

Check Osmosis releases [here](https://github.com/osmosis-labs/osmosis/releases):

    cd $HOME
    git clone https://github.com/osmosis-labs/osmosis
    cd osmosis
    git checkout v19.0.0
    
    make install
    

This installs a working folder `.osmosisd` with configuration files in `.osmosisd/config`

Test Binary with `osmosisd version` this should return the version just installed.

!['make' may take a while, it will be successful if version can be returned](https://storage.googleapis.com/papyrus_images/b6e8eba56305e7610d9d58422b45b742e704d42f6128b9c7ca823de0bf4d99d9.png)

'make' may take a while, it will be successful if version can be returned

2\. Osmosis CLI
---------------

This covers how to interact with the osmosis cli after installing the binary from step 1. This allows you to interact with the chain directly for sending TXs and IBC TXs, By default node endpoint is set to `localhost` the settings are stored in `~/.osmosisd/config/client.toml`

**Add RPC node (if not running a node)**

You can find public RPC's [here](https://cosmos.directory/osmosis): add to a CLI command

    --node <nodeurl>:<port>
    

Alternatively add to config by typing into terminal

    osmosisd config node https://rpc.osl.zone:443
    

**Set chain-id and keyring backend**

    osmosisd config chain-id osmosis-1
    osmosisd config keyring-backend test
    

**Set Variables**

    OSMO_WALLET="NAME OF WALLET"
    OSMO_MONIKER="NAME OF CHOICE FOR NODE"
    

**Add a wallet (optional)**

This is not required to run a full node but can be added;

    # create new
    osmosisd keys add $OSMO_WALLET
    # to restore from seed
    osmosisd keys add $OSMO_WALLET --recover
    # other commands
    keys list
    keys show $OSMO_WALLET
    

These are some examples, a full list can be queried with `osmosisd help`, and more information can be found in the docs [here](https://docs.osmosis.zone/osmosis-core/osmosisd/):

3\. Configure Osmosis Node
--------------------------

**Initialize node**

    osmosisd init $OSMO_MONIKER
    

![](https://storage.googleapis.com/papyrus_images/d9f1a898b6d07aace3138ec3af5c7c8add60ef4c39aa3d1fd492c6f70b3ee8df.png)

**Get Genesis**

Download and place the genesis file in the osmosis config folder:

    wget -O ~/.osmosisd/config/genesis.json https://github.com/osmosis-labs/networks/raw/main/osmosis-1/genesis.json
    

**Seeds, Persistent peers, Address book**

Some validators will host these files that can help find peers which can help your node to catch up. Example [polkachu](https://www.polkachu.com/networks/osmosis)

4\. Download Chain Data
-----------------------

This install method is using snapshot data, this means downloading the blockchain history directly from a trusted source. This is much quicker than syncing and verifying from genesis, which can be done should you decide, but requires a slightly different install method.

* * *

**To Sync from genesis (optional)**

This means starting from V1 osmosis binary and syncing the entire chain state from block 0, this can be time consuming but is the most trust-less way to join osmosis chain. The blockchain data will be ‘default’ which can consume more space (approx. 700-800GB /20-6-23)

Download V1 of Osmosis:

    cd osmosis
    git checkout v1.0.0
    
    make install
    

* * *

**Option 1: Quicksync**

This example is with Quicksync by [Chainlayer](https://www.chainlayer.io/), which works with default pruning settings.

Download liblz4-tool to handle the compressed file

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

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

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

On Download right click and copy clean link

    URL=<place URL here>
    cd $HOME/.osmosisd/
    wget -O - $URL | lz4 -d | tar -xvf -
    

**Option 2: Other Snapshot Providers**

many community members host this data example: [polkachu](https://www.polkachu.com/networks/osmosis)

NOTE: pruning settings may need to change, be sure to check with provider

Example: (for polkachu)

`app.toml` settings

    # Prune Type
    pruning = "custom"
    
    # Prune Strategy
    pruning-keep-recent = "100"
    pruning-keep-every = "0"
    pruning-interval = "10"
    

`config.toml` settings

    indexer = "null"
    

5\. Setup SystemD to run Node
-----------------------------

### Option 1: without Cosmovisor

Create System service to run node as a background service

    sudo tee /etc/systemd/system/osmosisd.service > /dev/null <<EOF
    [Unit] 
    Description=OSMO node
    After=network.target 
    [Service] 
    Type=simple
    User=$USER
    ExecStart=$(which osmosisd) start 
    Restart=on-failure
    RestartSec=10
    LimitNOFILE=65535
    [Install]
    WantedBy=multi-user.target
    EOF
    

**Enable and Start service**

    sudo systemctl daemon-reload
    sudo systemctl enable osmosisd
    sudo systemctl start osmosisd
    

**Check status and logs**

    sudo systemctl status osmosisd
    

    journalctl -u osmosisd -f
    

**Stop service**

    sudo systemctl stop osmosisd
    

Make changes to service file

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

![Working Node will look something like this](https://storage.googleapis.com/papyrus_images/e10102b268f0a360459a0287a54c858a02f12ddc9de18fb61501c7275fdcf802.png)

Working Node will look something like this

**Check Sync status**

    curl -s localhost:26657/status | jq .result | jq .sync_info
    

    curl -s localhost:26657/status | grep block_height
    

![](https://storage.googleapis.com/papyrus_images/a1ff898a2f373ba8b6240e666391b66e52eaed1e1735bb2e4d24018cc94fd0ae.png)

### Option 2: With Cosmovisor

[Cosmovisor](https://docs.cosmos.network/main/tooling/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 ~/.osmosisd/cosmovisor/genesis/bin
    mkdir -p ~/.osmosisd/cosmovisor/upgrades 
    

create directory for corresponding binary version

    mkdir -p ~/.osmosisd/cosmovisor/upgrades/v19/bin
    

**Install Cosmovisor binary**

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

**Copy binary to 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_ `~/.osmosisd/cosmovisor/genesis/bin` for first start up or an error will occur.

    cp $GOPATH/bin/osmosisd ~/.osmosisd/cosmovisor/genesis/bin
    cp $GOPATH/bin/osmosisd ~/.osmosisd/cosmovisor/upgrades/v19/bin/
    

**Setup System Service for Cosmovisor**

Create System service to run node as a background service through Cosmovisor

    echo "[Unit]
    Description=Cosmovisor daemon
    After=network-online.target
    [Service]
    Environment=\"DAEMON_NAME=osmosisd\"
    Environment=\"DAEMON_HOME=${HOME}/.osmosisd\"
    Environment=\"DAEMON_RESTART_AFTER_UPGRADE=true\"
    Environment=\"DAEMON_ALLOW_DOWNLOAD_BINARIES=false\"
    Environment=\"DAEMON_LOG_BUFFER_SIZE=512\"
    Environment=\"UNSAFE_SKIP_BACKUP=true\"
    User=$USER
    ExecStart=${HOME}/go/bin/cosmovisor run start
    Restart=always
    RestartSec=3
    LimitNOFILE=infinity
    LimitNPROC=infinity
    [Install]
    WantedBy=multi-user.target
    " | sudo tee /lib/systemd/system/cosmovisor.service > /dev/null
    

Additional Settings to Open up node for API calls
-------------------------------------------------

**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](https://github.com/GLCNI/RPC-node-deployments/blob/main/additional/sub_domains_nginx.md)

---

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