Transparent IBC
You can send assets to another IBC compliant chain, such as a Cosmos SDK chain or another Namada chain, using the
ibc-transfer
.
This section covers sending assets to and from a transparent ( tnam
) address.
Prerequisites
- An active IBC connection has been created and maintained between the two chains by operators running relayer software such as Hermes (opens in a new tab).
- You will need to know the corresponding channel id
IBC transfers from Namada to another chain
To make an outgoing IBC transfer from a Namada transparent address:
namadac ibc-transfer \
--source $SOURCE_ADDRESS \
--receiver $RECV_ADDRESS \
--token $TOKEN_ADDRESS \
--amount $AMOUNT \
--channel-id $CHANNEL_ID
Note:
- the
receiver
address is the raw address on the receiving chain -- if you are sending to another Namada chain, this would start withtnam...
, while if you're sending to a Cosmos SDK chain it might start withcosmos...
,osmo...
, or some other prefix. - the
channel-id
parameter is a string, for examplechannel-27
.
Example: Sending NAM to the Cosmos Hub
namadac ibc-transfer \
--source my-namada-wallet \
--receiver cosmos1y3q368qj8d2ged5xcdz96wtt3n5f9zq6ql0p7k \
--token nam \
--amount 10 \
--channel-id channel-42
Once the transaction has been submitted, a relayer will need to relay the packet to the other chain. This is done automatically by the relayer running Hermes. If the packet is never successfully relayed, the funds are returned to the sender after a timeout. See more information in the specs (opens in a new tab).
Transferring assets into Namada from Cosmos SDK chains
To transfer assets back from a Cosmos SDK chain, you will post an IBC transaction on that chain using its corresponding client software.
For the Cosmos Hub, you will use gaiad
(opens in a new tab). Other chains will have their own corresponding client;
however all Cosmos SDK based clients will share approximately the same commands and operation. Consult the documentation
of the counterparty chain when in doubt.
Example: Sending ATOM from the Cosmos Hub to Namada
gaiad tx ibc-transfer transfer \
transfer \
channel-64 \
tnam1qzgmrvz0zdjtgdu7yq6hl46wdg7za2t2hg5t85c7 \
10000000uatom \
--from my-cosmos-wallet \
--fees 5000uatom
The double use of 'transfer' in the above command is not a typo. The command takes an IBC port name as one of its parameters; and the name of the port happens to be 'transfer'.
Querying IBC balances
You can query an account's balance of tokens received through IBC similarly to other tokens, using the 'IBC denom' token name which is a function of the IBC port, channel, and token name (or address) on the originating chain:
IBC denom = {receiving_port}/{receiving_channel}/{token_name}
Sending the same asset through two different IBC channels will result in two different token denoms on the receiving chain, which will not be fungible with each other. This is expected behavior as defined in the IBC protocol.
Example: Balance query
If we have sent 100 NAM (token address tnam1q87wtaqqtlwkw927gaff34hgda36huk0kgry692a
) from chain A to chain B over IBC, where the port is transfer
and channel on the receiving chain
is channel-0
, we can check the balance on chain B using either of these (equivalent) commands:
namadac balance --owner $ALIAS --token transfer/channel-0/nam
# or
namadac balance --owner $ALIAS --token transfer/channel-0/tnam1q87wtaqqtlwkw927gaff34hgda36huk0kgry692a
# Output:
# transfer/channel-0/nam: 100