Related smart contracts
Standardized NFTs on TON are implemented using a set of smart contracts, including:- NFT collection smart contract
- NFT item smart contract
NFT collection
The collection is the source of truth for items. It should provide each NFT item’s address, its own collection metadata, and, given an index and individual item metadata, can provide full item metadata.NFT item
Following TON’s contract sharding approach, each NFT item is its own smart contract account. It provides the collection address, index, current owner, and individual metadata. On a valid transfer from the current owner, it updates the owner, optionally notifies the new owner, and returns excess Toncoin to the specified address.Transfer NFT item
The current owner sends a transfer message to the NFT item contract. The item updates its owner field and, optionally, sends a notification and/or excess Toncoin to the specified addresses. Transfer message body contains the following data:TL-B
ownership_assigned) contains the following data:
TL-B
excesses) contains the following data:
TL-B
- The inbound message is not from the current owner.
- There are not enough coins (considering storage fee guidelines) to process the operation and send
forward_amount.
Get static data
Anyone can send aget_static_data message to an NFT item to request its static data (index and collection address). The item responds with report_static_data message using send mode 64 (return message amount except gas fees).
Get static data message body contains the following data:
TL-B
TL-B
Best practices
- Metadata referenced by each link should be permanent. If you need to change it, send a transaction that updates the reference.
- Be mindful of TON’s asynchronous nature: on‑chain “current owner” reads may become stale by the time you act on them.