Skip to content
  1. Home
  2. Interview Questions
  3. Blockchain
AI, ML & Blockchain

Blockchain Interview Questions and Answers (2026)

Industry-standard blockchain interview questions for blockchain developers, smart-contract engineers and Web3 architects — hashing and Merkle trees, Proof of Work and Proof of Stake, Ethereum and the EVM, Solidity, gas optimisation, reentrancy and other vulnerabilities, oracles, Layer 2 rollups, zero-knowledge proofs, DeFi, stablecoins, account abstraction, tokenisation and Hyperledger Fabric, with Solidity, Python and ethers.js code.

Updated November 2026 Reviewed by Abhishek Kumar 60 min read
50Questions
15Freshers
15Intermediate
14Experienced

Key takeaways

  • 50 Blockchain interview questions, grouped by level: freshers, intermediate, experienced and coding.
  • Every answer starts with a one-line “Quick answer” you can say out loud, followed by the explanation and runnable code.
  • Use the filter bar to practise only the level you are interviewing for, then test yourself with the free Blockchain quiz.

What is Blockchain, and why do interviewers ask about it?

A blockchain is a shared, append-only ledger maintained by a network of computers that agree on its state without a central authority. It underpins cryptocurrencies such as Bitcoin and Ethereum, smart contracts, decentralised finance (DeFi), stablecoins, tokenisation of real-world assets and supply-chain traceability.

These blockchain interview questions cover what blockchain developers, smart-contract engineers and Web3 architects are asked in 2026 — hashing and Merkle trees, consensus (Proof of Work, Proof of Stake, BFT), Ethereum and the EVM, Solidity smart contracts, gas, security vulnerabilities, Layer 2 rollups, oracles, wallets and account abstraction, and enterprise blockchains — with Solidity and Python code.

Why companies hire for Blockchain

  • Blockchain developer and smart-contract auditor roles remain well paid and specialised
  • Security knowledge is critical because exploits cost real money
  • Questions span cryptography, distributed systems and software engineering
  • Covers both public (Ethereum, L2s) and enterprise (Hyperledger Fabric) platforms

Basic Blockchain Interview Questions for Freshers

15 questions

Start here if you are a fresher or switching to Blockchain. These fundamentals are asked in almost every first-round and campus interview.

How interviewers ask it“Let's start with the basics — how would you explain blockchain?”

What is blockchain?

BeginnerBlockchain
Quick answerA blockchain is a distributed ledger made of blocks of transactions, where each block contains the cryptographic hash of the previous block, forming a chain. Many nodes keep a copy and use a consensus mechanism to agree on which blocks are valid. Changing a past block would change its hash and break every later link, so the history is tamper-evident, and with enough independent nodes it becomes practically immutable.

Key properties: decentralisation, transparency (on public chains), immutability, and trust through cryptography and economic incentives instead of a central party.

How interviewers ask it“In simple words, what is the structure of a block? Explain it like you would to a new teammate.”

What is the structure of a block?

BeginnerBlockchain
Quick answerA block typically contains a header and a body:
  • Header: previous block hash, Merkle root of the transactions, timestamp, and consensus fields (nonce and difficulty in Proof of Work; slot, proposer and state root in Ethereum)
  • Body: the list of transactions

The block's own hash is computed from its header, so any change to the transactions changes the Merkle root, then the header hash, and breaks the chain.

BeginnerBlockchain
Quick answerA hash function (such as SHA-256 in Bitcoin or Keccak-256 in Ethereum) maps any input to a fixed-size output. Required properties: deterministic, fast to compute, pre-image resistant (you can't recover the input from the hash), collision resistant (you can't find two inputs with the same hash) and the avalanche effect (a tiny input change changes the output completely). Blockchains use hashes to link blocks, build Merkle trees, derive addresses and run Proof of Work.
BeginnerBlockchain
Quick answerA Merkle tree hashes transactions in pairs, level by level, up to a single Merkle root stored in the block header. It lets anyone prove a transaction is in a block with a Merkle proof of only log₂(n) hashes, without downloading the whole block — this is how light clients (SPV) work. Ethereum uses a variant (Merkle Patricia Tries) for its state, transactions and receipts.
BeginnerBlockchain
  • Public (permissionless): anyone can read, transact and validate — Bitcoin, Ethereum. Most decentralised and censorship-resistant, but transactions are public and throughput is limited.
  • Private (permissioned): one organisation controls who participates — faster and private, but closer to a shared database.
  • Consortium: a group of organisations shares control — for example banks or supply-chain partners on Hyperledger Fabric or R3 Corda.

