Interchain Messages

Overview

Interchain communication facilitates the transfer of assets and information between distinct blockchain networks. This tutorial focuses on asset transfers, including tokens and NFTs, between Initia (Layer 1) and Minitia (Layer 2), using the OP bridge for token transfers and IBC (Inter-Blockchain Communication) for token and NFT transfers. We'll cover initiating token deposits, withdrawing tokens, finalizing token withdrawals, and transferring tokens and NFTs via IBC.

OP Bridge Token Transfer

Initiating a Token Deposit from Initia to Minitia

To transfer tokens from Initia to Minitia using the OP bridge, you must initiate a token deposit on the Initia blockchain. The process involves creating a transaction that locks the tokens on Initia, making them available on Minitia.

> initiad tx ophost initiate-token-deposit [bridge_id] [addr] 1000000uinit ''\
  --from [key-name] \
  --gas auto --gas-adjustment 1.5 --gas-prices 0.15uinit \
  --node [rpc-url]:[rpc-port] --chain-id [chain-id]

Withdrawing Tokens from Minitia to Initia

There is a finalization period that must be passed after the withdraw transaction has been executed before you can execute finalize-token-withdrawal.

> minitiad tx opchild withdraw [addr] [amount]\
  --from [key-name] \
  --gas auto --gas-adjustment 1.5 --gas-prices [l2_gas_price] \
  --node [rpc-url]:[rpc-port] --chain-id [chain-id]

Finalizing Token Withdrawal on Initia

Post the finalization period, you need to finalize the token withdrawal on Initia to receive the withdrawn tokens.

> initiad tx ophost finalize-token-withdrawal [path/to/withdrawal-info.json] \
  --from [key-name] \
  --gas auto --gas-adjustment 1.5 --gas-prices 0.15uinit \
  --node [rpc-url]:[rpc-port] --chain-id [chain-id]

IBC Transfer

IBC allows the transfer of tokens and NFTs between different blockchains that support the IBC protocol.

Transferring Tokens via IBC

> initiad tx ibc-transfer transfer \
  transfer [src-channel] [addr] 1000000uinit \
  --from [key-name] \
  --gas auto --gas-adjustment 1.5 --gas-prices 0.15uinit \
  --node [rpc-url]:[rpc-port] --chain-id [chain-id]

Transferring NFTs via IBC

> initiad tx ibc-nft-transfer nft-transfer \
  nft-transfer [src-channel] [receiver] [class-id] [token-id],...[token-id] \
  --from [key-name] \
  --gas auto --gas-adjustment 1.5 --gas-prices 0.15uinit \
  --node [rpc-url]:[rpc-port] --chain-id [chain-id]

Last updated

Logo

© 2024 Initia Foundation, All rights reserved.