ERC-721 is a standard for creating Non-Fungible Tokens (NFTs) on the Ethereum blockchain. It defines how unique digital assets can be owned and transferred.
Click to reveal answer
beginner
What makes ERC-721 tokens different from ERC-20 tokens?
ERC-721 tokens are unique and non-fungible, meaning each token is different and cannot be exchanged one-to-one. ERC-20 tokens are fungible and identical to each other.
Click to reveal answer
intermediate
Name two key functions defined in the ERC-721 standard.
Two key functions are ownerOf(tokenId) which returns the owner of a specific token, and transferFrom(from, to, tokenId) which transfers ownership of a token.
Click to reveal answer
intermediate
What is the purpose of the tokenURI function in ERC-721?
tokenURI(tokenId) returns a URL pointing to metadata about the token, such as images or descriptions, helping wallets and apps display the NFT properly.
Click to reveal answer
intermediate
Why is the Approval event important in ERC-721?
The Approval event signals that the owner has allowed another address to manage a specific token, enabling marketplaces or other contracts to transfer tokens on behalf of the owner.
Click to reveal answer
Which of the following best describes an ERC-721 token?
AA decentralized exchange protocol
BA fungible token like a cryptocurrency
CA smart contract programming language
DA unique digital asset on Ethereum
✗ Incorrect
ERC-721 tokens represent unique digital assets, unlike fungible tokens.
What does the ownerOf(tokenId) function return?
AThe metadata URL of the token
BThe owner address of the token with the given ID
CThe total supply of tokens
DThe balance of tokens owned by an address
✗ Incorrect
ownerOf returns the address that owns a specific token.
Which event is emitted when a token is transferred in ERC-721?
AApproval
BMint
CTransfer
DBurn
✗ Incorrect
The Transfer event is emitted whenever a token changes ownership.
What is the main purpose of the tokenURI function?
ATo provide metadata about the token
BTo transfer the token
CTo approve another address
DTo check token balance
✗ Incorrect
tokenURI returns a link to the token's metadata like images or descriptions.
Which of these is NOT a feature of ERC-721 tokens?
ATokens are interchangeable one-to-one
BEach token is unique
CSupports ownership transfer
DIncludes metadata support
✗ Incorrect
ERC-721 tokens are non-fungible, so they are not interchangeable one-to-one.
Explain what ERC-721 tokens are and how they differ from ERC-20 tokens.
Think about how each token is special or identical.
You got /4 concepts.
Describe the role of the transferFrom function and the Approval event in ERC-721.
Consider how tokens move and how others get permission.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of the ERC-721 standard in blockchain?
easy
A. To define a standard for unique non-fungible tokens (NFTs)
B. To create fungible tokens like cryptocurrencies
C. To manage smart contract deployment
D. To encrypt blockchain transactions
Solution
Step 1: Understand ERC-721's role
ERC-721 is designed specifically for unique tokens, called NFTs, which are different from fungible tokens like cryptocurrencies.
Step 2: Compare with other token standards
ERC-20 is for fungible tokens, while ERC-721 is for unique, non-fungible tokens.
Final Answer:
To define a standard for unique non-fungible tokens (NFTs) -> Option A
Quick Check:
ERC-721 = Unique NFTs [OK]
Hint: ERC-721 is for unique tokens, not fungible ones [OK]
Common Mistakes:
Confusing ERC-721 with ERC-20 fungible tokens
Thinking ERC-721 manages encryption
Assuming ERC-721 handles contract deployment
2. Which of the following is the correct function signature to get the owner of an NFT in ERC-721?
easy
A. function getOwner(address token) public returns (uint256);
B. function ownerOf(uint256 tokenId) external view returns (address);
C. function owner(uint256 id) external returns (address);
D. function tokenOwner(uint256 tokenId) public view returns (string);
Solution
Step 1: Recall ERC-721 standard function names
The standard defines ownerOf with a uint256 tokenId parameter returning an address.
Step 2: Check function visibility and return type
The function is external view and returns an address, matching function ownerOf(uint256 tokenId) external view returns (address); exactly.
Final Answer:
function ownerOf(uint256 tokenId) external view returns (address); -> Option B
Quick Check:
ownerOf(tokenId) returns owner address [OK]
Hint: Look for 'ownerOf' with tokenId returning address [OK]
Common Mistakes:
Using wrong function names like getOwner or tokenOwner
Incorrect return types like string instead of address
Missing view or external keywords
3. Given the following Solidity snippet, what will be the output of ownerOf(1) if token 1 is owned by address 0xABC...?
contract MyNFT is ERC721 {
mapping(uint256 => address) private _owners;
function ownerOf(uint256 tokenId) public view override returns (address) {
return _owners[tokenId];
}
function mint(address to, uint256 tokenId) public {
_owners[tokenId] = to;
}
}
medium
A. 0x0000000000000000000000000000000000000000
B. Compilation error
C. 0xABC...
D. Function does not return anything
Solution
Step 1: Understand the mint function effect
The mint function sets the owner of tokenId to the given address in the _owners mapping.
Step 2: Check ownerOf return value
The ownerOf function returns the address stored in _owners[tokenId]. If token 1 was minted to 0xABC..., it returns that address.
Final Answer:
0xABC... -> Option C
Quick Check:
ownerOf(1) = minted owner address [OK]
Hint: ownerOf returns stored owner address from mapping [OK]
Common Mistakes:
Assuming default zero address if not minted
Thinking function has no return
Confusing compilation errors with runtime behavior
4. Identify the error in this ERC-721 transfer function snippet:
function transferFrom(address from, address to, uint256 tokenId) public override {
require(ownerOf(tokenId) == msg.sender, "Not owner");
_owners[tokenId] = to;
}
medium
A. The require should check if msg.sender is approved or owner, not just owner
B. The function should not override transferFrom
C. The _owners mapping should not be updated
D. The function is missing a return statement
Solution
Step 1: Check transferFrom permission logic
ERC-721 requires that the caller is either the owner or approved to transfer the token, not just the owner.
Step 2: Identify missing approval check
The code only checks if msg.sender is the owner, missing approval checks, which can block valid transfers.
Final Answer:
The require should check if msg.sender is approved or owner, not just owner -> Option A
Quick Check:
transferFrom needs owner or approved check [OK]
Hint: Check both owner and approved in transferFrom require [OK]
Common Mistakes:
Only checking owner without approval
Forgetting to override transferFrom
Not updating ownership mapping
5. You want to create an NFT contract that allows only the original minter to burn their token. Which ERC-721 function should you override and what check should you add?
hard
A. Override mint and check if msg.sender is approved
B. Override transferFrom and check if msg.sender is the owner
C. Override approve and check if msg.sender is the contract owner
D. Override _burn and check if msg.sender is the original minter
Solution
Step 1: Identify burn function in ERC-721
The _burn internal function handles token destruction in ERC-721 contracts.
Step 2: Add ownership check for burning
To restrict burning to original minters, override _burn and add a check that msg.sender matches the original minter address stored during minting.
Final Answer:
Override _burn and check if msg.sender is the original minter -> Option D
Quick Check:
Burn control = override _burn + minter check [OK]
Hint: Control burn by overriding _burn with minter check [OK]
Common Mistakes:
Trying to control burn in transferFrom or approve
Not storing original minter address
Checking approval instead of minter for burn
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.