Setting up an ICON Node

In this guide, you'll learn how to set up an ICON node using DIVE CLI. This process enables you to interact with the ICON blockchain on your local environment. Follow these steps to get started:

Step 1: Ensure Kurtosis Engine is Running

Before you proceed, ensure that the Kurtosis Engine is running in the background. If it's not already running, start it with the following command:

kurtosis engine start

Step 2: Start ICON Chain

To start a single ICON node, execute the following command:

dive chain icon

Executing the above command will generate a 'services.json' file in the working directory, which contains service details for the 'icon' chain.

services.json

{
  "service_name": "icon-node-0",
  "endpoint_public": "http://127.0.0.1:8090/api/v3/icon_dex",
  "endpoint": "http://172.16.0.3:9080/api/v3/icon_dex",
  "keypassword": "gochain",
  "keystore_path": "keystores/keystore.json",
  "network": "0x3.icon",
  "network_name": "icon-0",
  "nid": "0x3"
}
  • service_name: The name of the service.
  • endpoint_public: The public endpoint URL for interacting with the service.
  • keypassword: The password used for accessing the service's keystore.
  • keystore_path: The file path for the service's keystore.
  • network: The network ID.
  • network_name: The name of the network.
  • nid: The unique identifier for the network.

Step 3: Setup is Completed

After running the command, DIVE CLI will automatically start the ICON node and handle the necessary initialization processes. Please wait for the ICON node to fully initialize; this might take a few moments.

Once the initialization is complete, you're ready to interact with the local ICON chain. DIVE CLI sets up the ICON node on your local environment, allowing you to deploy and test smart contracts, explore transactions, and experiment with various ICON blockchain features.

Additional Settings for ICON Chain

Running a Single ICON Chain with Custom Settings

DIVE CLI allows you to start a single ICON chain with custom configurations, including your own genesis file, config file, and a custom chain ID. Follow these steps to run an ICON chain with your desired settings:

To start the ICON chain with custom configurations, use the following command:

dive chain icon --config 'path to config.json' --genesis 'path to genesis file'

Parameters Explanation:

  • --config: Specify the path to your custom configuration file (config.json) using the --config flag. This file will include various network settings for the ICON chain.

Example of config

{
  "id": "0",
  "private_port": 9080,
  "public_port": 8090,
  "p2p_listen_address": "7080",
  "p2p_address": "8080",
  "cid": "0xacbc4e"
}
  • --genesis: Provide the path to your custom genesis file using the --genesis flag. The genesis file contains the initial state and configurations for the ICON blockchain.
💡

Tip: If you want to start your ICON chain for BTP support, you can also decentralize it by adding the --decentralisation flag.

Decentralize an Already Running ICON Chain for BTP Support

DIVE CLI provides the capability to decentralize an already running ICON chain, preparing it for BTP (Blockchain Transfer Protocol) support. Follow these steps to decentralize your existing ICON chain using DIVE CLI:

To decentralize your existing ICON chain for BTP support, use the following command:

dive chain icon decentralize --keyPassword 'keypassword' --keystorePath 'path to keystore file' --nid 'network ID' --nodeEndpoint 'Endpoint address' --serviceName 'container name'

Parameters Explanation:

  • --keyPassword: Provide the password for your keystore file using the --keyPassword flag. This password is used to unlock the keystore file during the decentralization process.
  • --keystorePath: Specify the path to your keystore file using the --keystorePath flag. The keystore file contains the private key required for decentralization.
  • --nid: Assign the network ID (NID) of your ICON chain using the --nid flag. The NID uniquely identifies your ICON network.
  • --nodeEndpoint: Provide the endpoint address of your already running ICON node using the --nodeEndpoint flag. This endpoint allows DIVE CLI to interact with the existing ICON node.
  • --serviceName: Assign a custom container name for the decentralized ICON node using the --serviceName flag. This name will be used to identify the container during the decentralization process.

Wait for Decentralization:

After executing the command, DIVE CLI will initiate the decentralization process for your existing ICON chain. Please be patient as this process may take some time, depending on the size of your blockchain and network.

Ready to dive into ICON blockchain exploration and innovation? Let's get started!