Shielded IBC

You can send assets to another IBC compliant chain, such as a Cosmos SDK chain or another Namada chain, using the ibc-transfer command in namadac.

This section covers sending assets to and from a shielded ( znam ) 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 transfer to a shielded address

First, we need to generate the shielding data with the command:

namadac ibc-gen-shielding \
  --output-folder-path \
  $OUTPUT_FOLDER_PATH \
  --target \
  $RECEIVER \
  --token \
  $TOKEN \
  --amount \
  $AMOUNT \
  --port-id
  $PORT_ID \
  --channel-id \
  $CHANNEL_ID

This command will generate the shielding data in a file inside the provided directory and will output the path to this file, $SHIELDING_DATA_PATH.

After that, IBC transfers to a shielded address work similarly to those for a transparent address, the only differences being that we provide the MASP internal address as the value instead of $RECV_ADDRESS and we add a --memo arg with the path to the file we have just generated:

gaiad tx ibc-transfer transfer \
  $CHANNEL_ID \
  $MASP_ADDRESS \
  ${AMOUNT}${IBC_TOKEN_ADDRESS} \
  --from $COSMOS_ALIAS \
  --node $COSMOS_RPC_ENDPOINT \
  --fees 5000uatom \
  --memo $SHIELDING_DATA_PATH
💡

The previous command would work even with $RECEIVER_PAYMENT_ADDRESS as the second argument, but it is highly recommended to use $MASP_ADDRESS to preserve privacy.

IBC transfer from a shielded address

You can also send IBC transfers from a shielded address, by providing the associated spending key as the source:

namadac ibc-transfer \
  --source $SOURCE_SPEND_KEY \
  --receiver $RECV_ADDRESS \
  --token $TOKEN \
  --amount $AMOUNT \
  --channel-id $CHANNEL_ID \

Gas fees can be paid like all the other transactions either directly from an implicit account adding --gas-payer $IMPLICIT_ADDRESS or via the MASP. For more information please refer to the fees section.