The NFT Standard on Casper (CEP-47)
This tutorial takes you through the standard of implementing non-fungible tokens on the Casper Network. Before diving into the Casper NFT implementation, let's cover some knowledge on overall NFT design. The following sections illustrate the origin and the development of NFTs in the blockchain domain.
The NFT Standard on Ethereum
ERC-721 is the standard defined to implement NFTs on the Ethereum blockchain. This standard defines a minimum interface a smart contract should implement to manage, own, and trade unique tokens.
The NFT Standard on Casper
CEP-47 is the NFT standard for the Casper blockchain, supporting the unique traits of the Casper Virtual Machine and its gas-efficient design.
The Casper NFT standard takes full advantage of unforgeable references to store values and manage permissions to them. It also takes advantage of other access control features (such as groups). We recommend exploring the main functions of the contract to understand the standard further.
Casper NFT (CEP-47) Functions
The CEP-47 standard contains the following functions to enable NFTs.
- name - Returns the name of the NFT contract
- symbol - Returns the symbol of the NFT contract
- meta - Returns the metadata of the NFT contract
- total_supply- Returns the amount of issued NFTs
- balance_of - Returns the amount of NFT tokens the
ownerholds - get_token_by_index - Retrieves the NFT token at a specific index
- owner_of - Retrieves the owner of a given token
- token_meta - Retrieves the metadata for a given token
- update_token_meta - A function to update the metadata of a token
- mint - Creates a list of tokens for a specific recipient, given the token IDs and their metadata, paired in order
- mint_copies - For a given address, this function creates several tokens with specific IDs but with the same metadata
- burn - Destroys the given tokens in the account given
- transfer - Transfers tokens to another account
- transfer_from - Transfer tokens from a given account to another account
- approve - Gives another account the right to transfer tokens from this account
- get_approved - Retrieves information about the rights to transfer tokens from another account
note
These functions can only be called from inside contracts, as they return data.
- name, symbol, meta, and total_supply: Return details regarding the whole contract
- balance_of and get_token_by_index: Retrieve details of tokens related to a specific account
- owner_of and token_meta: Retrieve the details of a specific token