Skip to content
Tutorials Center
My learning

Topics

Lesson 40 of 41 ยท Practice and Review

Blockchain Interview Questions

Forty blockchain interview questions with short answers: core concepts, cryptography, consensus, smart contract security and system design, with links to lessons.

Blockchain interviews tend to test whether you understand the trade-offs, not whether you can recite the white paper. A good interviewer asks a short question and then follows with "why?" or "what could go wrong?". This page collects forty common questions in five groups, with answers short enough to say out loud in about a minute. Each group links to the lessons that explain the topic in depth.

Aim for answers with three parts: the fact, the reason and the limit. "A blockchain is immutable" is a fact that invites a challenge. "It is tamper-evident, because every block commits to the previous hash, but a majority of the hash power or stake can still rewrite recent history" is an answer that survives follow-up questions.

Core concepts

1. What is a blockchain, in one sentence? An append-only ledger replicated across many computers, where each block commits to the previous one by hash and the participants agree on the next block through a consensus rule instead of trusting one operator. See What Is a Blockchain?.

2. What problem does it solve that a database does not? It lets parties who do not trust each other share one record without a trusted middleman. If one organization controls the data and everyone trusts it, a normal database is simpler and faster.

3. Is a blockchain immutable? Not strictly. It is tamper-evident and, with enough confirmations, practically irreversible on large networks. Anyone controlling a majority of the consensus resource (hash power or stake), or a social agreement to fork, can change history. Small chains are much easier to rewrite.

4. Public, private and consortium chains: what is the difference? Public chains let anyone read, write and validate. Private chains are run by one organization. Consortium chains are run by a known group of organizations. The more the participants are known, the less you need costly consensus like proof of work (History and Landscape).

5. What happens from the moment you send a transaction until it is final? You sign it, a node validates it and puts it in its mempool, gossip spreads it, a miner or validator includes it in a block, other nodes validate the block, and further blocks pile on top. Finality is probabilistic on proof-of-work chains and explicit on some proof-of-stake chains (How a Blockchain Works).

6. What is a node, and what is the difference between full and light nodes? A node is a computer running the protocol. A full node downloads and validates every block. A light node keeps only block headers and asks full nodes for proofs, such as a Merkle branch, for the transactions it cares about (Peer-to-Peer Networking).

Cryptography

7. What properties does a cryptographic hash function need? Deterministic, fast, one-way (preimage resistant), second-preimage resistant, collision resistant, and with an avalanche effect where a one-bit change flips about half of the output bits (Cryptographic Hash Functions).

8. Hashing, encryption and signing: what is the difference? Hashing is one-way and keyless. Encryption is reversible with a key. A signature proves that the holder of a private key approved a message, and anyone with the public key can verify it. Blockchains mostly use hashing and signing, and rarely encrypt on-chain data.

9. Why are transactions signed instead of using passwords? A signature proves authorization without revealing the secret, so every node can verify it independently. A password would have to be revealed to be checked (Digital Signatures).

10. What is a Merkle tree and why do blocks use one? A binary tree of hashes whose root commits to all leaves. It lets a light client verify one transaction with about log2(n) hashes, and lets nodes detect which part of a large dataset differs (Merkle Trees).

11. How does an address relate to keys? Roughly: private key, then public key (by elliptic-curve multiplication), then a hash of the public key, plus a checksum or format. Each step is one-way, so the address does not reveal the private key (Keys, Addresses and Wallets).

12. What happens if an ECDSA signer reuses a nonce? Two signatures with the same nonce let an attacker solve for the private key. This has caused real thefts, and it is why deterministic nonce generation (RFC 6979) is recommended (Elliptic Curves).

13. What is a seed phrase? A human-readable encoding of the entropy from which a hierarchical deterministic wallet derives all of its keys. Anyone who has it controls every derived account, so it is the real master secret.

Consensus and networks

14. What is the double-spend problem? Spending the same coin twice by showing different histories to different people. Digital cash needs a way for everyone to agree on one order of transactions (The Double-Spend Problem).

15. Explain proof of work. Miners search for a nonce so that the block hash is below a target. Finding it is costly and checking it is instant, so rewriting history requires redoing the work. The longest (most work) chain wins (Proof of Work and Mining).

16. How is difficulty adjusted? The target changes after a window of blocks (2,016 in Bitcoin) so the average block time stays near the goal, whatever the total hash power (Difficulty Adjustment).

17. What is a 51 percent attack, and what can it not do? An attacker with the majority of hash power can build a longer private chain, reverse their own recent payments and censor transactions. They cannot spend coins they have no key for or change protocol rules that full nodes enforce.

18. What causes a fork, and how is it resolved? Two valid blocks found at nearly the same time, because of network latency. Nodes follow the first they see, and the fork ends when one branch becomes longer; the other blocks become orphans or stale (Longest Chain Rule).

19. Proof of work vs proof of stake? Both make attacks expensive. PoW burns energy and hardware; PoS locks capital that can be slashed. PoS uses far less energy and can offer finality, but needs defences for nothing-at-stake and long-range attacks (Proof of Stake).

20. What is Byzantine fault tolerance, and what is the 3f+1 rule? A system is BFT when it works despite some nodes behaving arbitrarily or maliciously. Classic protocols need n of at least 3f+1 nodes to tolerate f faulty ones, with quorums of 2f+1 (BFT and Other Consensus).

21. How does Raft differ from blockchain consensus? Raft assumes nodes crash but never lie, and elects a leader. Blockchain consensus assumes some participants are malicious and unknown, so it needs signatures, economic cost or larger quorums.

22. What is the blockchain trilemma? The claim that it is hard to maximize decentralization, security and scalability at once. Layer 2 networks and rollups try to push throughput up without weakening the base layer (Scaling and Layer 2).

