- Local Network
- Testnet Network
- Mainnet Network
To easily set up a local node, download and run the Start the node by running:For further explanation on what the script is doing and more fine-grained control over the setup process, continue reading below.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 Modify the
At this point, a modification is required in the Now that you have created a local account, go ahead and grant it some A Configuring the Node Using
Two configuration files are automatically generated inside 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.
setup.sh script. This will initialize your local Injective network.Initialize the Chain
Before running Injective node, we need to initialize the chain as well as the node’s genesis file:~/.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:Modify the genesis.json File
At this point, a modification is required in the genesis.json file:- Change the staking
bond_denom, crisisdenom, govdenom, and mintdenomvalues to"inj", since that is the native token of Injective.
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 namedmy_validator under the test keyring backend (feel free to choose another name and another backend):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:$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 theinit 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:gentx does three things:- Registers the
validatoraccount you created as a validator operator account (i.e. the account that controls the validator). - Self-delegates the provided
amountof staking tokens. - Link the operator account with a Tendermint node pubkey that will be used for signing blocks. If no
--pubkeyflag is provided, it defaults to the local node pubkey created via theinjectived initcommand above.
gentx, use the following command:Configuring the Node Using app.toml and config.toml
Two configuration files are automatically generated inside ~/.injectived/config:config.toml: used to configure Tendermint (learn more on Tendermint’s documentation), andapp.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.
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: