Mixed Deck — All Ethereum Developer Topics Flashcards
98 cards from real Ethereum Developer practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 20 Mixed Deck — All Ethereum Developer Topics flashcards as text
Which statement is TRUE regarding view and Pure Functions:
Answer: State variables can only be accessed from by view functions. A pure function is unable to change or access state.
View functions in Solidity are restricted to reading state variables and cannot modify the blockchain state. Pure functions are even more restrictive; they cannot read or modify any state variables, operating solely on their input parameters and local variables. Neither type of function can alter the contract's state on the blockchain.
Variables of the type address hold
Answer: A value of 20 bytes
An Ethereum address is a 160-bit (20-byte) identifier for an account or contract on the blockchain. It is typically represented as a 40-character hexadecimal string prefixed with '0x'. This 20-byte length is a fundamental characteristic of Ethereum addresses.
What is Hardhat used for in Ethereum development?
Answer: A development environment for compiling, testing, and deploying Solidity smart contracts
Hardhat is a popular Ethereum development framework that provides a local blockchain, testing tools, and deployment scripts.
What does AMM stand for in the context of DeFi?
Answer: Automated Market Maker
An Automated Market Maker (AMM) uses liquidity pools and mathematical formulas to enable permissionless token swaps without an order book.
What does `eth_call` do in contrast to `eth_sendTransaction`?
Answer: eth_call simulates a call without modifying state; eth_sendTransaction writes to the chain
`eth_call` executes a function locally without creating a transaction, while `eth_sendTransaction` broadcasts a state-changing transaction.
In Ethereum's EIP-1559 fee model, what is the 'priority fee' (tip)?
Answer: An optional fee paid directly to validators to incentivize faster inclusion
The priority fee (maxPriorityFeePerGas) is an optional tip paid directly to the block proposer to incentivize including a transaction in the current block.
What is 'gas' in the context of the Ethereum network?
Answer: A unit measuring the computational work required to execute operations
Gas is a unit that measures the computational effort required to execute specific operations, preventing infinite loops and metering resource usage.
Which EIP number applies to the Hybrid Casper FFG proposal?
Answer: 1011
EIP-1011, titled 'Hybrid Casper FFG', proposed a significant change to Ethereum's consensus mechanism. This Ethereum Improvement Proposal outlined a hybrid approach that would combine the existing Proof-of-Work (PoW) chain with a Proof-of-Stake (PoS) 'Friendly Finality Gadget' (FFG), serving as a transitional step towards a full PoS system.
Address.send() and address.transfer() differ in that
Answer: On error, .transfer throws an exception while .send returns a Boolean. Both are regarded as safe against re-entry because they only forward the gas stipend of 2300 gas.
`address.transfer()` and `address.send()` both forward a limited gas stipend of 2300, making them safer against re-entrancy attacks compared to `call.value()()`. The key difference lies in error handling: `transfer()` automatically throws an exception and reverts the transaction on failure, whereas `send()` returns a boolean value (true for success, false for failure) requiring manual error checking by the developer.
Why are Solidity events more gas-efficient than contract storage for recording historical data?
Answer: Events are stored in cheaper transaction logs (~8 gas/byte) rather than costly contract storage (~20,000 gas per slot)
Emitting an event stores data in transaction logs at roughly 375 gas per topic and 8 gas per byte of data, far cheaper than the 20,000 gas cost of a new SSTORE.
Which is TRUE about Storing almost all data in the Ethereum Blockchain?
Answer: Using a Merkle Patricia Trie
Ethereum uses a Merkle Patricia Trie (MPT) to store all state data, including accounts, balances, contract storage, and transaction receipts. This data structure is highly efficient for verifying data integrity and allows for quick retrieval and updates of information. The MPT is fundamental to Ethereum's ability to maintain a consistent and verifiable global state across all nodes.
Which Solidity data type is used to store Ethereum addresses?
Answer: address
The `address` type is a 20-byte value specifically designed to hold Ethereum addresses.
What is MetaMask's primary role in a browser-based dApp?
Answer: An injected wallet that provides a Web3 provider and Signer to the dApp
MetaMask injects a `window.ethereum` provider object into the browser, enabling dApps to request account access and sign transactions.
What was the name of Teku's eth2 client prior to their rebranding?
Answer: Artemis
Teku, a prominent Ethereum 2.0 client developed by ConsenSys, was initially known by the codename Artemis. The rebranding occurred as part of the ongoing development and maturation of the Ethereum 2.0 ecosystem, now referred to as the consensus layer.
What is the primary function of the Ethereum Virtual Machine (EVM)?
Answer: To execute smart contract bytecode in a sandboxed environment
The EVM executes smart contract bytecode in an isolated, deterministic sandboxed environment across all Ethereum nodes.
What is a liquidity pool in the context of DeFi?
Answer: A smart contract holding reserves of two or more tokens used to facilitate trading
A liquidity pool is a smart contract containing token reserves provided by liquidity providers, enabling decentralized trading.
How a smart contract disburses funds
Answer: To guarantee that participants can receive their money regardless of the contract state, it is wise to use both a push and a pull mechanism. It should have a withdraw mechanism in addition to pushing.
For disbursing funds from a smart contract, it is generally safer and more robust to use a 'pull' mechanism, where recipients actively call a `withdraw` function to claim their funds. This approach mitigates risks associated with 'push' payments, such as re-entrancy attacks or failures if the recipient contract cannot receive Ether. While some scenarios might necessitate pushing funds, a reliable `withdraw` mechanism is crucial to ensure participants can always access their money regardless of the contract's state or recipient's capabilities.
Use of assert is to...
Answer: Examine user input arguments
The `assert()` function in Solidity is primarily used to check internal conditions and invariants that should always be true. If an `assert()` fails, it indicates a serious bug in the contract's logic, causing the transaction to revert and consume all remaining gas. While `require()` is typically used for validating user input, `assert()` is for ensuring the integrity of the contract's internal state.
What does the `require` statement do in Solidity when its condition is false?
Answer: Reverts the transaction and refunds unused gas
When `require` fails, it reverts all state changes and refunds the remaining gas to the caller.
Which is TRUE about Loops in Solidity?
Answer: Are risky when employed with expanding data structures, like arrays or mapping, because it is difficult to predict the gas requirements
Loops in Solidity, especially when iterating over dynamic data structures like arrays or mappings, pose a significant risk due to unpredictable gas requirements. If the number of iterations or the cost per iteration increases over time, the transaction might run out of gas, leading to failed transactions or making the contract unusable. This is known as the 'gas limit problem'.