Injective | Documentation
InjectiveGithub
Injective | Documentation
Injective | Documentation
  • About Injective
  • Getting Started
    • Wallet
      • Create a wallet
      • Accounts
      • Staking
      • Governance
      • Auction
    • Token Standards
      • INJ coin
      • Token Factory
      • CW20 Standard
    • Transactions
      • Gas and Fees
  • Guides
    • Create a Wallet
    • Bridge
      • From Ethereum
      • Using Wormhole
      • Using IBC
      • From Solana
    • Launch a Token
    • Launch a Market
    • Denom Metadata
    • Get INJ
  • Toolkits
    • injectived
      • Install injectived
      • Using injectived
      • Commands
    • Injective TS SDK
    • Injective Go SDK
    • Injective Python SDK
    • Injective CW SDK
    • Injective Rust
    • The Graph
  • References
  • Glossary
  • Developers
    • Getting Started
      • Guides
        • Testnet Proposals
        • Convert addresses
        • Calculations
          • Min Price Tick Size
          • Min Quantity Tick Size
        • Testnet Faucet Integration
    • Exchange Developers
      • Build a DEX
      • Provider Oracle
    • Cosmwasm Developers
      • Your First Smart Contract
      • Guides
        • Local Development
        • Mainnet Deployment
        • Whitelisting deployment address
        • Create your Swap Contract
        • Creating UIs
      • Using Injective Queries and Messages
      • CW20 Adapter
      • Injective Test Tube
    • Modules
      • Injective
        • Auction
          • State
          • Messages
          • EndBlock
          • Events
          • Params
          • Errors
        • Exchange
          • Derivative Markets Concepts
          • Spot Markets Concepts
          • Binary Option Markets Concepts
          • Other Concepts
          • State
          • State Transitions
          • Messages
          • Proposals
          • BeginBlock
          • EndBlock
          • Events
          • Params
          • MsgPrivilegedExecuteContract
          • Errors
        • Insurance
          • State
          • State Transitions
          • Messages
          • EndBlock
          • Events
          • Params
          • Improvements
          • Errors
        • OCR
          • Concepts
          • State
          • Messages
          • Proposals
          • BeginBlock
          • Hooks
          • Events
          • Params
          • Errors
        • Oracle
          • State
          • Keeper
          • Messages
          • Proposals
          • Events
          • Improvements
          • Errors
        • Peggy
          • Definitions
          • Workflow
          • State
          • Messages
          • Slashing
          • EndBlock
          • Events
          • Params
          • Relay Semantics
          • Improvements
          • Errors
        • Permissions
          • Concepts
          • State
          • State Transition
          • Errors
        • TokenFactory
          • Concepts
          • State
          • Messages
          • Events
          • Params
          • Errors
        • WasmX
          • Concepts
          • Data
          • Proposals
          • Messages
          • Params
          • Errors
        • Lanes
        • TxFees
      • Core
        • Auth
        • AuthZ
        • Bank
        • Consensus
        • Crisis
        • Distribution
        • Evidence
        • Feegrant
        • Gov
        • Group
        • Mint
        • NFT
        • Params
        • Slashing
        • Staking
        • Upgrade
        • Circuit
        • Genutils
    • dApps Documentation
  • Nodes
    • Getting Started
      • Interact with a node
      • Running a node
        • Setting up the keyring
        • Join a network
        • Cosmovisor
        • Upgrade your node
    • Validators
      • Mainnet
        • Peggo
        • Canonical Chain Upgrades
          • Upgrade to 10002-rc1
          • Upgrade to 10002-rc2
          • Upgrade to 10003-rc1
          • Upgrade to 10004-rc1
          • Upgrade to 10004-rc1-patch
          • Upgrade to 10005-rc1
          • Upgrade to 10006-rc1
          • Upgrade to 10007-rc1
          • Upgrade to 10008 - Camelot
          • Upgrade to 10009
          • Upgrade to v1.10
          • Upgrade to v1.11
          • Upgrade to v1.12.0 - Volan
          • Upgrade to v1.12.1
          • Upgrade to v1.13.0 - Altaris
          • Upgrade to v1.13.2
          • Upgrade to v1.13.3
          • Upgrade to v1.14.0
          • Upgrade to v1.14.1
          • Upgrade to v1.15.0
      • Testnet
        • Testnet Peggo
    • Public Endpoints
    • Premium Endpoints
    • Injective Indexer Setup
  • Traders
    • Getting Started
    • Documentation
    • API Reference
  • Useful Links
    • Injective 101
    • Injective Hub
    • Injective Explorer
    • Chain API Reference
    • Indexer API Reference
    • Testnet Faucet
Powered by GitBook
On this page
  • Table of Contents
  • Installation
  • Installing via Go
  • Environment Variables
  • Directory Structure
  • Running Cosmovisor
  • Handling Chain Upgrades
  • Running Cosmovisor as a Systemd Service