Smart contracts and security

23. What is a smart contract? Code stored on a chain that every node runs deterministically in response to transactions, keeping persistent state. It is neither "smart" nor a legal contract by itself (What Are Smart Contracts?).

24. Why is gas needed? Every node must run every contract. Gas meters each operation, so infinite loops run out of fuel and users pay for the resources they use (Ethereum in Practice).

25. UTXO or account model? UTXO (Bitcoin) tracks unspent outputs; each spend consumes whole outputs and creates new ones, which makes parallel validation and privacy easy. Accounts (Ethereum) keep balances and nonces, which makes contracts and state simpler (UTXO vs Account Model).

26. What is a reentrancy attack, and how do you prevent it? A contract sends funds to an attacker before updating its own balance, and the attacker's code calls back into the function. Prevent it with checks-effects-interactions (update state first), reentrancy guards and pull payments (Smart Contract Security Pitfalls).

Python
# vulnerable order (pseudo-model)
def withdraw(self, user):
    amount = self.balances[user]
    self.send(user, amount)        # external call first: the callee can re-enter
    self.balances[user] = 0        # state updated too late

# safe order: checks, effects, interactions
def withdraw(self, user):
    amount = self.balances[user]
    self.balances[user] = 0        # effect first
    self.send(user, amount)        # interaction last

27. Integer overflow in contracts today? Solidity 0.8 and later reverts on overflow by default, but code in unchecked blocks, older compilers and other languages can still overflow, and casts can silently truncate.

28. What is front-running (MEV)? Block producers and bots see pending transactions and insert, reorder or copy their own to profit, for example by buying before a large swap. Mitigations include private transaction pools, commit-reveal schemes and slippage limits.

29. What is the oracle problem? Contracts cannot read the outside world, so they depend on oracles that report prices or events. The chain can be perfectly secure while the data fed to it is wrong or manipulated, so use multiple sources, medians and time-weighted averages (dApps, Oracles and Wallet Integration).

30. Can a deployed contract be upgraded? The code is immutable, but a proxy contract can delegate calls to a replaceable implementation. That adds flexibility and a new trust assumption: whoever controls the upgrade key.

31. What is an ERC-20 allowance, and what is the risk? approve lets a spender move up to a set amount from your account. Unlimited approvals to a malicious or buggy contract can drain your balance, so approve only what is needed and revoke later (Tokens, ERC-20 and NFTs).

32. What audits and tests would you do before deploying? Unit and property tests, fuzzing, static analysis, a manual review focused on access control and external calls, a testnet run, a bug bounty, and a staged rollout with limits.

33. How do zero-knowledge proofs help? They prove a statement (a transaction is valid, a balance is sufficient) without revealing the underlying data. They are used for privacy and for compressing validity checks in zk-rollups (Privacy and Zero-Knowledge Proofs).

System design

34. Design a supply chain tracker. Define the life cycle and who may record each step. Store event hashes or Merkle roots on a consortium chain and keep the details off-chain. Add signed device data, and allow auditors to check events with Merkle proofs. Be clear that the chain cannot prove a physical event happened (Supply Chain Tracker).

35. Design an electronic voting system on a blockchain. Hard to do securely. You need voter identity, ballot secrecy, coercion resistance and a way to count that is verifiable without revealing votes. Zero-knowledge proofs and snapshots help, but client devices and identity remain the weak points. A good answer names those limits (On-Chain Voting).

36. How would you store large files for a dApp? Keep the file off-chain (content-addressed storage or a normal object store) and store only its hash on-chain. Anyone can fetch the file and compare the hash.

37. How does a dApp front end talk to the chain? Through a node's JSON-RPC interface. The wallet holds the keys and signs, the front end builds the transaction, and an indexer service reads events into a database for fast queries.

38. When should a company not use a blockchain? When one party is trusted, when the data must be deleted on request, when performance needs are high and participants are few, or when no one needs to verify the history independently. A decision checklist is in Enterprise and Real-World Uses.

39. How many confirmations are enough? It depends on the value at risk and the attacker's share. On Bitcoin, six confirmations is a common rule of thumb for large payments; small payments often accept fewer. On a chain with explicit finality, wait for finality.

40. How would you test your own toy blockchain? Check that tampering with any field breaks verification, that invalid transactions are rejected, that two nodes replaying the same blocks reach the same state, and that the fork-choice rule picks the same chain on every node (A Complete Mini Blockchain).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. An interviewer says "blockchains are immutable". What is the best answer?

    Hash links make edits detectable, and consensus makes rewriting costly, but the security is economic and social, not absolute.
  2. 2. How many nodes does a classic BFT protocol need to tolerate 2 faulty nodes?

    The rule is n of at least 3f+1. With f = 2, that is 7 nodes, and a quorum of 2f+1 = 5.
  3. 3. Which ordering prevents a classic reentrancy attack in a withdraw function?

    Checks-effects-interactions updates state before calling external code, so a re-entering call sees a zero balance.
  4. 4. A price oracle reports a manipulated price. What is the best defence?

    Diversifying sources and averaging over time makes manipulation more expensive and short spikes less effective.

Summary

  • Answer with fact, reason and limit; avoid absolute words like "immutable" and "trustless".
  • Know the cryptography basics: hashes, signatures, Merkle proofs, address derivation and nonce reuse.
  • Compare consensus mechanisms by their assumptions: who may join, which attackers they tolerate and what an attack costs.
  • For smart contracts, be ready to explain gas, the account and UTXO models, reentrancy, oracles, front-running and upgrades.
  • In design questions, say what goes on-chain, what stays off-chain, and when a normal database is the better answer.

Next: Blockchain Cheat Sheet, a one-page summary of terms, formulas and checklists.