Shielding Assets

You can shield assets in the MASP by making a transfer from a transparent address to a shielded address. This is known as a shielding transfer.

Assets can also be sent directly to a shielded address through IBC -- see the section on Shielded IBC for details.

Making a shielding transfer

To conduct a shielding transfer, the user must first be in possession of a transparent account with some token balance.

Generate a spending key

See Shielded Key Management for details on how to do this.

Derive a new shielded address (aka: payment address)

You can (and should) derive multiple shielded addresses for the same spending key.

(If needed) submit reveal-pk transaction for sending address

You can shield from either an implicit or established account. If shielding from an implicit account, your account's public key must first be revealed on-chain. This only needs to be done once per account:

namadac reveal-pk --public-key $IMPLICIT_ACCOUNT_ALIAS

Send your shielding transfer

Use the shield command to make a shielding transfer from a source transparent (tnam) address to a target shielded (znam) address:

namadac shield \
  --source $TRANSPARENT_ACCOUNT \
  --target $PAYMENT_ADDRESS \
  --token $TOKEN \
  --amount $AMOUNT
💡

Note: Shielding assets, even using IBC, is an optimistic operation. This means that the shielded wallet will assume that the transaction succeeded and store the state changes. When this happens, the shielded wallet is said to be in a speculative state. This occurs even if the transaction ultimately fails.

To move out of a speculative state, run shielded sync. This is especially important if a shielding transaction failed as the shielded wallet's view of the MASP pool has now diverged from the MASP pool on the chain.

Viewing your balance

To view the up-to-date balance of your spending key (or viewing key), you must first run the shielded-sync command to sync the local shielded wallet with any MASP notes owned by your spending/viewing key. See how to do this here.

After the sync has completed, check your balance with:

namadac balance --owner $SPENDING_KEY --token $TOKEN

(A viewing key can also be provided here instead of $SPENDING_KEY)

This will display the combined balance of all shielded addresses associated with that spending/viewing key.