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
Edit on GitHub
Export as PDF
  1. Nodes
  2. Getting Started
  3. Running a node

Join a network

This guide will walk you through the process of setting up a standalone network locally, as well as running a node on Mainnet or Testnet.

You can also find the hardware requirements for each network in the respective tabs.

To easily set up a local node, download and run the setup.sh script. This will initialize your local Injective network.

wget https://raw.githubusercontent.com/InjectiveLabs/injective-chain-releases/master/scripts/setup.sh
chmod +x ./setup.sh # Make the script executable
./setup.sh

Start the node by running:

injectived start # Blocks should start coming in after running this

For further explanation on what the script is doing and more fine-grained control over the setup process, continue reading below.

Initialize the Chain

Before running Injective node, we need to initialize the chain as well as the node's genesis file:

# The <moniker> argument is the custom username of your node. It should be human-readable.
injectived init <moniker> --chain-id=injective-1

The command above creates all the configuration files needed for your node to run as well as a default genesis file, which defines the initial state of the network. All these configuration files are in ~/.injectived by default, but you can overwrite the location of this folder by passing the --home flag. Note that if you choose to use a different directory other than ~/.injectived, you must specify the location with the --home flag each time an injectived command is run. If you already have a genesis file, you can overwrite it with the --overwrite or -o flag.

The ~/.injectived folder has the following structure:

.                                   # ~/.injectived
  |- data                           # Contains the databases used by the node.
  |- config/
      |- app.toml                   # Application-related configuration file.
      |- config.toml                # Tendermint-related configuration file.
      |- genesis.json               # The genesis file.
      |- node_key.json              # Private key to use for node authentication in the p2p protocol.
      |- priv_validator_key.json    # Private key to use as a validator in the consensus protocol.

Modify the genesis.json File

At this point, a modification is required in the genesis.json file:

  • Change the staking bond_denom, crisis denom, gov denom, and mint denom values to "inj", since that is the native token of Injective.

This can easily be done by running the following commands:

cat $HOME/.injectived/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="inj"' > $HOME/.injectived/config/tmp_genesis.json && mv $HOME/.injectived/config/tmp_genesis.json $HOME/.injectived/config/genesis.json
cat $HOME/.injectived/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="inj"' > $HOME/.injectived/config/tmp_genesis.json && mv $HOME/.injectived/config/tmp_genesis.json $HOME/.injectived/config/genesis.json
cat $HOME/.injectived/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="inj"' > $HOME/.injectived/config/tmp_genesis.json && mv $HOME/.injectived/config/tmp_genesis.json $HOME/.injectived/config/genesis.json
cat $HOME/.injectived/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="inj"' > $HOME/.injectived/config/tmp_genesis.json && mv $HOME/.injectived/config/tmp_genesis.json $HOME/.injectived/config/genesis.json

The commands above will only work if the default .injectived directory is used. For a specific directory, either modify the commands above or manually edit the genesis.json file to reflect the changes.

Create Keys for the Validator Account

Before starting the chain, you need to populate the state with at least one account. To do so, first create a new account in the keyring named my_validator under the test keyring backend (feel free to choose another name and another backend):

injectived keys add my_validator --keyring-backend=test

# Put the generated address in a variable for later use.
MY_VALIDATOR_ADDRESS=$(injectived keys show my_validator -a --keyring-backend=test)

Now that you have created a local account, go ahead and grant it some inj tokens in your chain's genesis file. Doing so will also make sure your chain is aware of this account's existence from the genesis of the chain:

injectived add-genesis-account $MY_VALIDATOR_ADDRESS 100000000000000000000000000inj --chain-id=injective-1

$MY_VALIDATOR_ADDRESS is the variable that holds the address of the my_validator key in the keyring. Tokens in Injective have the {amount}{denom} format: amount is an 18-digit-precision decimal number, and denom is the unique token identifier with its denomination key (e.g. inj). Here, we are granting inj tokens, as inj is the token identifier used for staking in injectived.

Add the Validator to the Chain

Now that your account has some tokens, you need to add a validator to your chain. Validators are special full-nodes that participate in the consensus process in order to add new blocks to the chain. Any account can declare its intention to become a validator operator, but only those with sufficient delegation get to enter the active set. For this guide, you will add your local node (created via the init command above) as a validator of your chain. Validators can be declared before a chain is first started via a special transaction included in the genesis file called a gentx:

# Create a gentx.
injectived genesis gentx my_validator 1000000000000000000000inj --chain-id=injective-1 --keyring-backend=test

# Add the gentx to the genesis file.
injectived genesis collect-gentxs

