NFT Art NFT Minting and Smart Contracts 3 — Questions and Answers
Question 1: What is 'gas' in the context of minting an NFT on Ethereum?
- The file format used for NFT images
- A fee paid to miners/validators to process and confirm transactions (Correct answer)
- The speed at which an NFT is transferred
- The carbon offset required for minting
Correct answer: A fee paid to miners/validators to process and confirm transactions
Gas is the unit measuring computational work on Ethereum, and users pay gas fees in ETH to compensate validators for processing transactions.
Question 2: An artist discovers their NFT collection smart contract has a reentrancy vulnerability. What does this mean?
- Users can re-enter the same artwork in multiple galleries
- An attacker can repeatedly call a function before the first execution completes, draining funds (Correct answer)
- The contract allows duplicate token IDs
- Metadata can be updated without owner permission
Correct answer: An attacker can repeatedly call a function before the first execution completes, draining funds
Reentrancy attacks exploit contracts that send ETH before updating state, allowing attackers to recursively call back into the function.
Question 3: What is the difference between a 'mint' function and a 'safeMint' function in ERC-721?
- safeMint costs less gas
- safeMint checks that the recipient can handle ERC-721 tokens if it's a contract address (Correct answer)
- safeMint adds royalty information automatically
- There is no practical difference
Correct answer: safeMint checks that the recipient can handle ERC-721 tokens if it's a contract address
safeMint calls onERC721Received on contract recipients to verify they can handle NFTs, preventing tokens from being locked in incompatible contracts.
Question 4: Which of the following best describes a 'smart contract ABI' when interacting with an NFT contract?
- The artwork's resolution and file format
- An interface definition describing the contract's functions and data structures (Correct answer)
- The contract's deployment address on the blockchain
- The gas limit for minting transactions
Correct answer: An interface definition describing the contract's functions and data structures
The ABI (Application Binary Interface) defines how to encode and decode calls to a contract's functions, acting as the interface between applications and the contract.
Question 5: A generative art NFT project uses a random number to assign traits at mint time. Why is using block.timestamp as randomness dangerous?
- It makes the contract too slow
- Miners can manipulate block timestamps to influence trait outcomes (Correct answer)
- It creates duplicate token IDs
- It makes the contract non-upgradeable
Correct answer: Miners can manipulate block timestamps to influence trait outcomes
Block timestamps can be slightly manipulated by miners, allowing them to choose favorable timestamps that produce rare traits for themselves.
Question 6: What does 'provenance' mean in the context of an NFT art smart contract?
- The physical location where the artwork was created
- A verifiable record of the artwork's origin and ownership history on-chain (Correct answer)
- The file format and resolution of the artwork
- The artist's social media verification
Correct answer: A verifiable record of the artwork's origin and ownership history on-chain
On-chain provenance creates an immutable, verifiable history of an NFT's creation and all subsequent ownership transfers.
Question 7: What is the purpose of the 'totalSupply' function commonly found in NFT contracts?
- To show the total ETH collected from sales
- To return the total number of tokens that have been minted (Correct answer)
- To display the maximum number of tokens allowed
- To calculate the average sale price
Correct answer: To return the total number of tokens that have been minted
The totalSupply function returns how many tokens currently exist (have been minted), helping users track collection progress.
What is 'gas' in the context of minting an NFT on Ethereum?