Skip to content

Easy Blockchain Interview Questions

61 easy questions with answers. Definitions and fundamentals every candidate must answer quickly and correctly.

Topics in the easy set

Ethereum and the EVM: 9 dApp Development: 9 Blockchain Fundamentals: 8 Cryptography for Blockchain: 8 Solidity Programming: 8 DeFi, Tokens and NFTs: 8 Consensus and Scaling: 6 Smart Contract Security: 5
Solved — easyStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

What is a blockchain?

Save to ▾
Show answer
A blockchain is a distributed, append-only ledger where records are grouped into blocks and each block stores the hash of the previous block, forming a chain. Many independent nodes keep a copy and agree on new blocks through a consensus protocol, so no single party controls the data. Changing an old block would change its hash and break every later link, which makes tampering easy to detect. Bitcoin and Ethereum are the best known public examples.
02

How is a blockchain different from a traditional database?

Save to ▾
Show answer
A traditional database is controlled by one administrator who can create, update and delete rows, and trust comes from that owner. A blockchain is shared by many parties, is append-only, and trust comes from cryptography and consensus. The trade-off is performance: a database handles thousands of writes per second with low latency, while a public chain is slower and costlier. Use a blockchain only when several parties who do not fully trust each other must share one record.
03

What does a block contain and what is inside a block header?

Save to ▾
Show answer
A block has a header and a body. The body holds the list of transactions. The header holds metadata: the previous block hash, a timestamp, the Merkle root (or state and transaction roots in Ethereum) summarising the transactions, and consensus fields such as the difficulty target and nonce in Bitcoin. Because the header commits to all transactions through the root hash, nodes can verify a block's integrity by hashing just the header.
04

Explain public, private and consortium blockchains.

Save to ▾
Show answer
A public blockchain such as Bitcoin or Ethereum lets anyone read, transact and run a validator. A private blockchain is run by one organisation that controls who joins, useful for internal audit trails. A consortium (permissioned) blockchain is governed by a group of organisations, for example several banks sharing trade-finance data on Hyperledger Fabric. Public chains give maximum decentralisation; permissioned chains give privacy, known identities and higher throughput.
05

How does a blockchain achieve immutability?

Save to ▾
Show answer
Immutability comes from hash linking plus consensus. Each block includes the previous block's hash, so editing a past transaction changes that block's hash and every block after it. An attacker would have to redo the work or stake for all those blocks faster than the honest network, which is economically impractical on a large chain. Strictly it is tamper-evident and practically immutable rather than impossible to change; a hard fork by social agreement can still rewrite history.
06

You open a transaction on a block explorer. Which fields do you check and what do they mean?

Save to ▾
Show answer
Check the status (success or failed), the block number and confirmations, from and to addresses, and the value transferred. For contract calls, check the decoded input data and emitted event logs, which show token transfers. Check the gas limit, gas used and effective gas price, which together give the fee paid, plus the nonce. If the status failed, the revert reason tells you why, while fees are still charged for gas used.
07

How would you set up a local blockchain for development and testing?

Save to ▾
Show answer
For EVM work, run a local node with Anvil from Foundry or the Hardhat network. Each gives about ten pre-funded test accounts, instant mining and console logging. You can fork mainnet at a given block to test against real contracts and balances without spending money. For integration tests, deploy to a public testnet such as Sepolia, using faucet ETH. Keep deploy scripts and RPC URLs in config so the same code targets local, testnet and mainnet.
08

Why do you want to build a career in blockchain?

Save to ▾
Show answer
Use a specific, sincere answer. For example: I first got interested when I built a small token contract in college and saw that code could hold and move value without a middleman. Since then I have completed Solidity projects, learnt Foundry testing and read audit reports. I like that the field mixes cryptography, distributed systems and finance. I want to grow as a smart contract developer and help build secure, real-world applications such as payments, tokenisation or supply chain.
09

What is a cryptographic hash function and what properties must it have?

Save to ▾
Show answer
A hash function maps any input to a fixed-size output, such as 256 bits. For blockchain it must be deterministic, fast to compute, pre-image resistant (you cannot find the input from the hash), second pre-image resistant, and collision resistant (finding two inputs with the same hash is infeasible). It should also show the avalanche effect, where a one-bit change gives a completely different hash. Blocks, addresses, Merkle trees and proof of work all depend on these properties.
10

