Prepare for your next Web3 developer role with these 30 essential interview questions covering basic, intermediate, and advanced topics. Ideal for freshers, 1-3 years, and 3-6 years experienced candidates, these questions focus on core Web3 concepts, smart contracts, decentralization, and practical scenarios.
Basic Web3 Interview Questions
1. What is Web3?
Web3 represents the next evolution of the internet, built on decentralized technologies like blockchain, enabling user ownership of data and peer-to-peer interactions without central authorities.
2. What is the difference between a public and a private blockchain?
A public blockchain is open to anyone for participation and validation, like Ethereum, while a private blockchain restricts access to authorized participants only, offering more control but less decentralization.
3. Explain the concept of decentralization and its importance in Web3.
Decentralization distributes control across a network of nodes rather than a single entity, ensuring censorship resistance, enhanced security, and user sovereignty in Web3 applications.
4. What is a blockchain?
A blockchain is a distributed, immutable ledger that records transactions across multiple nodes, secured by cryptography, forming the foundation for Web3’s trustless systems.
5. What is a decentralized application (dApp)?
A dApp is an application running on a blockchain network, with its backend logic executed via smart contracts, providing transparency and resistance to single points of failure.
6. What are smart contracts?
Smart contracts are self-executing programs deployed on blockchain networks that automatically enforce rules and conditions when predefined criteria are met.
7. What is the Ethereum Virtual Machine (EVM)?
The EVM is a runtime environment for executing smart contracts on Ethereum-compatible blockchains, providing a Turing-complete platform isolated from the main network.
8. What is the difference between Proof of Work (PoW) and Proof of Stake (PoS)?
PoW requires miners to solve computational puzzles to validate blocks, while PoS selects validators based on staked cryptocurrency amounts, making it more energy-efficient.
9. Name some common consensus algorithms used in Web3 blockchains.
Common algorithms include Proof of Work (PoW), Proof of Stake (PoS), Delegated Proof of Stake (DPoS), and Practical Byzantine Fault Tolerance (PBFT).
10. What programming languages are commonly used for Web3 development?
Popular languages include Solidity for smart contracts, JavaScript with Web3.js for frontend integration, Rust for high-performance components, and Vyper for secure contract development.
Intermediate Web3 Interview Questions
11. How do you connect a frontend application to a Web3 blockchain using Web3.js?
Use Web3.js to instantiate a Web3 object with a provider like MetaMask:
const web3 = new Web3(window.ethereum);
then request accounts with await ethereum.request({ method: 'eth_requestAccounts' });.
12. Explain ERC-20 token standard and its key functions.
ERC-20 is a standard for fungible tokens on Ethereum, requiring functions like totalSupply(), balanceOf(address), transfer(address, uint256), and approval mechanisms for secure transfers.
13. What is ERC-721 and how does it differ from ERC-20?
ERC-721 defines non-fungible tokens (NFTs) for unique assets, using functions like ownerOf(uint256) and transferFrom(address, address, uint256), unlike interchangeable ERC-20 tokens.
14. How do you optimize gas fees in smart contracts?
Optimize by reducing storage operations, using shorter variable names, packing variables efficiently, minimizing loops, and using libraries like OpenZeppelin for gas-efficient implementations.
15. What is a reentrancy attack and how do you prevent it?
Reentrancy occurs when a contract calls an external contract that recursively calls back before state updates. Prevent it using the Checks-Effects-Interactions pattern or mutex-like guards.
16. Describe how to deploy a smart contract using Hardhat.
Create a deployment script in scripts/deploy.js, compile with npx hardhat compile, then run npx hardhat run scripts/deploy.js --network <network> to deploy.
17. What are events in Solidity and why use them?
Events log data to the blockchain for off-chain indexing, emitted via emit EventName(args);, enabling efficient dApp notifications without increasing gas costs significantly.
18. Explain modifiers in Solidity with an example.
Modifiers alter function behavior reusably, e.g., modifier onlyOwner() { require(msg.sender == owner); _; } applied as function withdraw() public onlyOwner { ... }.
19. How does token approval work in ERC-20 standards?
Users call approve(spender, amount) to allow a spender contract to transfer tokens on their behalf, checked via allowance(owner, spender) before transferFrom.
20. What is gas and how is it calculated in Web3 transactions?
Gas measures computational effort; total cost = gas used × gas price. Optimized code uses less gas, and tools like Remix estimate it before deployment.
Advanced Web3 Interview Questions
21. How would you implement a simple ERC-20 token in Solidity?
contract MyToken {
mapping(address => uint256) public balanceOf;
uint256 public totalSupply;
function transfer(address to, uint256 amount) public returns (bool) {
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
return true;
}
}
22. Explain layer 2 scaling solutions in Web3.
Layer 2 solutions like optimistic rollups and zk-rollups process transactions off the main chain, batching them for settlement, improving throughput while inheriting L1 security.
23. At Atlassian, how would you handle interoperability between different Web3 chains?
Use cross-chain bridges or protocols like LayerZero for message passing, ensuring secure asset transfers and data synchronization across heterogeneous blockchain networks.
24. What are oracles in Web3 and common security risks?
Oracles provide off-chain data to smart contracts. Risks include manipulation; mitigate with decentralized oracles like Chainlink using multiple sources and reputation systems.
25. Describe a strategy for auditing smart contracts.
Conduct static analysis with Slither, fuzz testing with Echidna, formal verification, manual code review focusing on vulnerabilities, and third-party professional audits.
26. How do you implement upgradeable smart contracts?
Use proxy patterns like TransparentProxy from OpenZeppelin, separating logic and storage; upgrade by pointing the proxy to new implementation contracts without changing addresses.
27. In a Swiggy-like scenario, design a decentralized marketplace smart contract.
Include structs for orders, mappings for escrow balances, functions for listing items, atomic swaps via matchOrder, and dispute resolution with timeout releases.
28. What is flash loan attack and prevention methods?
Flash loans exploit uncollateralized instant loans for arbitrage or manipulation. Prevent with callback validations, economic constraints, and time-locks on critical operations.
29. How do you ensure Web3 dApp frontend security against wallet phishing?
Validate all transactions client-side, use established libraries like ethers.js, implement signature verification, and educate users on blind signing risks.
30. For a Salesforce Web3 integration, discuss scalability challenges and solutions.
Address high latency with L2 solutions like Polygon, optimize contract storage, use event-driven indexing with The Graph, and implement sharding for state management.