Smart Contract Fundamentals Flashcards
7 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 7 Smart Contract Fundamentals flashcards as text
What is 'delegatecall' in Solidity, and why is it risky?
Answer: A low-level call that executes another contract's code in the calling contract's storage context
delegatecall runs the target's code but reads and writes the caller's storage slots, so a malicious or buggy implementation can corrupt or drain the proxy's state.
In DeFi, what is a 'flash loan' and what makes it unique compared to traditional loans?
Answer: An uncollateralized loan that must be borrowed and repaid within a single transaction
Flash loans are uncollateralized because the smart contract enforces that the borrowed funds plus fee must be returned before the transaction finalizes, reverting everything if not.
What does ERC-721 define, and how does it differ from ERC-20?
Answer: ERC-721 defines non-fungible tokens where each token has a unique ID; ERC-20 defines fungible tokens
ERC-721 tokens are non-fungible — each has a unique tokenId and is not interchangeable — whereas ERC-20 tokens are identical and interchangeable units.
What is 'front-running' in the context of smart contracts and blockchain?
Answer: Inserting a transaction ahead of a pending one after observing it in the mempool to profit
Front-runners monitor the mempool, then pay a higher gas price to have their transaction mined first, exploiting information about a pending trade.
What is the purpose of the 'selfdestruct' opcode in Solidity?
Answer: It permanently removes a contract's code and storage, sending its ETH balance to a specified address
selfdestruct deletes contract bytecode and storage from the Ethereum state and forcibly sends any remaining ETH to the target address, even if that address has no payable function.
Which smart contract pattern separates data storage from business logic to enable upgrades?
Answer: Eternal storage pattern
The eternal storage pattern stores all state in a generic key-value contract separate from the logic contract, so logic can be replaced without losing data.
What is 'gas optimization' and why is it important for smart contract developers?
Answer: Writing code that minimizes EVM computational steps to lower transaction costs
Every EVM opcode costs gas; optimizing code reduces costs for users and can make a contract economically viable where a naive implementation would be prohibitively expensive.