How is public-key cryptography used in blockchain?

Save to ▾
Show answer
Each user has a private key, kept secret, and a public key derived from it. The private key signs transactions, and anyone can verify the signature with the public key, proving the owner authorised the transfer without revealing the private key. Addresses are derived from public keys. Because control of funds equals control of the private key, losing it means losing access, and leaking it means anyone can spend the funds.
11

What is a digital signature and what does it guarantee?

Save to ▾
Show answer
A digital signature is a value produced by signing a message hash with a private key. Anyone with the public key can verify it. It guarantees authentication (the holder of the key signed it), integrity (the message was not changed, since any change breaks verification) and non-repudiation (the signer cannot later deny it). In blockchain, every transaction is signed, so nodes accept a transfer only if the signature matches the sending account.
12

What is a nonce in blockchain? Explain both common meanings.

Save to ▾
Show answer
In proof of work, the nonce is a number miners change repeatedly in the block header until the header hash falls below the difficulty target. In Ethereum's account model, the account nonce is a counter of transactions sent from an address; each transaction must use the next nonce, which orders transactions and prevents replay. A stuck transaction with a low nonce blocks all later ones from that account until it is mined or replaced.
13

What is a hash collision and why does it matter for blockchains?

Save to ▾
Show answer
A collision is when two different inputs produce the same hash. If attackers could find collisions, they could swap one transaction or block for another with the same hash and break integrity, Merkle proofs and address uniqueness. For SHA-256 and Keccak-256, finding a collision needs about 2^128 work, which is infeasible. This is why older broken hashes such as MD5 and SHA-1 must never be used in blockchain systems.
14

A user lost their private key and seed phrase. Can you recover their funds?

Save to ▾
Show answer
No. In a self-custody wallet, nobody, including the developer, can recover a lost private key; deriving it from the address is computationally impossible. If they still have the seed phrase, the wallet can be restored on any compatible app. To reduce future risk, suggest a hardware wallet, a written seed phrase stored in two safe locations, or a smart contract wallet with social recovery or passkeys, where trusted guardians can rotate the signing key.
15

How do you compute a keccak256 hash in Solidity and in ethers.js?

Save to ▾
Show answer
Solidity: bytes32 h1 = keccak256(abi.encodePacked('hello')); bytes32 h2 = keccak256(abi.encode(addr, amount)); ethers v6: import { keccak256, toUtf8Bytes, solidityPackedKeccak256 } from 'ethers'; const h = keccak256(toUtf8Bytes('hello')); const p = solidityPackedKeccak256(['address','uint256'], [addr, amount]); Prefer abi.encode over abi.encodePacked when hashing several dynamic values, because packed encoding can cause collisions.
16

How do you keep up with security and cryptography developments in Web3?

Save to ▾
Show answer
I follow a routine. Weekly I read new audit reports and post-mortems of exploits, and I try to reproduce one in Foundry. I track Ethereum Improvement Proposals and upgrade notes, read Solidity release notes, and practise on capture-the-flag platforms such as Ethernaut and Damn Vulnerable DeFi. I also keep a personal notes file of attack patterns. This keeps my knowledge practical rather than just theoretical, and I share summaries with my team.
17

What is a consensus mechanism and why does a blockchain need one?

Save to ▾
Show answer
A consensus mechanism is the set of rules that lets thousands of independent nodes agree on one order of transactions and one current state, even when some nodes are faulty or malicious. Without it, two nodes could accept conflicting transactions and double spending would be possible. Common mechanisms are Proof of Work, Proof of Stake, Proof of Authority and BFT protocols like PBFT, Tendermint and Raft, each trading off decentralisation, speed and fault tolerance.
18

How does Proof of Work function?

Save to ▾
Show answer
In Proof of Work, miners repeatedly change a nonce and hash the block header until the hash is below a difficulty target. Finding it takes huge computation, but anyone can verify it with one hash. The first miner to succeed broadcasts the block and earns the block reward plus fees. Nodes follow the chain with the most accumulated work. Bitcoin targets a block every ten minutes and adjusts difficulty every 2016 blocks to keep that pace.
19