How interviewers ask it“In simple words, what is a consensus mechanism? Explain it like you would to a new teammate.”

What is a consensus mechanism?

BeginnerBlockchain
Quick answerConsensus is how a decentralised network agrees on the next valid block and a single history despite faulty or malicious nodes. It must handle Sybil attacks (fake identities) and double-spending. Main families: Proof of Work (computational cost), Proof of Stake (economic stake that can be slashed) and BFT-style protocols (voting among known validators, as in Tendermint/CometBFT, used by permissioned networks and many PoS chains).

How interviewers ask it“How does Proof of Work work under the hood? Take me through it step by step.”

How does Proof of Work work?

BeginnerBlockchain
Quick answerMiners repeatedly change a nonce and hash the block header until the hash is below a difficulty target — expensive to find but trivial to verify. The first valid block is broadcast, and nodes follow the chain with the most accumulated work. Rewriting history would require redoing the work faster than the honest majority (a 51% attack). Bitcoin uses PoW; its drawbacks are high energy use and limited throughput.

How interviewers ask it“How does Proof of Stake work under the hood? Take me through it step by step.”

How does Proof of Stake work?

BeginnerBlockchain
Quick answerValidators lock (stake) tokens as collateral; the protocol selects validators to propose and attest to blocks, roughly in proportion to their stake. Honest behaviour earns rewards; provably malicious behaviour (double-signing) is punished by slashing part of the stake. Ethereum moved to PoS in "the Merge" (2022), cutting its energy use by about 99.95%. PoS adds concerns such as stake concentration and long-range attacks, addressed with finality checkpoints and weak-subjectivity sync.
BeginnerBlockchain
Quick answerA wallet manages key pairs. The private key signs transactions and must be kept secret; the public key is derived from it (elliptic-curve cryptography, secp256k1 for Bitcoin and Ethereum); the address is derived from the public key's hash. Wallets don't hold coins — balances live on the blockchain — they hold keys. Types: hot (software) vs cold (hardware), custodial vs non-custodial, and HD wallets that derive many keys from one seed phrase (BIP-32/39/44).

How interviewers ask it“Let's start with the basics — how would you explain a smart contract?”

What is a smart contract?

BeginnerBlockchain
Quick answerA smart contract is a program deployed on a blockchain that runs deterministically on every node and enforces rules automatically — for example, releasing funds when conditions are met. On Ethereum, contracts are usually written in Solidity (or Vyper), compiled to EVM bytecode and deployed to an address; anyone can call their public functions by sending transactions. Once deployed, code is immutable unless an upgrade pattern was built in, so bugs can be very costly.
BeginnerBlockchain
Quick answerBitcoin is focused on being digital money with a deliberately limited scripting language and a UTXO model. Ethereum is a programmable blockchain: it runs a Turing-complete virtual machine (the EVM), uses an account-based model, supports smart contracts and tokens, has gas-based fees, and secures itself with Proof of Stake. It is the base layer for most DeFi, NFTs, stablecoins and Layer 2 rollups.

How interviewers ask it“In simple words, what is gas in Ethereum? Explain it like you would to a new teammate.”

What is gas in Ethereum?

BeginnerBlockchain
Quick answerGas measures the computational work an operation needs; every EVM opcode has a gas cost, which prevents infinite loops and spam. Fees = gas used × (base fee + priority fee) under EIP-1559 — the base fee is burned and adjusts with demand; the priority fee (tip) goes to the validator. Users set a gas limit; if execution runs out of gas, the transaction reverts but the fee is still paid. Gas-optimised code matters because users pay for every operation.
BeginnerBlockchain
  • UTXO (Bitcoin, Cardano): coins are unspent transaction outputs; a transaction consumes UTXOs and creates new ones. It offers better privacy patterns and parallel validation but makes complex state harder.
  • Account model (Ethereum): each account has a balance, a nonce and (for contracts) code and storage; transactions modify the state directly — simpler for smart contracts, but needs nonces for replay protection and is harder to parallelise.
