Token Standards and NFTs Flashcards
6 cards from real Blockchain Technology practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Token Standards and NFTs flashcards as text
A blockchain game developer needs to create multiple types of in-game assets. Some assets, like health potions, are fungible and stackable. Other assets, like a unique legendary sword, are non-fungible. To optimize transaction costs and contract management, which token standard should the developer use?
Answer: ERC-1155, which allows for the creation of fungible, non-fungible, and semi-fungible tokens within a single smart contract.
The ERC-1155 multi-token standard is specifically designed for this use case. It allows a single smart contract to manage an infinite number of both fungible and non-fungible tokens. This is highly efficient for applications like games, as it enables batch transfers of different token types in a single transaction, significantly reducing gas costs compared to managing separate ERC-20 and ERC-721 contracts.
What is the primary characteristic that defines a token as 'non-fungible'?
Answer: It possesses a unique identifier (Token ID) and associated metadata that distinguish it from all other tokens.
Non-fungibility stems from uniqueness. Each NFT has a unique token ID within its smart contract that makes it distinct and not interchangeable with any other token, even from the same collection. This unique identifier is linked to specific metadata that describes the asset it represents. Divisibility and fixed supply are characteristics of fungible tokens (like ERC-20), and while an NFT can be linked to a physical asset, this is not its defining technical trait.
A developer is creating an NFT collection where the visual art and attributes for each token are stored off-chain to save on gas costs. Which is the most common and decentralized method for linking the on-chain token to its off-chain metadata?
Answer: Storing the metadata on a decentralized storage network like IPFS and linking to its Content Identifier (CID) in the token's URI.
Storing metadata on a decentralized network like the InterPlanetary File System (IPFS) is the standard best practice. The smart contract stores an immutable link (e.g., `ipfs://`) pointing to the metadata file. This approach prevents issues like broken links or censorship that can occur with centralized servers, while being far more cost-effective than storing large files directly on the main blockchain.
Which of the following functions is a mandatory part of the ERC-20 standard and is critical for enabling smart contracts (like decentralized exchanges) to transfer tokens on a user's behalf?
Answer: approve
The `approve` function is one of the six mandatory functions in the ERC-20 standard. It allows a token owner to grant another address (typically a smart contract) permission to withdraw a specified number of tokens from their account. This is fundamental for the operation of decentralized exchanges and other DeFi protocols that need to move user funds programmatically via the `transferFrom` function.
A developer is using the standard ERC-721 token for an NFT project but finds it difficult to get a simple list of all tokens owned by a specific address directly from the smart contract. Which optional EIP-721 extension should be implemented to solve this problem efficiently?
Answer: ERC721Enumerable
The standard ERC-721 interface does not include a function to list all tokens an owner holds. The ERC721Enumerable extension adds this functionality by including on-chain data structures to track ownership. It provides functions like `tokenOfOwnerByIndex(owner, index)` which allows dApps and marketplaces to easily discover and display all the NFTs owned by a particular address.
A project is issuing concert tickets as tokens on the blockchain. Before the event, any ticket for a specific seating section is interchangeable with another. However, after the event, each ticket becomes a unique, non-fungible collectible. Which token standard best represents this 'fungible-then-non-fungible' lifecycle?
Answer: ERC-1155, which is designed to support semi-fungible tokens.
This scenario perfectly describes a semi-fungible token (SFT). The ERC-1155 standard was designed to handle this exact use case. It allows tokens to be created that are fungible (interchangeable with others of the same ID) and can later become non-fungible (unique) after a specific event, like being redeemed or used. This is far more efficient than managing separate contracts or complex off-chain logic.