Compare Proof of Work and Proof of Stake.

Save to ▾
Show answer
Proof of Work secures the chain with electricity and mining hardware; it is battle-tested and simple but energy-hungry and tends to centralise in mining pools. Proof of Stake secures it with locked capital that can be slashed; it uses over 99 percent less energy, gives faster economic finality and lowers hardware needs. Its critics point to stake concentration in large staking providers and more complex protocol design. Ethereum moved from PoW to PoS in the Merge of September 2022.
20

What is a 51 percent attack?

Save to ▾
Show answer
A 51 percent attack happens when one party controls a majority of mining power or stake. It can then reorder or exclude transactions, censor users and double spend by building a longer private chain that replaces recent blocks. It cannot steal coins from other addresses or forge signatures. Large chains like Bitcoin and Ethereum make it extremely expensive, but small PoW chains have suffered such attacks, which is why exchanges require many confirmations on them.
21

What is a Layer 2 and why is it needed?

Save to ▾
Show answer
A Layer 2 is a network that executes transactions off the main chain and inherits security from it by posting data or proofs back to Layer 1. Ethereum Layer 1 handles only around 15 to 30 transactions per second at higher fees, so L2s batch thousands of transactions into one L1 submission, cutting fees to cents or less. Rollups are the main type. Users bridge assets from L1 to the L2 and can withdraw back.
22

What is Bitcoin halving and difficulty adjustment?

Save to ▾
Show answer
Halving cuts the Bitcoin block reward in half every 210,000 blocks, roughly every four years, which caps total supply at 21 million BTC. After the April 2024 halving the reward is 3.125 BTC per block. Difficulty adjustment happens every 2016 blocks: if blocks came faster than ten minutes on average, difficulty rises, and if slower, it falls. Together they make issuance predictable regardless of how much mining power joins or leaves.
23

What is Ethereum and how is it different from Bitcoin?

Save to ▾
Show answer
Ethereum is a programmable blockchain: besides transferring its native currency ETH, it runs smart contracts, which are programs stored on-chain that execute exactly as written. Bitcoin focuses on being secure, scarce digital money with a deliberately limited scripting language and the UTXO model. Ethereum uses an account model, Proof of Stake since 2022, about 12-second blocks, and a large ecosystem of tokens, DeFi, NFTs and Layer 2 rollups built on top.
24

What is the Ethereum Virtual Machine (EVM)?

Save to ▾
Show answer
The EVM is the sandboxed, deterministic runtime that executes smart contract bytecode on every Ethereum node. It is a stack-based machine with 256-bit words, and each opcode has a gas cost, so every computation is metered and infinite loops are impossible. Because every node must get the same result, contracts cannot access the internet or randomness directly. Many chains and rollups are EVM-compatible, so the same Solidity contracts and tools work across them.
25

What is the difference between an externally owned account and a contract account?

Save to ▾
Show answer
An externally owned account (EOA) is controlled by a private key, has a balance and nonce but no code, and is the only type that can start a transaction. A contract account has code and storage, is controlled by its code, and acts only when called. Since the Pectra upgrade's EIP-7702, an EOA can also delegate to contract code, so the line is blurring as smart accounts become common.
26

Explain gas, gas limit and gas price.

Save to ▾
Show answer
Gas measures the computational work an operation needs; for example a simple ETH transfer uses 21,000 gas, and writing a new storage slot costs about 20,000. The gas limit is the maximum gas the sender allows a transaction to consume. The gas price, per unit, is what the sender pays. The fee equals gas used times the effective gas price. If execution exceeds the limit, it reverts but the used gas is still charged.
27

What happens when a transaction reverts?

Save to ▾
Show answer
A revert undoes all state changes made during that transaction, including nested calls, as if it never ran. However, the transaction is still included in a block, the nonce is consumed, and the sender pays for the gas used up to the revert. Contracts revert with require, revert or custom errors, which return a reason the wallet can show. Since the Byzantium upgrade, unused gas is refunded on revert, unlike the old invalid opcode which consumed everything.
28

What are testnets and how do you get test ETH?

