Setting up Cross Chain Connection using IBC Bridge

Setting up Cross Chain Connection using IBC Bridge

Follow these steps to establish a cross-chain connection between using the IBC Bridge:

Step 1: Ensure Kurtosis Engine is Running

Before proceeding, 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 Two Chains with IBC Bridge

For ICON to Archway

To start an IBC relay connection between ICON and Archway nodes, execute the following command:

dive bridge ibc --chainA icon --chainB archway

For ICON to Neutron

Similarly, you can establish an IBC relay connection between ICON and Neutron nodes using this command:

dive bridge ibc --chainA icon --chainB neutron

For Neutron to Archway

To create an IBC relay connection between Neutron and Archway nodes, run the following command:

dive bridge ibc --chainA neutron --chainB archway

For Archway to Neutron

Conversely, you can initiate an IBC relay connection between Archway and Neutron nodes with this command:

dive bridge ibc --chainA archway --chainB neutron

Executing the above commands will generate a 'dive.json' file in your working directory, which contains service details for the 'ICON' and 'Archway' chains.

dive.json

{
	"bridge": "false",
	"chains": {
		"eth": {
			"block_number": "30",
			"endpoint": "http://172.16.0.6:8545",
			"endpoint_public": "http://172.16.0.3:8544",
			"keypassword": "password",
			"keystores/eth_keystore.json",
			"network": "0x301824.eth",
			"network_name": "eth",
			"nid": "0x301824",
			"service_name": "el-1-geth-lighthouse"
		},
		"icon": {
			"block_number": "242",
			"endpoint": "http://172.16.0.2:9080/api/v3/icon_dex",
			"endpoint_public": "http://127.0.0.1:8090/api/v3/icon_dex",
			"keypassword": "gochain",
			"keystore_path": "keystores/keystore.json",
			"network": "0x3.icon",
			"networkId": "0x1",
			"networkTypeId": "0x1",
			"network_name": "icon-0",
			"nid": "0x3",
			"service_name": "icon-node-0"
		}
	},
	"contracts": {
		"eth": {
			"bmc": "0xB9D7a3554F221B34f49d7d3C61375E603aFb699e",
			"bmcm": "0xAb2A01BC351770D09611Ac80f1DE076D56E0487d",
			"bmcs": "0xBFF5cD0aA560e1d1C6B1E2C347860aDAe1bd8235",
			"bmv": "0x765E6b67C589A4b40184AEd9D9ae7ba40E32F8d4",
			"dapp": "0x9bE03fF3E1888A216f9e48c68B587A89c5b94CD6",
			"xcall": "0x5911A6541729C227fAda7D5187ee7518B47fB237"
		},
		"icon": {
			"bmc": "cx14303a14cbfd58b9bcd61b62b786b387f39be25a",
			"bmv": "cx71337318cf13aa3fd805c75a38f4d5f800cd627c",
			"dapp": "cx90bc909409ff8ba200b5a866e1bb952c39fa1f4a",
			"xcall": "cx5dce8a39a49faadee03a02e6b33173aef91d4e67"
		}
	},
	"links": {
		"dst": "eth",
		"src": "icon"
	}
}

The above commands automate several essential tasks to configure and initialize the local environment:

  • Spinning up Nodes: DIVE automatically starts and configures the required nodes for your local environment.

  • Installing Required npm Dependencies: DIVE takes care of installing all the necessary npm dependencies for seamless operation.

  • Enabling IBC Block on ICON Local Network: DIVE facilitates IBC block functionality on the ICON local network by registering the node as a P-Rep and decentralizing the network.

  • Deploying Contracts for IBC: DIVE automatically builds and deploys essential smart contracts (ibc_core, light_client, xCall_ibc_connection, xCall & sample dApp) for IBC functionality on both the chains.

  • Starting the Relay: The relay image is built and launched, actively monitoring both chains to enable smooth message transfer between them.

💡

Note: Currently, DIVE supports IBC relay setup between ICON, Archway, and Neutron nodes.

Starting IBC Between Already Running Nodes

Starting IBC between already running nodes gives you more control, as you can start the individual nodes with custom configurations and then initiate the relay between them.

For ICON to Archway

To set up IBC relay connections between already running ICON and Archway nodes, use the following command:

dive bridge ibc --chainA icon --chainB archway --chainAServiceName <service name of ICON> --chainBServiceName <service name of Archway>

For ICON to Neutron

Similarly, you can start IBC relay connections between already running ICON and Neutron nodes using the following command:

dive bridge ibc --chainA icon --chainB neutron --chainAServiceName <service name of ICON> --chainBServiceName <service name of Neutron>

For Neutron to Archway

To establish an IBC relay connection between already running Neutron and Archway nodes, use the following command:

dive bridge ibc --chainA neutron --chainB archway --chainAServiceName <service name of Neutron> --chainBServiceName <service name of Archway>

For Archway to Neutron

Conversely, you can initiate an IBC relay connection between already running Archway and Neutron nodes with this command:

dive bridge ibc --chainA archway --chainB neutron --chainAServiceName <service name of Archway> --chainBServiceName <service name of Neutron>
💡

Note: Service names can be found in the services.json file, which is generated while setting up nodes individually.

Step 3: Setup is completed

Once the process is completed, your local environment with the chains connected via the IBC bridge will be ready for testing and development. DIVE CLI simplifies the entire setup, allowing you to focus on developing and testing your decentralized applications with ease. Happy developing!