Edit on GitHub
Export as PDF
  1. Nodes
  2. Getting Started
  3. Running a node

Cosmovisor

PreviousJoin a networkNextUpgrade your node

Last updated 3 months ago

Cosmovisor is a process manager designed for Cosmos SDK–based blockchains that simplifies the management of binary (chain) upgrades. This guide provides step‐by‐step instructions to set up Cosmovisor for your Injective Network node.

Note: These instructions assume you already have an existing chain binary (e.g., injectived) and a working Go environment if you choose to install Cosmovisor from source. Adjust the names and paths as needed for your specific setup.


Table of Contents


Installation

Installing via Go

If you have Go installed, you can install Cosmovisor with the following command:

go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0

Tip: Ensure that your Go binary installation path (commonly $GOPATH/bin or $HOME/go/bin) is added to your system’s PATH. You can verify the installation by running:

which cosmovisor

Environment Variables

Set up the following environment variables so that Cosmovisor knows which binary to run and where to locate it:

  • DAEMON_NAME The name of your chain’s binary (e.g., injectived).

  • DAEMON_HOME The home directory for your node (e.g., ~/.injectived).

You can set these variables in your shell’s profile (like ~/.bashrc or ~/.profile) or export them directly in your terminal session:

export DAEMON_NAME=injectived
export DAEMON_HOME=~/.injectived

Directory Structure

Cosmovisor expects a specific folder structure in your node’s home directory:

  1. Create the Genesis Directory

    This directory holds the initial (genesis) binary.

    mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin
  2. Copy Your Current Binary

    Place your current chain binary (e.g., injectived) into the genesis folder. Make sure the file name matches the DAEMON_NAME value (see next section).

    cp $(which injectived) $DAEMON_HOME/cosmovisor/genesis/bin/injectived

Running Cosmovisor

Instead of running your chain’s binary directly, start your node with Cosmovisor by executing:

cosmovisor run start

Cosmovisor will:

  • Look for the binary in $DAEMON_HOME/cosmovisor/genesis/bin (or the appropriate upgrade folder).

  • Start your node using that binary.

  • Monitor for any on-chain upgrade signals and automatically switch binaries when needed.


Handling Chain Upgrades

When an upgrade is announced on-chain, prepare the new binary so Cosmovisor can switch to it automatically:

  1. Create an Upgrade Directory

    Use the upgrade name provided on-chain (e.g., v1.14.0):

    mkdir -p $DAEMON_HOME/cosmovisor/upgrades/<upgrade_name>/bin
  2. Place the New Binary

    Compile or download the new binary, then copy it into the upgrade directory. Ensure the binary name matches DAEMON_NAME.

    cp /path/to/new/injectived $DAEMON_HOME/cosmovisor/upgrades/<upgrade_name>/bin
    cp /path/to/new/libwasmvm.x86_64.so $DAEMON_HOME/cosmovisor/upgrades/<upgrade_name>/bin

TIP: If you have downloaded the injectived binary package from GitHub, we copy libwasmvm.x86_64.so to the upgrade bin directory. An environment variable will be later added to the systemd service to add this directory to LD_LIBRARY_PATH.

  1. Upgrade Process

    When the upgrade height is reached, Cosmovisor will detect the scheduled upgrade and automatically switch to the binary located in the corresponding upgrade folder.


Running Cosmovisor as a Systemd Service

For production environments, it is common to run your node as a systemd service. Below is an example service file.

  1. Create the Service File

    Create a file (e.g., /etc/systemd/system/injectived.service) with the following content. Adjust the paths and <your_username> accordingly:

    [Unit]
    Description=Injective Daemon managed by Cosmovisor
    After=network-online.target
    
    [Service]
    User=<your_username>
    ExecStart=/home/<your_username>/go/bin/cosmovisor run start
    Restart=always
    RestartSec=3
    Environment="DAEMON_NAME=injectived"
    Environment="DAEMON_HOME=/home/<your_username>/.injectived"
    Environment="PATH=/usr/local/bin:/home/<your_username>/go/bin:$PATH"
    Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
    Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
    Environment="UNSAFE_SKIP_BACKUP=true"
    Environment="LD_LIBRARY_PATH=/home/<your_username>/.injectived/cosmovisor/current/bin"
    
    [Install]
    WantedBy=multi-user.target
  2. Enable and Start the Service

    sudo systemctl daemon-reload
    sudo systemctl enable injectived.service
    sudo systemctl start injectived.service
  3. Check Logs

    Verify that your service is running smoothly:

    journalctl -u injectived.service -f

Installation
Installing via Go
Environment Variables
Directory Structure
Running Cosmovisor
Handling Chain Upgrades
Running Cosmovisor as a Systemd Service