Save to ▾
Show answer
Testnets are public networks that run the same software as mainnet but with valueless ETH, so developers can test deployments and dApps safely. Sepolia is the main testnet for application developers, and Hoodi replaced Holesky for validator and staking testing in 2025. Test ETH comes from faucets, which often require a small mainnet balance or a login to stop abuse. Many Layer 2s run their own Sepolia-based testnets bridged from Ethereum Sepolia.
29

What was the Merge?

Save to ▾
Show answer
The Merge, completed in September 2022, switched Ethereum from Proof of Work to Proof of Stake by joining the original execution chain with the Beacon Chain, which had been running PoS since December 2020. Mining ended, energy use fell by more than 99.9 percent, and new ETH issuance dropped sharply. Block times became a fixed 12 seconds. Staked ETH withdrawals were enabled later in the Shapella upgrade of April 2023.
30

How do you get current fee data and send an EIP-1559 transaction with ethers.js?

Save to ▾
Show answer
ethers v6 provides getFeeData, and sendTransaction fills in fields automatically, but you can set them explicitly. import { JsonRpcProvider, Wallet, parseEther } from 'ethers'; const provider = new JsonRpcProvider(process.env.RPC_URL); const wallet = new Wallet(process.env.PRIVATE_KEY, provider); const fee = await provider.getFeeData(); const tx = await wallet.sendTransaction({ to: '0xRecipient...', value: parseEther('0.01'), maxFeePerGas: fee.maxFeePerGas, maxPriorityFeePerGas: fee.maxPriorityFeePerGas }); const receipt = await tx.wait(); console.log(receipt.status);
31

Tell me about a blockchain project you have built.

Save to ▾
Show answer
Pick one project and explain it with STAR. Situation: in my final year I wanted to learn Solidity end to end. Task: build a crowdfunding dApp. Action: I wrote the contract with goal and deadline logic and refunds, tested it with Foundry including fuzz tests, built a Next.js front-end with wagmi, and deployed to Sepolia. Result: 30 friends tested it, I fixed a refund bug they found, and the repo now has docs and a demo video.
32

What is Solidity?

Save to ▾
Show answer
Solidity is a statically typed, contract-oriented, curly-brace language for writing smart contracts on Ethereum and other EVM chains. Its syntax resembles JavaScript and C++, and it compiles to EVM bytecode plus an ABI. It supports inheritance, libraries, user-defined types, custom errors and events. Version 0.8.x is current, with checked arithmetic by default. Developers usually write it with Foundry or Hardhat and reuse audited building blocks from OpenZeppelin Contracts.
33

What are value types and reference types in Solidity, and what are data locations?

Save to ▾
Show answer
Value types such as uint, int, bool, address, bytes32 and enums are copied when assigned or passed. Reference types such as arrays, structs, strings and mappings point to data, so you must state a data location: storage for persistent contract state, memory for temporary data inside a function, or calldata for read-only external inputs. Assigning storage to a local storage pointer modifies state, while copying to memory creates an independent copy.
34

Explain public, external, internal and private visibility.

Save to ▾
Show answer
public functions can be called externally and internally, and public state variables get an automatic getter. external functions can only be called from outside, or via this.f(), and read arguments directly from calldata. internal functions and variables are available to the contract and contracts that inherit it. private is limited to the defining contract only. Note that private only restricts other contracts; the data is still fully visible on the blockchain to anyone.
35

What is the difference between view, pure and payable functions?

Save to ▾
Show answer
A view function reads state but does not modify it, so it is free when called off-chain via eth_call. A pure function neither reads nor modifies state and works only on its inputs, for example a math helper. A payable function can receive ETH along with the call; non-payable functions revert if ETH is sent. View and pure functions still cost gas when called inside a state-changing transaction.
36

What are function modifiers in Solidity?

Save to ▾
Show answer
Modifiers are reusable pieces of code that run before or after a function body, placed where the underscore symbol appears. They are mainly used for checks such as onlyOwner, whenNotPaused or nonReentrant. For example, modifier onlyOwner() { require(msg.sender == owner, 'not owner'); _; } blocks everyone except the owner. Keep modifiers short and check-only; complex logic inside modifiers hides behaviour and increases bytecode size because the code is inlined into every function that uses it.
37

What is the difference between constant and immutable?

