Skip to main content

Transfer an NFT

Transfer Without Storage Deposit Return

When an NFT is sold via a marketplace, it is the platform that decides how to handle the storage deposit, whether the buying price accounts for it or the owner should be refunded by the recipient via a Storage Deposit Return Unlock Condition.

Example Transaction

Transaction B sends the newly issued NFT Output #1 to the recipient:

  • Since it has just been minted in Transaction A, The NFT ID is all zeros in NFT Output #1. While the value of the field (explicit NFT ID) is all zeroes, based on the protocol rules we know that the implicit NFT ID can be calculated from the Output ID of NFT Output #1.
  • When the minted NFT is transferred for the first time, the NFT ID must be set as the implicit NFT ID of the mint output. Therefore, NFT Output #2 sets the value of the NFT ID field as the blake2b-256 hash of NFT Output #1 ID. If you miss this step and leave it as all zeroes, the protocol interprets the transaction as the burning of the minted NFT and the creation of a new NFT.
  • Notice that the immutable features are not allowed to change. Their values are carried together with the NFT until it is burned.
  • To change ownership of the NFT, unlock the address of the Address Unlock Condition (owner) in the transaction and set a new owner (recipient) on the output side.
  • Without further unlock conditions, the owner loses the 100i storage deposit which is now controlled by recipient.

Transaction B - Transferring NFT

Why Can't the NFT ID be Set Directly Upon Minting?

It was shown in Transaction A that NFT ID must be zeroed out on minting, and via Transaction B that it has to be set to the protocol generated value in the first transfer. The reason for this is the chicken and egg situation rooted in how unique values are generated on protocol level:

A unique NFT ID is computed from Output ID, that is computed from the minting transaction content. The transaction content contains the value of the NFT ID field of the output. On minting, the NFT ID is set to zero to signal the minting operation. As soon as the transaction is prepared (you don't even need to submit it yet) the Output ID is known. Therefore, NFT ID can be computed locally, but it is not possible to place it inside the minting output, as that would alter the transaction content, and therefore the Output ID and the NFT ID itself.

Transfer an NFT With Storage Deposit Return

If you want the original owner to get the storage deposit back, you will need to add the Storage Deposit Return Unlock Condition, and since the deposit won't be returned until the NFT is claimed, you may also want to add the Expiration Unlock Condition.

Example Transaction

Transaction C shows a conditional transfer of an NFT. By defining a Storage Deposit Return Unlock Condition and an Expiration Unlock Condition, the recipient has to claim the NFT transfer in a transaction that:

  • Refunds the storage deposit to the owner address,
  • within the timeframe specified in the expiration condition.

If the recipient fails to claim the transfer in time, the ownership of NFT Output #3 falls back to the owner address defined in the Expiration Unlock Condition. An expired output can be unlocked by this address without having to fulfill the Storage Deposit Return Unlock Condition.

Transaction C defines that recipient has to claim the output in a transaction such that:

  • owner is refunded with 100i via a Basic Output,
  • the claiming transaction may only be carried out until May 24 2022 18:00:00.

Transaction C - Transferring NFT with storage deposit return