Blockchain Developer interview questions
100 real questions with model answers and explanations for Senior candidates.
See a Blockchain Developer resume example →Practice with flashcards
Spaced repetition · Hunter Pass
Questions
The invariant defines valid swap outcomes, while reserve and fee accounting define who owns the resulting balances.
- In a constant-product pool, the net input after the swap fee moves the price along the x times y curve and bounds the output.
- If the fee stays in the pool, the actual reserve product normally grows after a swap, so the invariant does not mean the numeric value of k is forever fixed.
- Stored reserves, token balances, and LP supply can diverge after a donation or rebase, so the protocol must define explicitly when balances are synchronized and how that value reaches LPs.
Why interviewers ask this: The interviewer is checking whether the candidate separates swap mathematics from asset and fee ownership accounting.
LP shares should preserve each provider's proportional claim and round so the pool never gives away unaccounted value.
- For an established pool, minted shares are usually the minimum of each deposit amount times total supply divided by its reserve, while a burn returns the holder's fraction of both reserves.
- The first deposit needs separate logic, such as geometric-mean shares with a small permanently locked amount, because there is no existing exchange rate.
- Share outputs and withdrawal outputs round down, while any input quoted for an exact share amount rounds up, preventing repeated dust operations from extracting value.
Why interviewers ask this: The interviewer is evaluating proportional share math, initialization, donation handling, and caller-adverse rounding as one accounting design.
Concentrated liquidity turns one pool-wide LP claim into many price-range positions whose liquidity becomes active at tick boundaries.
- Each initialized tick stores a net liquidity change, and crossing it adds or removes that liquidity from the amount currently used by swap math.
- A position records its owner, lower tick, upper tick, and liquidity, often as an NFT, because two providers can choose different ranges and no longer own interchangeable shares.
- Fees are calculated from global fee growth and growth outside the two boundaries, so a position earns only while the price is inside its range.
- Narrow ranges improve capital efficiency, but they require active management and make swaps that cross many initialized ticks more expensive.
Why interviewers ask this: The interviewer is checking whether the candidate connects range activation, position identity, fee accounting, and capital-efficiency trade-offs.
LTV limits how much a user may borrow initially, while the liquidation threshold marks when the resulting position is no longer sufficiently collateralized.
- Borrow capacity is based on oracle-valued collateral multiplied by each asset's LTV, so a deposit worth 100 with an 80 percent LTV supports at most 80 of debt.
- Solvency uses liquidation-adjusted collateral against current debt, commonly exposed as a health factor that becomes liquidatable below 1.
- The gap between LTV and the liquidation threshold is a safety buffer for price movement and accrued interest, not extra liquidity the borrower can withdraw freely.
Why interviewers ask this: The interviewer is evaluating whether the candidate can separate admission limits from the ongoing solvency boundary.
The model should make borrowing progressively more expensive as utilization rises, with a sharp increase near the point where withdrawals become hard to serve.
- Utilization is typically borrowed assets divided by available cash plus borrowed assets, using the protocol's exact reserve treatment consistently.
- A kinked curve rises gently below a target such as 80 percent, then steeply above it to encourage repayment and attract supply.
- Supplier yield is derived from the borrow rate, utilization, and reserve factor, so it is lower than the headline borrow rate.
- High rates price scarce liquidity but do not create cash immediately, so withdrawal and reserve design must not assume the curve guarantees availability.
Why interviewers ask this: The interviewer is checking whether the candidate understands both the economics and the liquidity limit of a utilization curve.
The incentive pays liquidators for restoring solvency, while the close factor limits how much debt one liquidation may repay.
- A liquidator repays debt and receives collateral worth the repayment plus a bonus, which must cover gas, price movement, and execution risk without needlessly stripping collateral.
- A 50 percent close factor prevents one call from closing the whole debt, but it can also leave a fast-falling position exposed across several liquidations.
- Bad debt appears when the remaining collateral, after accounting for the liquidation bonus and market price, cannot cover the remaining debt.
- The protocol then needs an explicit loss path, such as reserves, insurance, or supplier loss, because a larger bonus cannot recover value that no longer exists.
Why interviewers ask this: The interviewer is evaluating whether the candidate can follow liquidation economics through partial repayment to an uncovered shortfall.
I would choose isolation when limiting contagion from one collateral, oracle, or market matters more than maximum capital efficiency.
- In an isolated market, a shortfall is contained to that market's suppliers and reserves instead of consuming liquidity that backs unrelated assets.
- Shared liquidity improves utilization, borrow depth, and cross-collateral access, but one weak asset can create losses or frozen withdrawals across the common pool.
- Isolation also fragments liquidity and requires separate caps, rate curves, and oracle configuration, so mature low-risk assets may justify a shared pool while new collateral does not.
Why interviewers ask this: The interviewer is checking whether the candidate can trade capital efficiency against the blast radius of insolvency.
It converts newly emitted rewards into a global cumulative amount per staked token and settles each user only when that user interacts.
- On a checkpoint, the contract adds new rewards times a precision scale divided by total stake to the accumulator.
- A user's pending reward is their stake times the accumulator divided by the precision scale, minus their reward debt, so rewards must be settled before changing that stake.
- After a deposit, withdrawal, or claim, reward debt is reset to the user's new stake times the current accumulator divided by the same scale.
- The design must define what happens while total stake is zero and retain enough precision that integer dust cannot become a repeatable extraction path.
Why interviewers ask this: The interviewer is evaluating whether the candidate understands constant-time reward accounting and its ordering and precision invariants.
Unbonding keeps stake slashable long enough for misconduct to be observed and finalized before the validator can withdraw it.
- The delay should cover the evidence, challenge, and chain-finality window, and pending withdrawals must remain slashable throughout that period.
- Slash conditions should be objectively provable and bounded, with stronger penalties for safety violations such as equivocation than for short downtime.
- Starting unbonding must not detach stake from the period in which an offense occurred, so later evidence can still slash it before the proof window closes.
- A longer delay improves accountability but increases capital lockup and liquid-staking pressure, so it should follow the protocol's real detection latency.
Why interviewers ask this: The interviewer is checking whether the candidate links withdrawal timing to enforceable economic security rather than treating unbonding as a UX delay.
After the callback, the lender must have recovered the principal plus the agreed fee or revert the entire transaction.
- The lender records its balance, transfers the asset, invokes the receiver, then either checks the final balance or pulls the exact amount plus fee under an approved standard such as ERC-3156.
- A successful callback return value is not proof of repayment, so the balance or transfer result must be verified independently of the receiver's internal accounting.
- The receiver should authenticate the lender and initiator before acting, because an arbitrary caller must not be able to trigger approvals or privileged callback logic.
- Any failed repayment reverts the transfer and every nested action atomically, which is what makes unsecured one-transaction borrowing possible.
Why interviewers ask this: The interviewer is evaluating whether the candidate treats the callback as untrusted execution protected by an end-of-transaction repayment invariant.
I would draw boundaries around invariant ownership and authority, not around business nouns alone.
- One module should own each critical accounting fact, such as total debt or share supply, and expose narrow commands rather than writable shared state.
- A cross-module operation should have one atomic coordinator that validates preconditions and applies every related transition, with explicit invariant checkpoints and reentrancy rules around any required callback.
- Interfaces should state units, rounding, trust assumptions, and failure behavior so a caller cannot reinterpret another module's values.
- Dependency direction, upgrade authority, and pause scope should follow the same boundary, limiting the state and privileges affected by a faulty module.
Why interviewers ask this: The interviewer is checking whether the candidate can turn shared invariants into explicit ownership, contracts, and failure boundaries.
I would choose from the protocol's promised trust model, expected change, and credible migration path rather than make upgradeability the default.
- Immutability fits a small, settled core when users can verify fixed rules and move assets to a replacement without depending on privileged migration.
- Upgradeability fits components whose integrations or risk parameters must evolve, but it adds storage constraints and an authority that can replace all delegated logic.
- A hybrid can keep custody and core accounting immutable while routing configurable policy or integrations through tightly scoped replaceable modules.
- The deployed design should make upgrade scope, delay, rollback limits, and the user's exit opportunity visible because these are protocol guarantees, not implementation details.
Why interviewers ask this: A strong answer balances changeability against migration cost, authority risk, and the guarantees made to users.
I would choose the pattern from fleet size, upgrade granularity, deployment cost, and who is trusted to change code.
- UUPS suits independently upgraded instances with small proxies, provided every implementation preserves compatible upgrade logic and strongly authorizes upgrades.
- Transparent proxies suit independent instances when a distinct ProxyAdmin and sender-based admin separation are worth the larger deployment surface.
- Beacon proxies suit a homogeneous fleet that should move together through one beacon, accepting that one beacon upgrade has fleet-wide blast radius.
- Minimal clones suit many cheap instances whose implementation is fixed; if instances need coordinated upgrades, a beacon fleet is usually the clearer model rather than adding hidden mutability to clones.
Why interviewers ask this: The interviewer is evaluating whether proxy selection follows fleet topology and trust boundaries instead of gas cost alone.
A diamond maps routed function selectors to facets and delegates those calls so facet code operates on the diamond's identity and storage.
- Immutable functions execute directly in the diamond, while fallback resolves other msg.sig values to facets, forwards calldata with delegatecall, and returns or reverts with the facet's data.
- diamondCut applies selector additions, replacements, and removals atomically, then may delegatecall initialization needed by the new composition.
- Loupe functions expose facets and selector mappings so clients and tooling can inspect the current interface.
- The diamondCut authority is therefore code-change authority over the whole diamond and should receive the same protection as a proxy upgrade.
Why interviewers ask this: The interviewer checks whether the candidate understands selector dispatch, delegatecall context, atomic cuts, and introspection.
I would treat storage namespaces and selector mappings as permanent schemas that every cut must validate.
- Each facet domain can anchor a storage struct at a unique deterministic slot, while fields inside that namespace remain append-only and type-compatible across upgrades.
- State shared by facets should have one canonical accessor and representation so separate facets cannot create competing copies of the same invariant.
- A cut must reject adding an existing selector, replacing it with the same facet, removing an absent selector, or leaving required interface selectors unreachable.
- The cut manifest should compare old and new selector ownership, storage layouts, interface support, and initialization effects before applying all changes atomically.
Why interviewers ask this: A strong answer treats namespaced storage and selector ownership as linked compatibility contracts rather than isolated diamond mechanics.
I would model roles as narrow capabilities with explicit administration edges and keep operational power separate from power to grant it.
- Roles should map to bounded actions and resources, such as pausing one market or updating one oracle, instead of broad operator access across the protocol.
- A high-trust root should administer role managers but hold no routine operational role, and only deliberately governed self-administration should remain after bootstrap.
- Grant, revoke, upgrade, treasury, and emergency powers should have distinct paths, with delays or expiry where immediate persistent access is unnecessary.
- The complete graph should be machine-checkable from every external function to its role and from every role to the principals that can create or revoke it.
Why interviewers ask this: The interviewer is checking whether least privilege covers both direct permissions and every path that can grant those permissions.
I would give each mechanism one job: the multisig authenticates a threshold, the timelock delays normal changes, and the guardian only limits damage.
- Upgrades, treasury transfers, and durable parameter changes should execute through the timelock after authorized proposal and review delay, not directly from signer keys.
- The multisig can own proposer or administrative roles, but its threshold and signer diversity do not replace a public execution delay.
- The guardian may pause a bounded surface or cancel a queued action, but it should not upgrade code, move user funds, or bypass the timelock.
- Unpause and restoration of normal authority should follow a more deliberate path so compromising the fastest key cannot create persistent control.
Why interviewers ask this: The interviewer evaluates whether authentication, delayed execution, and emergency containment are separate trust boundaries.
I would pause risk-increasing actions while preserving the safest path to reduce exposure and exit.
- Pause controls should be granular by module and action, blocking borrowing, leverage, risky trades, and unsafe withdrawals while preserving repayments, claims, cancellations, and collateral additions where possible.
- An exit path should use conservative accounting and avoid optional dependencies that the same emergency can disable, such as a mutable integration or fresh risky oracle read.
- The guardian can activate a bounded pause quickly, while unpause and any extension of restrictions require stronger delayed authority.
- If immediate withdrawal would violate solvency or ordering invariants, the protocol needs a predesigned pro rata redemption or delayed escape mechanism rather than an unlimited freeze.
Why interviewers ask this: A strong answer treats user exit and protocol liveness as explicit invariants of emergency control.
I would derive all three from historical voting power and tune them to participation and concentration rather than current token balances.
- Delegation checkpoints should fix each account's voting power at the proposal snapshot so transfers during voting cannot duplicate or move votes.
- A nonzero voting delay gives delegates time to respond and places the snapshot after proposal creation under an explicit clock based on blocks or timestamps.
- Quorum should be a documented fraction of historical eligible supply, with clear treatment of abstentions, so supply changes do not rewrite an active proposal's requirement.
- The proposal threshold should deter spam while still permitting credible minority proposals, and changing either threshold or quorum should itself pass delayed governance.
Why interviewers ask this: The interviewer is checking whether governance parameters are coherent historical rules rather than arbitrary constants.
I would make voting power costly to acquire over time and limit what a temporary or captured majority can execute immediately.
- Votes and proposal eligibility should read checkpoints from before activation, with enough voting delay that tokens borrowed and returned in one transaction cannot create usable power.
- If voting tokens are widely borrowable, staking age, lock duration, or time-weighted voting power can address short-lived positions that a simple block snapshot still permits.
- Quorum and proposal thresholds should use the same historical vote source, while delegation concentration and wrapper contracts must be included in the capture model.
- A timelock, bounded guardian cancellation, immutable limits on critical powers, and a user exit window contain malicious proposals, but they cannot make a genuinely purchased majority honest.
Why interviewers ask this: The interviewer evaluates whether the candidate distinguishes atomic vote borrowing from longer-term economic capture and layers defenses accordingly.
Locked questions
- 21
How would you build a threat model for a new DeFi protocol?
threat-modelingtypingdefi - 22
What audit process would you follow from specification to final findings?
concurrency - 23
How do protocol invariants differ from local assertions?
typing - 24
How would you design a stateful fuzz test with handlers and ghost state?
design - 25
When is formal verification useful for a smart-contract protocol, and what are its limits?
typing - 26
What is symbolic execution good at, and why does path explosion matter?
- 27
How would you design a robust oracle architecture for a lending protocol?
designoraclestyping - 28
How would you make a swap flow aware of MEV without promising that MEV can be eliminated?
- 29
How do you make a protocol composable with arbitrary tokens and callback hooks?
callbackstypinghooks - 30
How would you model whether an economic attack on a protocol is profitable?
typing - 31
How do you balance storage packing against access cost in an upgradeable protocol?
upgradeabilitytyping - 32
How would you use ERC-7201 namespaced storage in a protocol with many upgradeable modules?
upgradeabilitytypingkubernetes - 33
How do calldata, persistent storage, and data availability costs change your design across Ethereum L1 and rollups?
designethereumlayer2 - 34
How would you design events and an indexer so the application remains correct through chain reorganizations?
indexesdesign - 35
When is EIP-1153 transient storage a good fit, and how can it break composability?
- 36
How do you get gas savings from batching without creating unbounded state transitions?
batchgas - 37
What assumptions would you avoid when integrating an arbitrary ERC-4626 vault?
secrets - 38
How would you design a typed permit flow that supports both EOAs and ERC-1271 smart contract wallets?
designsmart-contractswallets - 39
Which invariants matter when a protocol wraps ERC-1155 batch transfers and receiver hooks?
batchtokenshooks - 40
What can ERC-165 interface detection prove, and what still needs behavioral validation?
validationtypes - 41
A bridge will secure assets worth about $200 million across two chains. How would you choose between a 5-of-8 multisig, a light-client bridge, and an optimistic bridge?
lockingbridges - 42
Users can bring the same stablecoin through the chain's canonical bridge or through two third-party bridges, and all three versions now trade separately. How would you model these assets?
bridgesdependencies - 43
A cross-chain order service must survive duplicate relays, source-chain reorgs, and messages that arrive out of order. What message protocol would you use?
typing - 44
A protocol has contracts on L1 and two L2s, and a governance upgrade changes the cross-chain message format. How would you roll it out without requiring every chain to upgrade in one block?
governancetyping - 45
An optimistic rollup posts a state root every minute and advertises one-minute finality, but withdrawals take seven days. How would you explain and assess that design?
designlayer2locking - 46
A ZK rollup produces validity proofs but keeps transaction data on a separate committee and uses a trusted setup. What does the proof guarantee, and what risks remain?
layer2transactions - 47
An L2 sequencer confirms transactions in two seconds but can omit a user's transaction indefinitely. How would forced inclusion work, and what should the product call final?
transactions - 48
How does ERC-4337 separate account validation from execution, and what risks must a paymaster control?
validation - 49
A new staking network offers 28% annual token rewards, while protocol fees cover only 3% of rewards and team tokens unlock after 12 months. How would you judge whether the incentives are sustainable?
tokenstypingstaking - 50
A DEX uses vote-escrowed tokens to direct $8 million of yearly liquidity incentives, and external protocols pay voters for gauge weight. How would you assess this design?
designdefitokens - 51
Your DeFi product needs cheap frequent transactions, access to Ethereum liquidity, and no custom execution rules. Would you deploy on L1, an existing L2, or an appchain?
ethereumdefitransactions - 52
An exchange needs EVM compatibility and withdrawals that become final on L1 within an hour. Would you choose an optimistic or ZK rollup?
evmlayer2locking - 53
A perpetual exchange needs sub-second order matching, on-chain custody, and settlement verifiable from Ethereum. What architecture would you choose?
ethereum - 54
The treasury wants to route $100 million through a recently launched third-party bridge because it is cheaper than the canonical route. How would you make the decision?
bridgesdependencies - 55
You are designing a stablecoin that can burn on one chain and mint on another while messages may be delayed or reverted by a reorganization. How would you preserve supply integrity?
designerror-handling - 56
A lending product wants users to post collateral on one L2 and borrow on another. How would you keep positions solvent when cross-chain messages are delayed?
- 57
A DEX deployed on four L2s has fragmented liquidity, and moving pooled assets between chains is too slow for good quotes. What architecture would you use?
defideployment - 58
An immutable lending protocol has open positions, but a new release changes interest and liquidation accounting. How would you migrate users without rewriting history?
immutabilitytyping - 59
A live appchain is moving its contracts and bridged assets to a rollup. How would you cut over without creating two authoritative states?
layer2bridges - 60
Your rollup meets its speed and cost targets with one sequencer, but the team now wants credible decentralization without degrading the product overnight. What would you prioritize?
layer2 - 61
Monitoring shows an attacker draining a live vault. What do you do in the first ten minutes?
secretsmonitoring - 62
A lending market starts liquidating healthy accounts after one collateral price diverges sharply from the broader market. How do you respond?
- 63
You learn that enough bridge signer keys may be compromised to authorize messages. What is your response?
bridges - 64
A malicious governance proposal has passed and is queued to transfer the treasury. How would you handle it?
governancedata-structures - 65
An L2 sequencer recovers from an outage, then a reorganization drops transactions users had treated as confirmed. What do you do?
transactions - 66
How would you assign roles in a protocol incident war room?
incidentstyping - 67
What evidence would you preserve during a protocol exploit, and how would you keep it trustworthy?
typing - 68
After an exploit, stolen funds are still moving across chains and exchanges. How would you pursue recovery?
- 69
How would you communicate publicly while a major protocol incident is still active?
communicationincidentstyping - 70
When would you reopen a protocol after an exploit, and what must the post-mortem contain?
incidentstyping - 71
How would you plan an internal security review when a protocol release is four weeks away?
typing - 72
A critical contract diff arrives late in the release cycle. How do you review it?
- 73
How would you select and manage an external smart-contract auditor?
- 74
How would you scope a bug bounty for a DeFi protocol entering mainnet?
defityping - 75
Your formal verification suite takes six hours and developers have started bypassing it. How would you integrate it into delivery?
- 76
What security gates must a smart-contract release pass before mainnet?
- 77
How do you manage security risk when upgrading the Solidity compiler or a contract dependency?
soliddependenciessolidity - 78
How do you keep invariant and fuzz testing useful throughout delivery rather than as a pre-audit exercise?
testing - 79
What would you include in a predeployment rehearsal for a protocol upgrade?
typing - 80
What on-chain monitoring should be ready when a protocol release goes live?
monitoringtyping - 81
A bridge must rotate its validator set while Solidity verification, a Rust validator client, and a Go relayer remain live. How would you lead the change?
solidbridgesvalidation - 82
An engineer fixes a share-accounting bug with one extra condition, but cannot explain which rounding invariant the patch restores. How would you mentor them through the review?
mentoring - 83
A security reviewer says a replay issue should block launch, while the feature owner says the path is unreachable. How would you resolve the disagreement?
conflict - 84
An RFC proposes a generic plug-in interface for any lending protocol, while the first release only needs one integration. What decision would you make?
genericstypestyping - 85
A withdrawal feature requires coordinated changes to an L1 Solidity escrow, an L2 Rust prover, and a Go relayer. How would you lead the delivery?
solidsolidity - 86
How would you evaluate a third-party DeFi protocol before allowing your contracts to deposit user funds into it?
decision-makingdependenciestyping - 87
A product wants to accept a liquid restaking token as collateral because its secondary market is deep. What would you require before integration?
tokens - 88
A destination adapter receives callbacks from an approved bridge. What must it validate before executing a message or refund?
validationcallbacksbridges - 89
An external auditor delivers a report with unclear impact and no remediation retest two days before launch. How would you handle it?
- 90
A third-party protocol behind your adapter is upgradeable and may change fees or withdrawal behavior. How would you define ownership and an exit plan?
ownershipdependenciestyping - 91
A token launch will open against shallow liquidity, and the team expects bots to dominate the first blocks. What launch mechanism would you approve?
tokensdefi - 92
Governance wants to accept a thinly traded token as collateral because its community is growing. Would you list it?
tokensgovernance - 93
A lending market is at its supply cap every week, and business wants the cap removed. How would you decide the next limit?
- 94
A liquidity campaign is mostly rewarding wallets that cycle the same capital and leave after each epoch. What would you change?
walletsdefi - 95
A perpetual market could face correlated liquidations larger than its insurance fund. How would you design the loss waterfall?
methodologydesign - 96
Governance approved a proxy upgrade that changes storage and must ship while user positions remain open. How would you execute it?
proxyupgradeabilitygovernance - 97
An executed upgrade makes withdrawals revert, but some transactions have already changed state under the new implementation. What do you do?
transactionserror-handling - 98
A 48-hour timelock is too slow for lending caps during volatile markets, and the team proposes a risk council that can change any parameter instantly. What authority would you approve?
- 99
Fee revenue is falling, but the DAO wants to double token emissions to defend TVL. What change would you propose?
tokensdao - 100
A live lending protocol must replace its oracle provider while positions remain open. How would you switch without creating a price discontinuity?
oraclestyping