Save to ▾
Show answer
constant variables must be assigned a compile-time value and are inlined into the bytecode, for example uint256 constant MAX = 1000. immutable variables are assigned once in the constructor and then embedded in the deployed code, for example an owner address or token address chosen at deployment. Neither uses a storage slot, so reading them is far cheaper than reading normal state. Use them for anything that never changes after deployment.
38

Write a simple ERC-20 token using OpenZeppelin.

Save to ▾
Show answer
Inherit the audited ERC20 implementation and mint the initial supply in the constructor. // 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 CampusToken is ERC20, Ownable { constructor() ERC20('Campus Token', 'CAMP') Ownable(msg.sender) { _mint(msg.sender, 1_000_000 * 10 ** decimals()); } function mint(address to, uint256 amount) external onlyOwner { _mint(to, amount); } }
39

Tell me about a time you learnt a new technology quickly to meet a deadline.

Save to ▾
Show answer
Situation: in my internship I was asked to add NFT minting to a demo in ten days, and I had never written Solidity. Task: deliver a working, tested contract. Action: I spent two days on Solidity basics and OpenZeppelin docs, built the ERC-721 contract, asked a senior to review my approach early, and wrote Foundry tests for every function. Result: the demo shipped on time on Sepolia, and the review caught only minor issues.
40

What is the checks-effects-interactions pattern?

Save to ▾
Show answer
It is an ordering rule for functions. First do checks: validate inputs, permissions and balances with require. Then apply effects: update all state variables, such as reducing the user's balance. Only then do interactions: external calls, token transfers or ETH sends. Because state is already updated, a re-entering call sees the new state and cannot repeat the action. Combine it with a nonReentrant modifier for defence in depth, especially in functions calling unknown contracts.
41

How did integer overflow bugs happen before Solidity 0.8?

Save to ▾
Show answer
Before 0.8, arithmetic wrapped silently: a uint8 at 255 plus 1 became 0, and 0 minus 1 became the maximum value. Attackers exploited this, for example by making a balance underflow to a huge number or an overflowed multiplication pass a check, as in the 2018 batchOverflow token bug. Developers used the SafeMath library to revert on overflow. Since 0.8 the compiler checks automatically, except inside unchecked blocks and in inline assembly.
42

Why should you not use tx.origin for authorisation?

Save to ▾
Show answer
tx.origin is the EOA that started the transaction, while msg.sender is the immediate caller. If a contract checks require(tx.origin == owner), a phishing contract can trick the owner into calling it, and that contract then calls the victim; tx.origin is still the owner, so the check passes and funds can be stolen. Always use msg.sender for access control. tx.origin also breaks with smart contract wallets and account abstraction.
43

A user approved unlimited token spending to a scam site. What should they do?

Save to ▾
Show answer
Revoke the approval immediately using a token approval checker or by calling approve(spender, 0) from the wallet, because the malicious contract can pull tokens any time. If a drain has started, move remaining assets to a fresh wallet. Check for other suspicious approvals and NFT setApprovalForAll permissions. Going forward, approve exact amounts, read wallet prompts carefully, use a separate hot wallet for new dApps, and prefer wallets that simulate transactions before signing.
44

How do you run Slither on a Foundry project and focus on important findings?

Save to ▾
Show answer
Install it with pip and run it from the project root; it detects Foundry automatically. pip install slither-analyzer slither . # Only medium and high impact issues slither . --exclude-low --exclude-informational # Exclude dependencies slither . --filter-paths 'lib|test' # Print a summary of contracts and functions slither . --print human-summary Triage each finding: fix real bugs and record why false positives are safe.
45

What is DeFi?

Save to ▾
Show answer
DeFi, decentralised finance, means financial services such as trading, lending, borrowing, stablecoins and derivatives built as smart contracts on public blockchains. Anyone with a wallet can use them without a bank account or approval, contracts are transparent, and protocols can be combined like building blocks. Examples are automated market maker exchanges, overcollateralised lending markets and liquid staking. The risks are smart contract bugs, oracle failures, volatile collateral and unclear regulation.
46

Compare ERC-20, ERC-721 and ERC-1155 tokens.

