Non-fungible tokens
This lesson focuses on Non-Fungible Tokens (NFTs) and their unique properties in proving digital asset ownership.
Non-fungible tokens, or NFTs, offer a unique way to prove digital asset ownership. While traditional fungible tokens are interchangeable and store a value, NFTs carry cryptographic certificates that demonstrate the owner's authority over an asset, like digital art or gaming assets.
The main functions of the contract of such tokens are similar to fungible tokens:
transfer(to, token_id)
- Use thetransfer
function to send a token (token_id
) to the designated recipient (to
) without requiring a sender account since each token has its owner.approve(approved_account, token_id)
- Utilize theapprove
function to grant disposal rights of a token (token_id
) to a specified account (approved_account
). This is particularly useful in marketplaces or auctions, where owners can sell their tokens by transferring ownership to a new buyer.mint(to, token_id, metadata)
- Generate a new token using themint
function, specifying the recipient (to
), token identifier (token_id
), and associated metadata. Metadata can encompass various details about the token, such as resource links or descriptions.burn(from, token_id)
- Remove a token (token_id
) from the contract by invoking theburn
function with the account (from
) holding the token.