BeginnerBlockchain
Quick answerTokens are assets created by smart contracts that follow standard interfaces:
  • ERC-20: fungible tokens (stablecoins such as USDC, governance tokens) — transfer, approve, transferFrom, balanceOf
  • ERC-721: non-fungible tokens (NFTs), each with a unique ID — tickets, certificates, digital collectibles
  • ERC-1155: multi-token standard for fungible and non-fungible tokens in one contract, with batch transfers — popular in games

Standards let wallets, exchanges and dApps support any compliant token automatically.

BeginnerBlockchain
Quick answerDouble-spending is trying to spend the same digital money twice. Blockchains prevent it by recording every transaction in a single, consensus-agreed order: once a transaction spending some funds is included, a conflicting one is invalid. The remaining risk is a chain reorganisation replacing the block, which is why merchants wait for confirmations (PoW) or finality (Ethereum PoS finalises in about two epochs, roughly 13 minutes).

Intermediate Blockchain Interview Questions

15 questions

Questions for candidates with 1–3 years of experience — the concepts interviewers use to check that you have actually built things with Blockchain.

How interviewers ask it“How would you explain the Ethereum Virtual Machine (EVM) to a junior engineer, and what do people most often get wrong?”

What is the Ethereum Virtual Machine (EVM)?

IntermediateBlockchain
Quick answerThe EVM is a stack-based, deterministic virtual machine that executes contract bytecode on every Ethereum node. It has volatile memory, persistent storage (key-value per contract, expensive to write), calldata for read-only inputs, and a gas meter. Many chains are EVM-compatible (Polygon, BNB Chain, Avalanche C-Chain, Arbitrum, Optimism, Base), so Solidity contracts and tooling work across them.
IntermediateBlockchain
  • storage: persistent contract state on the blockchain; the most expensive to write (around 20,000 gas for a new non-zero slot)
  • memory: temporary, exists only during a function call; cheaper
  • calldata: read-only function input data for external calls; the cheapest for arrays and strings you don't modify

Choosing the right location is a common gas optimisation and a frequent interview question.

IntermediateBlockchain
Quick answerReentrancy happens when a contract makes an external call (for example sending ETH) before updating its own state, and the receiving contract calls back into the function to withdraw again. The 2016 DAO hack used it. Prevention:
  • Checks-Effects-Interactions: validate, update state, then make external calls
  • Reentrancy guards (OpenZeppelin ReentrancyGuard, nonReentrant)
  • Pull payments instead of pushing funds
Solidity
function withdraw() external nonReentrant {
    uint256 amount = balances[msg.sender];
    require(amount > 0, "nothing to withdraw");
    balances[msg.sender] = 0;                         // effect first
    (bool ok, ) = msg.sender.call{value: amount}(""); // interaction last
    require(ok, "transfer failed");
}

How interviewers ask it“Walk me through the most common smart contract vulnerabilities. Where do they come up in real systems?”

What are the most common smart contract vulnerabilities?

IntermediateBlockchain
  • Reentrancy
  • Access-control mistakes (missing onlyOwner, unprotected initialisers)
  • Oracle and price manipulation (often with flash loans)
  • Integer overflow (checked by default since Solidity 0.8, but unchecked blocks and casts still matter)
  • Front-running / MEV (transaction-ordering dependence)
  • Unchecked return values from low-level calls
  • tx.origin used for authentication
  • Denial of service through unbounded loops
  • Signature replay and malleability
  • Upgradeable proxy storage collisions
  • Business-logic flaws

Mitigate with audits, OpenZeppelin libraries, fuzzing and invariant tests, and static analysis (Slither).