Save to ▾
Show answer
ERC-20 defines fungible tokens where every unit is identical, with functions like transfer, approve, transferFrom and balanceOf; used for currencies, stablecoins and governance tokens. ERC-721 defines non-fungible tokens where each tokenId is unique, used for NFTs like art, tickets or certificates. ERC-1155 is a multi-token standard where one contract manages many token types, fungible or not, with batch transfers; it is popular in games where items have quantities.
47

What types of stablecoins exist?

Save to ▾
Show answer
Fiat-backed stablecoins hold cash and short-term government bonds off-chain, one dollar per token, and depend on the issuer's audits and redemptions. Crypto-collateralised stablecoins are minted against overcollateralised crypto in smart contracts, such as vaults requiring 150 percent collateral. Algorithmic stablecoins try to hold the peg with supply rules and incentives; several have collapsed, the most famous in 2022. Choose based on trust model, liquidity, transparency and regulatory status.
48

Write a basic ERC-721 NFT contract using OpenZeppelin.

Save to ▾
Show answer
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import {ERC721} from '@openzeppelin/contracts/token/ERC721/ERC721.sol'; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; contract CertificateNFT is ERC721, Ownable { uint256 public nextId; string private baseURI; constructor(string memory uri) ERC721('Course Cert', 'CERT') Ownable(msg.sender) { baseURI = uri; } function mint(address to) external onlyOwner { _safeMint(to, nextId++); } function _baseURI() internal view override returns (string memory) { return baseURI; } }
49

How do you approve and transfer ERC-20 tokens from a script with ethers.js?

Save to ▾
Show answer
import { Contract, parseUnits } from 'ethers'; const abi = [ 'function approve(address spender, uint256 amount) returns (bool)', 'function decimals() view returns (uint8)', 'function allowance(address owner, address spender) view returns (uint256)' ]; const token = new Contract(TOKEN_ADDRESS, abi, signer); const dec = await token.decimals(); const amount = parseUnits('25', dec); const tx = await token.approve(SPENDER, amount); await tx.wait(); console.log(await token.allowance(signer.address, SPENDER)); The spender contract then calls transferFrom to pull exactly that amount.
50

How should NFT metadata and tokenURI be structured?

Save to ▾
Show answer
tokenURI(id) returns a URI, usually ipfs://<CID>/<id>.json, pointing to JSON that marketplaces read: { "name": "Course Certificate #12", "description": "Completed Blockchain Developer course", "image": "ipfs://bafy.../12.png", "attributes": [ { "trait_type": "Grade", "value": "A" }, { "trait_type": "Year", "value": 2026 } ] } Store images and JSON on IPFS or Arweave rather than a normal server, so metadata cannot silently change or disappear.
51

A retail brand wants to give customers loyalty points as blockchain tokens. How would you design it?

Save to ▾
Show answer
Keep it simple for non-crypto users. Use a low-fee Layer 2 or a permissioned chain, and create wallets automatically with account abstraction or embedded wallets linked to phone login, so customers never handle seed phrases. Sponsor gas through a paymaster. Make points a non-transferable or restricted ERC-20 if resale is not intended, to avoid VDA tax and securities issues. Keep customer data off-chain and show points in the brand's normal app.
52

Why do you want to work in DeFi, given its risks and volatility?

Save to ▾
Show answer
I am drawn to DeFi because it turns financial products into open, auditable code, and that combination of finance and engineering motivates me. I understand the risks: hacks, market crashes and regulatory change. That is why I have focused on security, testing and risk thinking, not just writing contracts. I see volatility as a reason to build carefully. I want to work on a team that values audits, monitoring and user protection.
53

What does a typical dApp architecture look like?

Save to ▾
Show answer
A dApp usually has smart contracts on a chain holding core logic and assets; a front-end, often React or Next.js, that connects to the user's wallet; a library such as ethers.js, viem or wagmi to read and write contracts through an RPC provider; an indexer or subgraph for fast queries of history; decentralised storage such as IPFS for files and metadata; and optional back-end services for notifications, relaying or off-chain computation, with oracles bringing external data on-chain.
54

What is IPFS and what is content addressing?