A gentx does three things:

  1. Registers the validator account you created as a validator operator account (i.e. the account that controls the validator).

  2. Self-delegates the provided amount of staking tokens.

  3. Link the operator account with a Tendermint node pubkey that will be used for signing blocks. If no --pubkey flag is provided, it defaults to the local node pubkey created via the injectived init command above.

For more information on gentx, use the following command:

injectived genesis gentx --help

Configuring the Node Using app.toml and config.toml

Two configuration files are automatically generated inside ~/.injectived/config:

  • app.toml: generated by the Cosmos SDK (which Injective is built on), and used for configurations such as state pruning strategies, telemetry, gRPC and REST server configurations, state sync, and more.

Both files are heavily commented—please refer to them directly to tweak your node.

One example config to tweak is the minimum-gas-prices field inside app.toml, which defines the minimum gas prices the validator node is willing to accept for processing a transaction. If it's empty, make sure to edit the field with some value, for example 10inj, or else the node will halt on startup. For this tutorial, let's set the minimum gas price to 0:

 # The minimum gas prices a validator is willing to accept for processing a
 # transaction. A transaction's fees must meet the minimum of any denomination
 # specified in this config (e.g. 0.25token1;0.0001token2).
 minimum-gas-prices = "0inj"

Run a Localnet

Now that everything is set up, you can finally start your node:

injectived start # Blocks should start coming in after running this

This command allows you to run a single node, which is is enough to interact with the chain through the node, but you may wish to run multiple nodes at the same time to see how consensus occurs between them.

Hardware Specification

Node operators should deploy bare metal servers to achieve optimal performance. Additionally, validator nodes must meet the recommended hardware specifications and particularly the CPU requirements, to ensure high uptime.

Minimum

Recommendation

RAM Memory 128GB

RAM Memory 128GB

CPU 12 cores

CPU 16 cores

CPU base clock 3.7GHz

CPU base clock 4.2GHz

Storage 2TB NVMe

Storage 2TB NVMe

Network 1Gbps+

Network 1Gbps+

Install injectived and peggo

wget https://github.com/InjectiveLabs/testnet/releases/download/v1.12.9-testnet-1703762556/linux-amd64.zip
unzip linux-amd64.zip
sudo mv peggo /usr/bin
sudo mv injectived /usr/bin
sudo mv libwasmvm.x86_64.so /usr/lib 

Initialize a New Injective Chain Node

Before running Injective node, we need to initialize the chain as well as the node's genesis file:

# The argument <moniker> is the custom username of your node, it should be human-readable.
export MONIKER=<moniker>
# Injective Testnet has a chain-id of "injective-888"
injectived init $MONIKER --chain-id injective-888

Running the init command will create injectived default configuration files at ~/.injectived.

Prepare Configuration to Join Testnet

You should now update the default configuration with the Testnet's genesis file and application config file, as well as configure your persistent peers with seed nodes.

git clone https://github.com/InjectiveLabs/testnet.git

# copy genesis file to config directory
aws s3 cp --no-sign-request s3://injective-snapshots/testnet/genesis.json .
mv genesis.json ~/.injectived/config/

# copy config file to config directory
cp testnet/corfu/70001/app.toml  ~/.injectived/config/app.toml
cp testnet/corfu/70001/config.toml ~/.injectived/config/config.toml

You can also run verify the checksum of the genesis checksum - a4abe4e1f5511d4c2f821c1c05ecb44b493eec185c0eec13b1dcd03d36e1a779

sha256sum ~/.injectived/config/genesis.json

Configure systemd Service for injectived

Edit the config at /etc/systemd/system/injectived.service:

[Unit]
  Description=injectived

[Service]
  WorkingDirectory=/usr/bin
  ExecStart=/bin/bash -c '/usr/bin/injectived --log-level=error start'
  Type=simple
  Restart=always
  RestartSec=5
  User=root

[Install]
  WantedBy=multi-user.target

Starting and restarting the systemd service

sudo systemctl daemon-reload
sudo systemctl restart injectived
sudo systemctl status injectived

# enable start on system boot
sudo systemctl enable injectived

# To check Logs
journalctl -u injectived -f

Sync with the network

Support

Hardware Specification

Node operators should deploy bare metal servers to achieve optimal performance. Additionally, validator nodes must meet the recommended hardware specifications and particularly the CPU requirements, to ensure high uptime.

Minimum

Recommendation

RAM Memory 128GB

RAM Memory 128GB

CPU 12 cores

CPU 16 cores

CPU base clock 3.7GHz

CPU base clock 4.2GHz

Storage 2TB NVMe

Storage 2TB NVMe

Network 1Gbps+

Network 1Gbps+

Install injectived and peggo

wget https://github.com/InjectiveLabs/injective-chain-releases/releases/download/v1.14.1-1740773301/linux-amd64.zip
unzip linux-amd64.zip
sudo mv peggo /usr/bin
sudo mv injectived /usr/bin
sudo mv libwasmvm.x86_64.so /usr/lib 

