Blockchain Developer interview questions
100 real questions with model answers and explanations for Junior candidates.
See a Blockchain Developer resume example →Practice with flashcards
Spaced repetition · Hunter Pass
Questions
A distributed ledger is a shared record whose replicas are maintained by multiple network participants under common update rules.
- Each participating node can hold and verify its own copy instead of relying on one database server.
- A consensus protocol decides which valid updates and ordering the network accepts when nodes disagree.
- Replication improves fault tolerance, but it adds communication cost and does not make every distributed database a blockchain.
- A blockchain is one type of distributed ledger that usually groups updates into hash-linked blocks.
Why interviewers ask this: The interviewer is checking whether you understand both the shared-replica model and the role of consensus without treating every replicated database as a blockchain.
The header contains compact metadata used to identify and validate the block, while the body contains the transactions or other records it carries.
- A header normally references the previous block hash, linking the block to its parent.
- It also commits to the body through a transaction root such as a Merkle root, so a changed transaction produces a different commitment.
- Consensus fields such as a timestamp, height, validator data, difficulty, or nonce depend on the chain.
- Nodes process the body to verify transactions and recompute the commitments recorded in the header.
Why interviewers ask this: A strong answer separates compact consensus metadata from transaction data and explains how the header commits to the body.
Each block commits to its parent hash, so changing an older block breaks the hash links from that point forward.
- Even a one-bit change produces a different cryptographic hash with overwhelming probability.
- The next block still points to the original hash, making the edited history fail validation immediately.
- An attacker would need to rebuild the changed block and every descendant, then overcome the network's consensus rules.
- Hashes make tampering detectable; consensus and economic cost make an alternative history difficult to have accepted.
Why interviewers ask this: The interviewer wants you to distinguish tamper evidence supplied by hashes from rewrite resistance supplied by consensus.
A public blockchain is generally open for anyone to inspect and join, while a private blockchain restricts participation to approved identities.
- Public networks such as Ethereum use permissionless validation and economic incentives because validators may not know or trust one another.
- Private networks such as Hyperledger Fabric can control who reads data, submits transactions, or validates updates.
- Permissioned membership can provide higher throughput and privacy, but it concentrates control among the participating organizations.
Why interviewers ask this: The interviewer is evaluating whether you can connect membership rules to trust, privacy, performance, and control.
An account model updates balances and state attached to addresses, while a UTXO model consumes existing outputs and creates new ones.
- Ethereum accounts have fields such as balance and nonce, which transactions modify in a shared global state.
- In Bitcoin, an output is spent in full, so a payment commonly creates one output for the recipient and another for change.
- UTXOs are easy to validate independently and can support parallel processing when they do not spend the same outputs.
- Accounts make balances and smart-contract state easier to express, but transactions can contend on the same state.
Why interviewers ask this: A strong answer explains how each model represents ownership and how that affects transaction construction and state access.
A full node validates the chain's rules itself, while a light node verifies limited evidence and obtains most data from full nodes.
- A full node downloads blocks and checks transactions, signatures, and consensus rules before accepting state.
- A light client usually keeps block headers and can verify inclusion with a Merkle proof instead of downloading every transaction.
- Light clients need far less storage and bandwidth, which suits phones and browser wallets.
- Their security depends on the protocol and available proofs, and relying on one RPC provider adds trust and privacy risks.
Why interviewers ask this: The interviewer is checking whether you understand the resource and trust trade-off rather than assuming a light node performs full validation.
Nodes relay new transactions and blocks to connected peers, which produces gossip-style propagation across the network.
- A wallet usually submits a signed transaction to one node, and that node performs basic validation before forwarding it.
- Peers track items they have already seen so duplicate announcements do not trigger endless rebroadcasting.
- A newly produced block follows the same peer relay process, with each receiving node validating it before acceptance.
- Network latency means nodes may briefly see different transaction orders or competing chain tips.
Why interviewers ask this: The interviewer wants to hear how validation, deduplication, and network latency shape peer-to-peer propagation.
A mempool is a node's local collection of valid unconfirmed transactions waiting for possible inclusion in a block.
- A node checks signatures, nonces or spendable outputs, and fee rules before admitting a transaction.
- Nodes can have different mempools because they receive transactions at different times and apply different size or fee policies.
- Block producers usually favor higher-fee transactions, though protocol and builder policies can change the ordering.
- Mempool admission does not guarantee confirmation because a transaction can expire, be dropped, conflict, or be replaced.
Why interviewers ask this: A strong answer treats the mempool as local and policy-driven rather than as one global queue guaranteed to enter the chain.
A transaction has one confirmation when it enters a block, and finality describes how confident an application can be that this result will not be reversed.
- Each additional block built on top adds another confirmation and makes a proof-of-work reorganization less likely.
- Proof-of-work finality is probabilistic, so applications wait for more confirmations when the transferred value or risk is higher.
- Many proof-of-stake chains finalize checkpoints through validator votes, after which reversal requires a severe protocol violation and penalties.
Why interviewers ask this: The interviewer is evaluating whether you distinguish inclusion from the different finality guarantees offered by consensus protocols.
A node accepts a block only after independently validating its parent, consensus data, transactions, and resulting commitments.
- The parent reference must identify a known valid block, and header fields must satisfy the chain's consensus rules.
- The node checks transaction signatures, nonces or spent outputs, balances, and other protocol conditions.
- It executes valid transactions in order and recomputes transaction, receipt, or state roots recorded in the header.
Why interviewers ask this: The interviewer is checking whether you distinguish receiving a proposed block from independently verifying every consensus and state rule.
Consensus lets distributed nodes agree on one valid transaction history even when some nodes fail or lie.
- Nodes need the same ordering because two individually valid transactions may try to spend the same funds.
- A Byzantine fault means a participant can behave arbitrarily, including sending conflicting messages to different peers.
- This is harder than a simple crash, where the node only stops responding and cannot actively mislead others.
- A consensus protocol defines the fault threshold under which safety and progress still hold, often in terms of voting power rather than node count.
Why interviewers ask this: The interviewer is checking whether the candidate connects consensus to conflicting state and distinguishes malicious behavior from an ordinary node failure.
Proof of work makes miners search for a block hash below the network's current target.
- A miner repeatedly changes a nonce or other header data and hashes the candidate block until one result meets the target.
- Finding that result is expensive, but every node can verify it with one hash calculation and validate the block's transactions.
- Nodes follow the valid branch with the most accumulated work, not simply the branch with the most blocks.
- The network adjusts difficulty so blocks arrive near the intended interval as total hash rate changes.
Why interviewers ask this: The interviewer is evaluating whether the candidate understands mining, cheap verification, chain selection, and difficulty adjustment as one mechanism.
Proof of stake ties participation in consensus to locked capital that the protocol can reward or penalize.
- Validators lock the native asset instead of competing through continuous hash calculations.
- The protocol selects proposers and counts validator votes according to its stake and randomness rules.
- Honest proposals and votes earn rewards, while missed duties can lose rewards or incur inactivity penalties.
- Provably conflicting votes can destroy stake, making attacks carry a direct economic cost.
Why interviewers ask this: The interviewer is checking whether the candidate can explain proof of stake through selection, incentives, and penalties rather than calling it low-energy mining.
A validator participates in consensus, while a selected proposer publishes a block and other validators attest to their view of the chain.
- A solo Ethereum validator deposits 32 ETH and runs software that performs assigned consensus duties.
- For each slot, one selected proposer assembles and broadcasts a candidate block.
- Other validators publish attestations that vote for a chain head and checkpoint links, and the protocol aggregates their stake weight.
- Missing a duty loses potential rewards, while signing conflicting messages can lead to slashing.
Why interviewers ask this: The interviewer is testing whether the candidate can separate the general validator role from the proposer and voting duties performed in a slot.
A fork creates competing valid branches, and the protocol's fork-choice rule selects one as canonical.
- A temporary fork can occur when different blocks are published close together and reach nodes in different orders.
- Nodes validate each branch before applying fork choice, so an invalid block cannot win merely by extending a branch.
- Proof-of-work chains commonly prefer the valid branch with the most accumulated work, while proof-of-stake chains use validator votes and protocol-specific rules.
- Blocks outside the selected branch are noncanonical, and their transactions may be included again if they remain valid.
Why interviewers ask this: The interviewer is checking whether the candidate distinguishes block validity from the separate rule that selects among valid branches.
A reorganization replaces recent canonical blocks when another valid branch wins the fork-choice rule.
- The node rolls back state changes from the removed blocks and applies the blocks from the winning branch.
- A transaction in a removed block can become pending again, disappear, or be included later in a different position.
- Applications should track block hashes and wait for suitable confirmations or finality before treating a payment as irreversible.
Why interviewers ask this: The interviewer is evaluating whether the candidate understands both the state rollback and the practical confirmation handling required by clients.
Probabilistic finality makes reversal less likely over time, while economic finality makes reversal require a punishable loss of stake.
- In proof of work, each additional block adds work on top of a transaction, so replacing its branch becomes progressively less probable and more costly.
- In proof of stake, a checkpoint can become finalized after the required stake votes for it under the protocol's rules.
- Reverting an economically finalized checkpoint would require validators to violate accountable rules and risk losing substantial stake.
Why interviewers ask this: The interviewer is checking whether the candidate can compare confidence from accumulated work with a finality guarantee backed by slashable capital.
Majority consensus power can manipulate chain selection, but it does not grant control over other users' keys or valid protocol rules.
- The attacker can censor transactions or selected addresses by refusing to include their transactions in blocks.
- The attacker can reorder their own transactions and attempt a double spend by replacing a branch containing an earlier payment.
- The attacker cannot forge another user's signature, spend that user's coins, or make honest nodes accept an invalid state transition.
Why interviewers ask this: The interviewer is testing whether the candidate knows the real chain-control risks without treating majority power as unlimited access to funds or protocol state.
Slashing destroys part of a validator's stake when cryptographic evidence proves a forbidden consensus action.
- In Ethereum, slashable actions include proposing two blocks for one slot and making conflicting or surround votes.
- The signed messages provide evidence that other nodes can verify without trusting the reporter.
- Slashing is different from a small inactivity penalty, which can apply when a validator is offline rather than dishonest.
- Penalties grow when many validators are slashed together, discouraging operators from sharing one failure-prone setup.
Why interviewers ask this: The interviewer is checking whether the candidate understands what behavior is provable, why it is punished, and how slashing differs from downtime penalties.
Blockchains resist Sybil attacks by tying consensus influence to a scarce resource rather than the number of identities.
- Creating thousands of key pairs is nearly free, so signatures alone cannot prove that those keys belong to independent participants.
- Proof of work weights influence by contributed computation, which requires hardware and energy.
- Proof of stake weights influence by locked stake, so splitting the same funds across many validators does not create extra total voting power.
- Permissioned networks can instead restrict membership through verified organizations, certificates, or an access-control process.
Why interviewers ask this: The interviewer is evaluating whether the candidate understands why cheap pseudonymous identities require resource-based or membership-based admission to consensus.
Locked questions
- 21
How are a private key and a public key related?
- 22
Why is a digital signature not the same as encryption?
encryption - 23
How is an Ethereum EOA address derived from a public key?
ethereum - 24
What is the difference between a wallet, an account, and a private key?
wallets - 25
What is a BIP39 seed phrase, and how does it support HD wallet derivation?
wallets - 26
Which properties make a cryptographic hash useful in blockchains?
blockchain - 27
What is a Merkle tree, and how does a Merkle proof work?
cryptography - 28
What information is included in an Ethereum transaction?
ethereumtransactions - 29
What is an EOA transaction nonce, and why does it matter?
transactions - 30
Describe the lifecycle of an Ethereum transaction from signing to block inclusion.
ethereumtransactions - 31
Why must EVM execution be deterministic?
evm - 32
What is the relationship between Solidity source code and EVM bytecode?
solidevmsolidity - 33
How do stack, memory, storage, and calldata differ in the EVM?
evmmemorydata-location - 34
What is the difference between an Ethereum transaction and a message call?
ethereumtransactions - 35
What happens to state changes when EVM execution reverts?
evmerror-handling - 36
What is gas in the EVM, and how do transaction and block gas limits work?
evmtransactionsgas - 37
How are transaction fees calculated under EIP-1559?
transactions - 38
What is the difference between eth_call and sending a transaction?
transactions - 39
What are the Ethereum ABI and a function selector?
ethereum - 40
How do Ethereum events, logs, and indexed parameters work?
indexesethereum - 41
What are the main parts you expect to see in a Solidity contract?
solidsolidity - 42
What does a Solidity constructor do, and when does it run?
solidsolidity - 43
How do public, external, internal, and private visibility differ in Solidity?
csssolidsolidity - 44
What do view, pure, and payable mean on Solidity functions?
solidsolidity - 45
How do value types, reference types, and mappings differ in Solidity?
soliditydata-structuressolid - 46
When would you use require, revert, and assert in Solidity?
solidityerror-handlingsolid - 47
What is the difference between receive and fallback in Solidity?
solidsolidity - 48
How do inheritance, interfaces, and libraries serve different purposes in Solidity?
typesoopsolidity - 49
What does the ERC-20 interface define, and how do events and allowances work?
tokenstypes - 50
How do ownership, approvals, and safe transfers work in ERC-721?
ownershiptokens - 51
You need to ship a basic ERC-20 with a fixed initial supply using the current OpenZeppelin Contracts release. How would you implement and verify it?
tokens - 52
Your ERC-20 needs minting after deployment, but only an approved service should mint. How would you implement and test that access control?
tokensdeployment - 53
How would you design a wallet flow for approving an ERC-20 spender without giving it more allowance than the user intended?
designtokenswallets - 54
How would you implement an ERC-721 mint function with stable metadata using the current OpenZeppelin Contracts release?
tokens - 55
You are adding a paid public mint to an ERC-721 contract. How would you accept ETH safely and prevent incorrect or repeated mints?
tokens - 56
How would you implement a simple ETH vault where each user can deposit and withdraw only their own recorded balance?
secrets - 57
You want the vault to issue shares so gains or losses are distributed proportionally. How would you calculate deposits and redemptions?
secretsdistributed - 58
How would you implement a simple crowdfunding contract with a funding goal, deadline, creator payout, and refunds?
estimation - 59
How would you implement a simple fixed-price ERC-20 sale with a hard token cap?
tokens - 60
How would you add pause and emergency control to a contract without letting one operator control everything?
- 61
A withdraw function sends Ether before clearing the caller's balance. How would you fix and test it?
- 62
A contract executes target.call(data) and continues without reading the result. What would you change?
- 63
An admin function uses require(tx.origin == owner). How would you secure it?
- 64
A Solidity 0.8 contract increments balances and a reviewer suggests wrapping the arithmetic in unchecked to save gas. What would you do?
solidsoliditygas - 65
A swap function accepts only amountIn, so another transaction can move the price before execution. What protection would you add?
transactions - 66
During review you find that anyone can call setFee and mint. How would you fix the missing access control?
- 67
A mint function accepts any recipient and amount, including the zero address and zero. What validation would you add?
validation - 68
A payout contract assumes address(this).balance always equals recorded user deposits. How would you make that accounting safe?
- 69
A distribute function loops over every recipient and now runs out of gas as the list grows. How would you prevent this denial of service?
gas - 70
A deposit function calls IERC20(token).transferFrom and ignores the returned boolean. How would you secure this interaction?
tokens - 71
A function is declared as function sum(uint256[] memory values) external pure returns (uint256) and only reads values. How would you reduce its gas cost?
memorygas - 72
A contract declares uint128 deposited; uint256 total; uint128 withdrawn; address owner; bool paused. How would you improve this storage layout?
- 73
A withdraw function runs require(balances[msg.sender] >= amount) and then balances[msg.sender] = balances[msg.sender] - amount. How would you remove the repeated storage read?
- 74
A record function both pushes Payment(msg.sender, amount, block.timestamp) into a payments storage array and updates totalPaid[msg.sender], but only an off-chain dashboard reads the payment history. How would you improve it?
- 75
A withdrawal uses require(amount <= balances[msg.sender], "Insufficient balance for requested withdrawal"). How would you make this failure cheaper and still useful to clients?
- 76
A contract stores address public owner from its constructor and initializes uint256 public feeBps = 30, and neither value ever changes. How would you improve these declarations?
- 77
A contract stores address[] members, and isMember loops over the whole array to find an account. How would you improve membership checks as the list grows?
- 78
A getDepositors function copies an entire growing storage array into memory for every call. How would you make this getter practical?
memory - 79
A loop uses for (uint256 i; i < values.length; i++) to sum a calldata array. How would you optimize only the increment without disabling safety for the sum?
optimizationdata-location - 80
A review proposes replacing mapping(address => bool) allowed with a hand-written assembly bitmap solely to save gas. How would you decide whether to accept the change?
gasdata-structures - 81
You need to test an ERC-20 transfer with Hardhat 3. What would you assert besides checking that the transaction succeeded?
tokenstransactionshardhat - 82
A transfer should fail with InsufficientBalance(address,uint256,uint256). How would you test that custom error in Foundry or Hardhat 3?
foundryhardhat - 83
How would you test that an ERC-20 transfer emits the correct Transfer event?
tokens - 84
Your contract tests modify balances and permissions. How would you isolate each test in Hardhat 3 and Foundry?
contractfoundryhardhat - 85
A claim function is valid until a stored deadline. How would you test its time boundaries without waiting in real time?
estimation - 86
How would you test an owner-only function with several accounts in Hardhat 3 and Foundry?
foundryhardhat - 87
How would you turn a single ERC-20 transfer example into a useful Foundry fuzz test?
tokensfoundry - 88
How would you write a simple Foundry invariant for a deposit contract that tracks total managed assets and each user's deposit?
foundry - 89
You are integrating a deployed price feed. When would you use a fork test instead of a local mock?
mockingdeployment - 90
How would you test that a withdrawal function is protected from reentrancy?
reentrancy - 91
Your frontend has an ethers.js v6 provider and a wallet account. How would you instantiate a contract for reads and for writes?
walletsethers - 92
Using ethers.js v6, how would you read an ERC-20 balance, send a transfer, and report confirmed success to the UI?
tokensethers - 93
A contract call starts failing after you switch testnets. How would you determine whether the ABI, address, or network is wrong?
- 94
An ERC-20 transfer receipt contains several logs from nested contract calls. How would you extract the token's Transfer event with ethers.js v6?
tokensethers - 95
Your WebSocket reconnects and the app misses some Transfer events. How would you combine an ethers.js subscription with backfilling reliably?
websocketsethersbackfill - 96
Before sending a token transfer with ethers.js v6, how would you use staticCall and estimateGas, and what can they not guarantee?
estimationtokensethers - 97
A staticCall fails with CALL_EXCEPTION, and the Solidity contract defines InsufficientBalance(address,uint256,uint256). How would you decode it in ethers.js v6?
solidsolidityethers - 98
Alice owns ERC-20 tokens, and Bob must move an approved amount to Carol. How would you implement the approve then transferFrom flow with ethers.js v6?
tokensethers - 99
A user's EIP-1559 transaction has been pending for several minutes because its fee is too low. How would you replace or cancel it with ethers.js v6?
transactionsethers - 100
You need to deploy Box(address owner, uint256 initialValue) to Sepolia with Hardhat 3 and verify it on an explorer. Walk through a repeatable process and diagnose a constructor-argument verification failure.
deploymenthardhatconcurrency