Save to ▾
Show answer
IPFS, the InterPlanetary File System, is a peer-to-peer network for storing and sharing files. Instead of locating files by server address, it identifies them by a content identifier (CID) derived from the file's hash, which is content addressing. The same content always has the same CID, and any change gives a new CID, so data cannot be swapped silently. Files must be pinned by a node or pinning service, otherwise they may disappear.
55

How do you connect a browser wallet to a dApp using ethers.js?

Save to ▾
Show answer
Browser wallets inject an EIP-1193 provider at window.ethereum. Wrap it with BrowserProvider and request accounts. import { BrowserProvider } from 'ethers'; async function connect() { if (!window.ethereum) throw new Error('Install a wallet'); const provider = new BrowserProvider(window.ethereum); const signer = await provider.getSigner(); // prompts the user const address = await signer.getAddress(); const { chainId } = await provider.getNetwork(); return { signer, address, chainId }; } In production, use EIP-6963 discovery or a connector library so users with several wallets can choose.
56

How do you call read and write functions of a contract with ethers v6?

Save to ▾
Show answer
Create a Contract with address, ABI and a provider for reads or a signer for writes. import { Contract, parseEther } from 'ethers'; const abi = [ 'function count() view returns (uint256)', 'function increment() payable' ]; const readOnly = new Contract(ADDR, abi, provider); console.log(await readOnly.count()); // free eth_call const writable = new Contract(ADDR, abi, signer); const tx = await writable.increment({ value: parseEther('0.001') }); const receipt = await tx.wait(); console.log(receipt.hash, receipt.status);
57

What are the basic Foundry commands to create, build, test and work with a project?

Save to ▾
Show answer
curl -L https://foundry.paradigm.xyz | bash && foundryup forge init my-dapp # new project with src, test, script forge install OpenZeppelin/openzeppelin-contracts forge build # compile forge test -vvv # run tests with traces forge coverage # coverage report forge snapshot # gas snapshot anvil # local node cast call ADDR 'count()(uint256)' --rpc-url $RPC Foundry tests are written in Solidity and run fast; Hardhat is the JavaScript or TypeScript alternative with a large plugin ecosystem.
58

How do you verify a deployed contract's source code on a block explorer?

Save to ▾
Show answer
Verification uploads source and compiler settings so the explorer can recompile and match the bytecode, letting users read the code. # Foundry, using an explorer API key forge verify-contract 0xDeployedAddr src/Counter.sol:Counter \ --chain sepolia --etherscan-api-key $KEY --watch # With constructor arguments --constructor-args $(cast abi-encode 'constructor(address)' 0xOwner) # Hardhat npx hardhat verify --network sepolia 0xDeployedAddr 0xOwner Compiler version, optimiser runs and via-IR settings must match exactly.
59

Users report their USDC balance shows as a tiny fraction in your dApp. What is wrong?

Save to ▾
Show answer
USDC uses 6 decimals, but the front-end probably formats every token with 18 decimals, so 100 USDC (100,000,000 base units) displays as 0.0000000001. Read decimals() from each token contract, or from a trusted token list, and use formatUnits and parseUnits with that value. Use bigint for amounts, never JavaScript floats, to avoid precision errors. Add tests with tokens of 6, 8 and 18 decimals.
60

Tell me about yourself for a blockchain developer role.

Save to ▾
Show answer
Keep it to about a minute: present, past, future. For example: I am a computer science graduate who has spent the last year building on Ethereum. I have built three projects, including an NFT certificate system and a staking contract tested with Foundry fuzz tests, and deployed them on Sepolia with React front-ends. I practise security through Ethernaut challenges. I am looking for a role where I can write secure contracts and learn from experienced auditors.
61

Where do you see yourself in five years?

Save to ▾
Show answer
I see myself as a senior smart contract engineer, owning the design and security of production protocols and mentoring juniors. In the next two years I want to master Solidity, testing and audit techniques, and contribute to open source. Later I would like to specialise in security or Layer 2 infrastructure. I hope to grow inside a team like this one, where the work is real and the standards are high.

Frequently asked questions

Who should practise easy Blockchain questions?

Freshers and career switchers should start here, and experienced candidates should skim them the day before an interview.

How should I practise these?

Answer each question aloud before opening the answer, mark it as solved only when your answer matches the key idea, and save misses to Last-Minute Revision.

Other difficulty levels