IntermediateBlockchain
Quick answerBlockchains can't fetch off-chain data (prices, weather, sports results) by themselves. Oracles bring external data on-chain — for example Chainlink price feeds. The oracle problem is trust: a single compromised or manipulated data source can break a "trustless" contract. Solutions: decentralised oracle networks that aggregate many sources, time-weighted average prices (TWAPs), circuit breakers and sanity checks on price movements.
IntermediateBlockchain
Quick answerLayer 2s execute transactions off the main chain (Layer 1) and post compressed data and proofs back to it, inheriting much of its security while increasing throughput and cutting fees.
  • Optimistic rollups (Arbitrum, Optimism, Base) assume batches are valid and allow a challenge period (about 7 days) for fraud proofs, so withdrawals to L1 are slow
  • ZK rollups (zkSync, Starknet, Scroll, Linea, Polygon zkEVM) post validity proofs (zero-knowledge proofs), giving fast finality but more complex proving

Ethereum's EIP-4844 "blobs" (2024) made rollup data much cheaper.

How interviewers ask it“How would you explain a zero-knowledge proof to a junior engineer, and what do people most often get wrong?”

What is a zero-knowledge proof?

IntermediateBlockchain
Quick answerA zero-knowledge proof lets a prover convince a verifier that a statement is true without revealing why — for example, that a transaction batch was executed correctly, or that a user is over 18, without revealing other data. Properties: completeness, soundness and zero-knowledge. zk-SNARKs have small proofs and fast verification (some need a trusted setup); zk-STARKs need no trusted setup and are post-quantum friendly but have larger proofs. Uses: ZK rollups, private transactions and identity.
IntermediateBlockchain
Quick answerDecentralised finance recreates financial services — exchanges, lending, derivatives, stablecoins — with smart contracts instead of intermediaries. An Automated Market Maker (AMM) such as Uniswap replaces an order book with a liquidity pool of two tokens priced by a formula like x · y = k. Liquidity providers earn fees but face impermanent loss; traders face slippage. Lending protocols (Aave, Compound) use over-collateralised loans with automatic liquidation.
IntermediateBlockchain
Quick answerStablecoins are tokens designed to keep a stable value, usually $1:
  • Fiat-backed (USDC, USDT): reserves of cash and short-term government bonds held by an issuer — increasingly regulated (for example under the EU's MiCA and the US GENIUS Act of 2025)
  • Crypto-collateralised (DAI/USDS): over-collateralised by crypto assets, with liquidations
  • Algorithmic: supply adjusts algorithmically — the 2022 TerraUSD collapse showed how fragile this can be

Interviewers often ask about reserve transparency, de-peg risk and the regulatory status of stablecoins.

How interviewers ask it“Explain MEV (Maximal Extractable Value) in detail — what should a new team member understand about it?”

What is MEV (Maximal Extractable Value)?

IntermediateBlockchain
Quick answerMEV is the profit that block builders, validators or searchers can extract by including, excluding or reordering transactions — for example front-running and sandwich attacks on large DEX trades, arbitrage and liquidations. It harms users through worse prices. Mitigations: slippage limits, private transaction relays (such as Flashbots Protect), batch auctions (CoW Swap), commit-reveal schemes, and proposer-builder separation research.

How interviewers ask it“How would you explain a proxy pattern for upgradeable contracts to a junior engineer, and what do people most often get wrong?”

What is a proxy pattern for upgradeable contracts?

IntermediateBlockchain
Quick answerBecause deployed code is immutable, upgradeable contracts split into a proxy (which holds the storage and address users interact with) and an implementation (the logic), with the proxy forwarding calls through delegatecall. Upgrading means pointing the proxy to a new implementation. Common standards: Transparent proxy, UUPS (ERC-1822/1967) and the Diamond pattern (EIP-2535). Risks: storage-layout collisions, unprotected initialisers, and centralised upgrade keys — use timelocks and multisigs.

How interviewers ask it“How would you explain a DAO to a junior engineer, and what do people most often get wrong?”

What is a DAO?

IntermediateBlockchain
Quick answerA DAO (decentralised autonomous organisation) is governed by rules encoded in smart contracts: token holders propose and vote, and approved proposals execute on-chain (often after a timelock) — managing treasuries, protocol parameters and upgrades. Challenges include low voter turnout, whale concentration, governance attacks (borrowing tokens to vote), and unclear legal status in many jurisdictions.

How interviewers ask it“Walk me through account abstraction (ERC-4337). Where does it come up in real systems?”

What is account abstraction (ERC-4337)?

IntermediateBlockchain
Quick answerAccount abstraction makes user accounts smart-contract wallets instead of plain key pairs, enabling features such as social recovery, multisig, spending limits, session keys, batching several actions in one transaction, and gas sponsorship (paymasters pay fees, or users pay in stablecoins). ERC-4337 introduced it without consensus changes, using "UserOperations" and bundlers; EIP-7702 (Pectra upgrade, 2025) lets ordinary accounts temporarily delegate to smart-contract code. It is key to mainstream-friendly Web3 user experience.

How interviewers ask it“Walk me through the blockchain trilemma. Where does it come up in real systems?”

What is the blockchain trilemma?

IntermediateBlockchain
Quick answerThe trilemma, popularised by Vitalik Buterin, says it is hard for a blockchain to maximise decentralisation, security and scalability at the same time with a simple design — raising throughput by using fewer, more powerful nodes reduces decentralisation, for example. Modern approaches tackle it with modular designs: a secure, decentralised base layer for settlement and data availability, and rollups for execution.
IntermediateBlockchain
Quick answerBridges move assets or messages between blockchains, typically by locking tokens on one chain and minting wrapped tokens on another, verified by a validator set, light clients or proofs. They hold large pools of value and have complex trust assumptions, making them prime targets — the Ronin (about $625M) and Wormhole (about $320M) hacks in 2022 came from compromised keys and verification bugs. Safer designs use light-client or ZK verification, rate limits and well-reviewed messaging protocols.

Advanced Blockchain Interview Questions for Experienced Developers

14 questions

Senior-level Blockchain questions on internals, performance, design and trade-offs — typical for 3, 5 and 7+ years of experience.

How interviewers ask it“Suppose you need to audit and test a smart contract — how do you approach it, and what can go wrong?”

How do you audit and test a smart contract?

AdvancedBlockchain
  • Unit and integration tests with Foundry or Hardhat, including failure paths
  • Fuzzing and invariant testing (Foundry, Echidna) — "total supply equals the sum of balances"
  • Static analysis (Slither, Aderyn) and formal verification for critical logic (Certora, Halmos)
  • Mainnet-fork testing against real protocols and prices
  • Manual review of access control, external calls, oracle use and upgrade paths
  • External audits, bug bounties (Immunefi) and gradual rollout with caps and pause switches

How interviewers ask it“How would you optimise gas in Solidity? Walk me through your approach.”

How do you optimise gas in Solidity?

AdvancedBlockchain
  • Minimise storage writes (cache storage reads in memory variables)
  • Pack variables smaller than 32 bytes into the same slot
  • Use calldata for read-only external inputs, and immutable/constant for fixed values
  • Use custom errors instead of revert strings
  • Use events instead of storage for data only needed off-chain
  • Avoid unbounded loops and use mappings instead of array searches
  • Use unchecked only where overflow is impossible
  • Measure with gas reports and snapshots
AdvancedBlockchain
Quick answerHyperledger Fabric is a permissioned enterprise blockchain framework. Participants have known identities issued by a Membership Service Provider; transactions follow an execute-order-validate flow (endorsing peers simulate chaincode, an ordering service sequences transactions, peers validate them against endorsement policies); channels and private data collections keep data confidential between parties; and chaincode is written in Go, Java or JavaScript. There is no native cryptocurrency or gas, and it offers higher throughput — suited to supply chains, trade finance and consortia.

How interviewers ask it“Suppose you need to design a supply-chain traceability system — how do you approach it, and what can go wrong?”

How would you design a supply-chain traceability system with blockchain?

AdvancedBlockchain
  • Participants: manufacturers, logistics companies, distributors, retailers and regulators — a permissioned/consortium network (Hyperledger Fabric or an enterprise EVM chain)
  • On-chain: hashes and key events (batch created, shipped, inspected, received) with signatures, timestamps and certificate references
  • Off-chain: documents and large data in storage systems or IPFS, with hashes recorded on-chain
  • Data capture: IoT sensors, QR or RFID tags, ERP integrations — and the "garbage in" problem addressed with trusted devices and audits
  • Access control: private channels for commercial data
  • Value: recalls, authenticity checks, compliance — while asking honestly whether a shared database would be enough
AdvancedBlockchain
Quick answerWhen there is a single trusted party, no need for multiple mutually distrustful writers, a need for high throughput and low latency, data that must be deleted (GDPR or DPDP "right to erasure" conflicts with immutability), or when the data's truth depends on off-chain inputs that the chain can't verify. In those cases a conventional database with audit logs, signatures or a verifiable log is simpler, cheaper and faster. Interviewers value this honest judgement.

How interviewers ask it“Walk me through tokenisation of real-world assets (RWA). Where does it come up in real systems?”

What is tokenisation of real-world assets (RWA)?

AdvancedBlockchain
Quick answerTokenisation represents ownership of real-world assets — government bonds, money-market funds, real estate, private credit, invoices, carbon credits — as tokens on a blockchain. Benefits: fractional ownership, faster (even 24/7) settlement, programmability and transparency. Challenges: legal enforceability of on-chain ownership, KYC/AML and transfer restrictions (permissioned token standards such as ERC-3643), custody, reliable oracles for valuations, and regulatory compliance. Large asset managers have launched tokenised funds, making RWA one of the most active areas in 2026.
AdvancedBlockchain
Quick answerFinality is the guarantee that a confirmed transaction can't be reversed. Probabilistic finality (Bitcoin PoW): the risk of reversal drops with every additional block, so you wait for confirmations (often six). Economic finality (Ethereum PoS): after two epochs (about 13 minutes) a checkpoint is finalised, and reversing it would require slashing at least one-third of the staked ETH. Instant/deterministic finality (BFT chains such as CometBFT-based networks): a block is final once committed. Exchanges and bridges set confirmation requirements based on these properties.

How interviewers ask it“Walk me through a 51% attack. Where does it come up in real systems?”

What is a 51% attack?

AdvancedBlockchain
Quick answerIn Proof of Work, an entity controlling more than half the network's hash rate can mine a private chain faster than everyone else and publish it to reorganise recent blocks, enabling double-spends and censorship — though it can't steal keys or create coins out of nothing. Smaller PoW chains (Ethereum Classic, Bitcoin Gold) have suffered such attacks. In PoS, the equivalent requires controlling large amounts of stake, which can be slashed — making attacks extremely expensive.

How interviewers ask it“Walk me through the main differences between Solana and Ethereum. Where do they come up in real systems?”

What are the main differences between Solana and Ethereum?

AdvancedBlockchain
Quick answerSolana is a high-throughput monolithic Layer 1: Proof of Stake with Proof of History for ordering, parallel transaction execution (Sealevel) because transactions declare which accounts they touch, programs written in Rust (often with the Anchor framework), and very low fees — at the cost of high hardware requirements for validators and past outages. Ethereum prioritises decentralisation on Layer 1 and scales through rollups, using the EVM and Solidity. Both are important in 2026; many teams build on several chains.

How interviewers ask it“Suppose you need to securely manage private keys in production systems — how do you approach it, and what can go wrong?”

How do you securely manage private keys in production systems?

AdvancedBlockchain
Quick answerNever keep plaintext keys in code or config. Use hardware security modules (HSMs) or cloud KMS, multisig wallets (for example Safe) for treasuries and admin roles, MPC (multi-party computation) wallets that split key material between parties, role-separated keys with spending limits, timelocks on sensitive actions, and secure offline backups of seed phrases. Monitor transactions and rotate keys when people leave. Many major hacks have been key compromises rather than smart-contract bugs.

How interviewers ask it“Why would you use IPFS and decentralised storage? What problem does it solve?”

What is the role of IPFS and decentralised storage?

AdvancedBlockchain
Quick answerBlockchains are too expensive for large files, so DApps store files in content-addressed systems such as IPFS, where a file is identified by the hash of its content (a CID), and record only the CID on-chain — any change to the content changes the CID. IPFS doesn't guarantee persistence by itself, so files must be pinned (by the project or pinning services); Filecoin and Arweave add economic incentives for long-term storage. NFT metadata and DApp front-ends commonly use them.
AdvancedBlockchain
Quick answerA CBDC is a digital form of a country's fiat money issued and controlled by its central bank — for example India's e-Rupee pilots by the RBI. Unlike cryptocurrencies, it is centralised, legal tender, and not volatile; it may use distributed-ledger technology but usually in a permissioned way. Design questions include privacy, offline payments, interoperability with payment systems such as UPI, and its effect on bank deposits.
AdvancedBlockchain
Quick answerEvents are emitted by contracts and stored in transaction logs (receipts), not in contract storage. They are far cheaper than storage, can't be read by contracts, but are easy for off-chain applications to subscribe to and index (via eth_getLogs, ethers.js listeners or indexers such as The Graph). Up to three parameters can be indexed for filtering. Use them for transfers, state changes and audit trails that front-ends and analytics need.
Solidity
event OrderPaid(uint256 indexed orderId, address indexed buyer, uint256 amount);
emit OrderPaid(orderId, msg.sender, msg.value);
AdvancedBlockchain
  • call: executes code in the target contract's context (its storage, msg.sender = the caller contract); can send ETH
  • delegatecall: executes the target's code in the caller's context (the caller's storage, msg.sender and msg.value preserved) — the basis of proxies and libraries, and dangerous with untrusted targets (the Parity wallet hack)
  • staticcall: like call but reverts on any state change — used for view calls

Blockchain Coding Interview Questions (Programs with Code)

6 questions

Hands-on Blockchain programs that are asked in coding rounds and machine tests. Read the code, then try writing it yourself without looking.

CodingBlockchain
Quick answerEach block stores the previous block's hash; mining searches for a nonce that gives a hash with the required number of leading zeros, and validation re-checks every link.
Python
import hashlib, json, time

class Blockchain:
    def __init__(self, difficulty=4):
        self.difficulty, self.chain = difficulty, []
        self.add_block([], prev_hash="0" * 64)               # genesis block

    @staticmethod
    def hash_block(block):
        return hashlib.sha256(json.dumps(block, sort_keys=True).encode()).hexdigest()

    def add_block(self, transactions, prev_hash=None):
        block = {"index": len(self.chain), "time": time.time(), "tx": transactions,
                 "prev": prev_hash or self.hash_block(self.chain[-1]), "nonce": 0}
        while not self.hash_block(block).startswith("0" * self.difficulty):
            block["nonce"] += 1                                # proof of work
        self.chain.append(block)
        return block

    def is_valid(self):
        for prev, cur in zip(self.chain, self.chain[1:]):
            if cur["prev"] != self.hash_block(prev):
                return False
            if not self.hash_block(cur).startswith("0" * self.difficulty):
                return False
        return True

bc = Blockchain()
bc.add_block([{"from": "A", "to": "B", "amount": 5}])
print(bc.is_valid())                 # True
bc.chain[1]["tx"][0]["amount"] = 500
print(bc.is_valid())                 # False — tampering detected
CodingBlockchain
Quick answerHash leaves, combine pairs level by level (duplicating the last node on odd levels), and verify a proof by rehashing up to the root.
Python
import hashlib

def h(x: bytes) -> bytes:
    return hashlib.sha256(x).digest()

def merkle_root(leaves: list[bytes]) -> bytes:
    level = [h(l) for l in leaves]
    while len(level) > 1:
        if len(level) % 2:
            level.append(level[-1])
        level = [h(level[i] + level[i + 1]) for i in range(0, len(level), 2)]
    return level[0]

def verify(leaf: bytes, proof: list[tuple[bytes, str]], root: bytes) -> bool:
    node = h(leaf)
    for sibling, side in proof:          # side = "L" if sibling is on the left
        node = h(sibling + node) if side == "L" else h(node + sibling)
    return node == root
CodingBlockchain
Quick answerInherit the audited implementation instead of writing token logic from scratch.
Solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

contract PitchToken is ERC20, Ownable {
    uint256 public constant MAX_SUPPLY = 10_000_000 ether;

    constructor(address initialOwner) ERC20("Pitch Token", "PITCH") Ownable(initialOwner) {
        _mint(initialOwner, 1_000_000 ether);
    }

    function mint(address to, uint256 amount) external onlyOwner {
        require(totalSupply() + amount <= MAX_SUPPLY, "cap exceeded");
        _mint(to, amount);
    }
}
CodingBlockchain
Quick answerThe buyer deposits funds; the buyer releases them to the seller, or an arbiter refunds the buyer. State is updated before transferring ETH.
Solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

contract Escrow {
    enum State { AwaitingPayment, AwaitingDelivery, Complete, Refunded }
    address public immutable buyer;
    address payable public immutable seller;
    address public immutable arbiter;
    State public state;

    error Unauthorized();
    error WrongState();

    constructor(address payable _seller, address _arbiter) {
        buyer = msg.sender; seller = _seller; arbiter = _arbiter;
    }

    function deposit() external payable {
        if (msg.sender != buyer) revert Unauthorized();
        if (state != State.AwaitingPayment || msg.value == 0) revert WrongState();
        state = State.AwaitingDelivery;
    }

    function release() external {
        if (msg.sender != buyer && msg.sender != arbiter) revert Unauthorized();
        if (state != State.AwaitingDelivery) revert WrongState();
        state = State.Complete;                                   // effect before interaction
        (bool ok, ) = seller.call{value: address(this).balance}("");
        require(ok, "transfer failed");
    }

    function refund() external {
        if (msg.sender != arbiter) revert Unauthorized();
        if (state != State.AwaitingDelivery) revert WrongState();
        state = State.Refunded;
        (bool ok, ) = payable(buyer).call{value: address(this).balance}("");
        require(ok, "refund failed");
    }
}
CodingBlockchain
Quick answerFoundry tests are written in Solidity; vm.prank impersonates accounts and vm.expectRevert checks failures.
Solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {Test} from "forge-std/Test.sol";
import {Escrow} from "../src/Escrow.sol";

contract EscrowTest is Test {
    Escrow escrow;
    address buyer = address(0xB0B);
    address payable seller = payable(address(0x5E11));
    address arbiter = address(0xA7B);

    function setUp() public {
        vm.prank(buyer);
        escrow = new Escrow(seller, arbiter);
        vm.deal(buyer, 10 ether);
    }

    function test_ReleasePaysSeller() public {
        vm.prank(buyer); escrow.deposit{value: 1 ether}();
        vm.prank(buyer); escrow.release();
        assertEq(seller.balance, 1 ether);
    }

    function test_StrangerCannotRelease() public {
        vm.prank(buyer); escrow.deposit{value: 1 ether}();
        vm.expectRevert(Escrow.Unauthorized.selector);
        escrow.release();
    }
}
CodingBlockchain
Quick answerUse a provider for reads and a signer (wallet) for writes; wait for the receipt.
JavaScript
import { ethers } from "ethers";   // v6

const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);   // keep keys in a KMS in production
const abi = ["function balanceOf(address) view returns (uint256)",
             "function transfer(address to, uint256 amount) returns (bool)",
             "function decimals() view returns (uint8)"];
const token = new ethers.Contract(process.env.TOKEN, abi, wallet);

const decimals = await token.decimals();
console.log("balance:", ethers.formatUnits(await token.balanceOf(wallet.address), decimals));

const tx = await token.transfer("0xRecipientAddress...", ethers.parseUnits("10", decimals));
const receipt = await tx.wait();
console.log("mined in block", receipt.blockNumber);

Practise with the free Blockchain quiz

Multiple-choice questions with instant feedback. Takes about 10 minutes and shows exactly which concepts to revise.

Start the Blockchain quiz →

Blockchain interview FAQ

What skills are needed for a blockchain developer job?
Cryptography basics, distributed systems and consensus, Ethereum and the EVM, Solidity (and often Rust for Solana or Move), development tools such as Foundry or Hardhat, smart-contract security, web3 libraries (ethers.js, viem, web3.py), and familiarity with Layer 2 networks, oracles and wallets.
Is blockchain still in demand in 2026?
Yes, in focused areas: stablecoins and payments, tokenisation of real-world assets, DeFi infrastructure, Layer 2 scaling, smart-contract security auditing and enterprise traceability. Employers want engineers who understand security and real use cases rather than hype.
What is the difference between blockchain and Bitcoin?
Bitcoin is a cryptocurrency and the first application of blockchain. Blockchain is the underlying technology — a distributed, tamper-evident ledger — used by many networks and applications, including Ethereum smart contracts and enterprise ledgers.
AK
Written and reviewed by Abhishek Kumar
Founder, InterviewPitch · 10+ years in IT. Questions are collected from real interview rounds and refreshed regularly. Spotted an error? Tell us.