Boot an Initia Node

Initia basic setup

The HOME directory used in this section is the default value ~/.initia. To set a different directory, add --home <YOUR_INITIA_HOME> option on each command and use a different directory as Initia's HOME directory.

Initialization

Use the command below to initialize the Initia Node.

initiad init <moniker>

A moniker is a human-readable name for your node. Moniker can contain only ASCII characters, and cannot exceed 70 characters.

Your private key is generated during the initialization, and is saved in ~/.initia/config/priv_validator_key.json.

Remember to backup your private key if you are running a validator node. If a private key is lost, node may never be recoverable from a hardware failure. Plan your back up through running a Testnet node, and secure your private key safely for the mainnet.

Set Minimum Gas Prices

Open ~/.initia/config/app.toml on an editor and modify minimum-gas-prices to set the minimum gas price accepted by the validator to process a transaction and prevent spamming. Multiple fees can be modified by using comma (,) between each fee types.

The below is an example:

# setting minimum-gas-prices = "0.15uinit,0.01uusdc"
sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"0.15uinit,0.01uusdc\"|" $HOME/.initia/config/app.toml

Setting Endpoints

Initia supports the below endpoints for external communications.

Validator nodes are not recommended to open any of these endpoints.

  • LCD: RESTful API

  • GRPC/GRPC-WEB: GRPC API

  • RPC: Tendermint/CometBFT provided API

  • P2P: Gossip P2P with other Initia nodes

You can modify the below config values to turn on/off each Endpoint and change ports.

Type
Config file name
Item

LCD

~/.initia/config/app.toml

api.enable: Enable / disable LCD api.swagger: Enable / disable swagger api.address: Listen address for LCD

GRPC/RPC-WEB

~/.initia/config/app.toml

grpc.enable: Enable / disable GRPC grpc.address: Listen address for GRPC grpc-web.enable: Enable / disable GRPC-WEB grpc-web.address: Listen address for GRPC-WEB

RPC

~/.initia/config/config.toml

rpc.laddr: Listen address for RPC

P2P

~/.initia/config/config.toml

p2p.laddr: Listen address for P2P

The below is a config example which enables all endpoints and listens to 0.0.0.0 as a default port. Modify your config accordingly.

~/.initia/config/app.toml

# ...

###############################################################################
###                           API Configuration                             ###
###############################################################################

[api]

# Enable defines if the API server should be enabled.
enable = true

# Swagger defines if swagger documentation should automatically be registered.
swagger = true

# Address defines the API server to listen on.
address = "tcp://0.0.0.0:1317"

# ...


###############################################################################
###                           gRPC Configuration                            ###
###############################################################################

[grpc]

# Enable defines if the gRPC server should be enabled.
enable = true

# Address defines the gRPC server address to bind to.
address = "0.0.0.0:9090"

# ...

###############################################################################
###                        gRPC Web Configuration                           ###
###############################################################################

[grpc-web]

# GRPCWebEnable defines if the gRPC-web should be enabled.
# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op.
enable = true

# Address defines the gRPC-web server address to bind to.
address = "0.0.0.0:9091"

# ...

~/.initia/config/config.toml

# ...

#######################################################
###       RPC Server Configuration Options          ###
#######################################################
[rpc]

# TCP or UNIX socket address for the RPC server to listen on
laddr = "tcp://0.0.0.0:26657"

# ...

#######################################################
###           P2P Configuration Options             ###
#######################################################
[p2p]

# Address to listen for incoming connections
laddr = "tcp://0.0.0.0:26656"

# ...

Set up External Address

To allow access from external nodes to your node through P2P network, config.toml has to be modified. By entering public IP/Port to p2p.external_address field, the network settings will allow external nodes to access your node.

The below is an example, and the values can be modified through sed, jq, and curl command lines.

#######################################################
###           P2P Configuration Options             ###
#######################################################
[p2p]

# Address to listen for incoming connections
laddr = "tcp://0.0.0.0:26656"

# Address to advertise to peers for them to dial
# If empty, will use the same port as the laddr,
# and will introspect on the listener or use UPnP
# to figure out the address. ip and port are required
# example: 159.89.10.97:26656
external_address = "159.89.10.97:26656"

Below command line requires sed, curl and jq to be installed, and sets all ports to the default value: 26656.

#!/usr/bash

sed -i -e 's/external_address = \"\"/external_address = \"'$(curl httpbin.org/ip | jq -r .origin)':26656\"/g' ~/.initia/config/config.toml

Set Up Oracle

To start oracle feeding from your validator node, app.toml has to be modified. By entering sidecar oracle process address, validator will start feeding the oracle prices.

######################################
###             Oracle             ###
######################################

[oracle]

# Enabled specifies whether the side-car oracle needs to be run.
enabled = true

# Production specifies whether the oracle is running in production mode. This is used to
# determine whether the oracle should be run in debug mode or not.
production = true

# RemoteAddress is the address of the remote oracle server (if it is running out-of-process)
remote_address = "127.0.0.1:8080"

# ClientTimeout is the time that the client is willing to wait for responses from the oracle before timing out.
client_timeout = "500ms"

To start the sidecar oracle process, please refer to this section.

Run Initia

All local settings are completed. But to run initiad as a blockchain node, the node has to fetch genesis block information and be set to communicate with other nodes. Refer to Connect to Initia Network section for more information.

The below section is optional, but contains information on how to register the Initia daemon to the service to make it easier to run and manage. Note that this can help you run smoothly.

Registering Initia as a Service

Easily run and manage Initia by registering it as a Linux Service. The below example uses initiad as a service name.

  1. Open /etc/systemd/system/initiad.service as root permission and enter the below information:

    • Modify the Service section to match your env settings before saving

      • User: Account name to run initiad (Below example: ubuntu)

      • ExecStart: Directory where initiad is installed + start (Below example: /user/bin initiad start)

[Unit]
Description=initiad

[Service]
Type=simple
User=ubuntu
ExecStart=/usr/bin/initiad start
Restart=on-abort
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=initiad
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
  1. Run the below command line to activate initiad service. root permission might be required.

systemctl enable initiad
  1. The below command line can be used to start or stop Initia service. root permission might be required.

    • Start: systemctl start initiad

    • Stop: systemctl stop initiad

  2. To apply the changes to /etc/systemd/system/initiad.service, run the below command line. This might require root permission, and to apply changes to a running node, a restart is required.

systemctl daemon-reload
systemctl restart initiad
  1. All logs from initiad resulting from step 1 are recorded on syslog. Use the below commands to check initiad's logs.

journalctl -t initiad    # Shows the current logs and ends. Can be used with the below options
journalctl -t initiad -f # Tracks and shows the most recent logs.
journalctl -t initiad -n <number> # Shows the recent log at line <number>

Last updated

Logo

© 2024 Initia Foundation, All rights reserved.