Initialize a New Injective Node

Before running Injective node, we need to initialize the chain as well as the node's genesis file:

# The argument <moniker> is the custom username of your node. It should be human-readable.
export MONIKER=<moniker>
# Injective Mainnet has a chain-id of "injective-1"
injectived init $MONIKER --chain-id injective-1

Running the init command will create injectived default configuration files at ~/.injectived.

Prepare Configuration to Join Mainnet

You should now update the default configuration with the Mainnet's genesis file and application config file, as well as configure your persistent peers with seed nodes.

git clone https://github.com/InjectiveLabs/mainnet-config

# copy genesis file to config directory
cp mainnet-config/10001/genesis.json ~/.injectived/config/genesis.json

# copy config file to config directory
cp mainnet-config/10001/app.toml  ~/.injectived/config/app.toml

You can also run verify the checksum of the genesis checksum - 573b89727e42b41d43156cd6605c0c8ad4a1ce16d9aad1e1604b02864015d528

sha256sum ~/.injectived/config/genesis.json

Then update the seeds field in ~/.injectived/config/config.toml with the contents of mainnet-config/10001/seeds.txt and update the timeout_commit to 300ms.

cat mainnet-config/10001/seeds.txt
nano ~/.injectived/config/config.toml

Configure systemd Service for injectived

Edit the config at /etc/systemd/system/injectived.service:

[Unit]
  Description=injectived

[Service]
  WorkingDirectory=/usr/bin
  ExecStart=/bin/bash -c '/usr/bin/injectived --log-level=error start'
  Type=simple
  Restart=always
  RestartSec=5
  User=root

[Install]
  WantedBy=multi-user.target

Starting and restarting the systemd service:

sudo systemctl daemon-reload
sudo systemctl restart injectived
sudo systemctl status injectived

# enable start on system boot
sudo systemctl enable injectived

# To check Logs
journalctl -u injectived -f

The service should be stopped before and started after the snapshot data has been loaded into the correct directory.

# to stop the node
sudo systemctl stop injectived

# to start the node
sudo systemctl start injectived

Sync with the network

Option 1. State-Sync

To be added soon

Option 2. Snapshots

Pruned

Alternatively, you can use the pruned snapshots from Injective Labs on AWS S3.

systemctl stop injectived
injectived tendermint unsafe-reset-all --home $HOME/.injectived
SNAP=$(aws s3 ls --no-sign-request s3://injective-snapshots/mainnet/pruned/ | grep ".tar.lz4" | sort | tail -n 1 | awk '{print $4}')
aws s3 cp --no-sign-request s3://injective-snapshots/mainnet/pruned/$SNAP .
lz4 -c -d $SNAP  | tar -x -C $HOME/.injectived/
rm $SNAP
systemctl start injectived

Should the Injective mainnet-config seeds.txt list not work (the node fails to sync blocks), ChainLayer, Polkachu, and Autostake maintain peer lists (can be used in the persistent_peers field in config.toml) or addressbooks (for faster peer discovery).

Archival (>20TB)

systemctl stop injectived
injectived tendermint unsafe-reset-all --home $HOME/.injectived
aws s3 sync --no-sign-request --delete s3://injective-snapshots/mainnet/injectived/data $HOME/.injectived/data
aws s3 sync --no-sign-request --delete s3://injective-snapshots/mainnet/injectived/wasm $HOME/.injectived/wasm
systemctl start injectived

In the case where the latest block does not increase and the number of connected peers is 0 or remains low, the seed list in seeds.txt may be outdated, and the seeds or persistent_peers fields can be updated using a validator's seed or peer list respectively, before the node is started again.

go install github.com/cosmos/gex@latest
gex

Support

PreviousSetting up the keyringNextCosmovisor

Last updated 2 months ago

config.toml: used to configure Tendermint (learn more on ), and

See the for the most recent releases. Non-validator node operators do not need to install peggo.

Refer to the Polkachu guide to download a snapshot and sync with the network.

For any further questions, you can always connect with the Injective Team via , , or .

See the for the most recent releases. Non-validator node operators do not need to install peggo.

.

.

.

.

.

At this point, can be used to monitor the node's sync status. If the snapshot has been correcly loaded, the number of connected peers should increase from 0 and the latest block should steadily increase, signalling the node syncing with its peers. Note that it may take a few or several hours for the node to catch up to the network's block height depending on the age of the snapshot.

For any further questions, you can always connect with the Injective Team via , , or

Tendermint's documentation
Injective releases repo
here
Discord
Telegram
email
Injective chain releases repo
Polkachu
HighStakes
AutoStake
Imperator
Bware Labs
GEX
Discord
Telegram
email