Mastering blockchain concepts and practical development skills helps you confidently crack interviews and build a strong career in the growing Web3 ecosystem. This guide covers essential Blockchain interview questions and answers, including fundamentals, smart contracts, security, and real-world scenarios to help you prepare for blockchain and Web3 roles.
Table of Contents:
Blockchain Fundamentals and Core Concepts
1. What is Blockchain technology?
The blockchain is an incorruptible digital ledger of economic transactions that can be programmed to record not just financial transactions but virtually everything of value.
2. What are the different types of Blockchain?
There are four types of blockchains as follows:
- Public Blockchains
- Private Blockchains
- Consortium Blockchains
- Hybrid Blockchains.
3. What are the benefits of Blockchain Technology?
Blockchain technology has the following benefits:
- Blockchain technology employs advanced security compared to other networks or record-keeping systems. Prior to being recorded, all transactions must be agreed upon.
- Blockchain offers transparency. One of the major problems in the new industry is transparency. An organization may use blockchain to create a completely decentralized network that eliminates the need for a centralized authority, increasing the system’s transparency.
- Blockchain helps in reducing costs. Organizations will save a lot of money by using the blockchain instead of paying third-party vendors.
4. Difference between Distributed Ledger (DLT) and Traditional Database.
| Feature | Distributed Ledger (DLT) | Traditional Ledger (Centralized) |
|---|
| Core Architecture | A database that is replicated, exchanged, and synchronized across multiple sites (nodes) in a network. | A centralized database stored and maintained in a specific location by a central authority. |
| Control & Authority | Decentralized. Information is accessible to everyone inside the network, removing the need for a middleman. | Centralized. Controlled by a single entity like banks, governments, or accountants. |
| Transparency | High. It provides an auditable background of information visible to the network. | Low. Visibility is restricted to the central authority; users must trust the ledger keeper. |
| Data Synchronization | Data is synchronized across all nodes simultaneously. | Data is updated centrally and may not be synchronized in real-time for all users. |
5. Compare Blockchain with a relational database
| Criteria | Blockchain | RDBMS |
|---|
| Unit of data | Block | Table |
| Single point of failure | Does not exist | Exists |
| Centralized control | No | Yes |
| Editing/deleting data | Not possible | Possible |
6. What do you mean by blocks in Blockchain technology?
In the Blockchain, a block is simply a set of records. The term “blockchain” refers to the process of joining these lists together. For example, if a company has 100 ledger books, the total is known as a blockchain, and each ledger is referred to as a block.
7. Is it possible to modify the data once it is written in a block?
No, it is not possible to do that. If any customization is needed, the company simply needs to delete the details from all other blocks as well. Data must be treated with extreme caution when using this system for no other reason than this.
8. Why is Blockchain a trusted approach?
For a variety of purposes, blockchain can be trusted. Because of its open-source existence, the first thing that comes to mind is its compatibility with other business applications. The second factor is its safety. Since it was designed to be used for online transactions, the developers paid particular attention to keeping up with the times in terms of protection. Blockchain will help regardless of the type of company one owns.
9. What are Blockchain Durability and robustness?
Bitcoin was founded in the year 2008. Since then, there has been no major damage to the Bitcoin network. For nearly 30 years, the internet has proved to be a reliable resource. It’s a track record that bodes well for the future of blockchain technology.
In the same way, as the internet has built-in robustness, blockchain technology does as well. The blockchain can’t be managed by any single individual since it stores blocks of information that are similar across its network. There should be no single failure point in the blockchain.
10. Is Blockchain an incorruptible ledger?
Yes, Blockchain is an incorruptible ledger. According to the inventor, the blockchain database cannot be tampered with.
11. What are blockchain requirements?
Blockchain is a truly disruptive technology that has the potential to change business networks. So, the requirements for a blockchain are as follows:
- Smart contracts
- Ledgers
- Cryptography
- Consensus Protocol
12. What are Block Identifiers?
A blockchain has a unique identifier for each block. The hash value is used to create a unique identifier. As a result, no two block identifiers would be the same. In Blockchain, blocks can be identified by the block header hash and the block height.
13. What Are the Drawbacks of Blockchain?
Some disadvantages of Blockchains are listed below.
- Some Blockchain Solutions Use So Much Energy Because Blockchain Isn’t a Distributed Computing System
- It’s difficult to incorporate and manage complex technologies.
- There are also problems with scalability.
- Data is unchangeable.
- It can be inefficient at times because network speed and transaction costs fluctuate.
- Human error has not yet been eradicated.
- Not entirely secure.
14. What is Transparent and incorruptible in blockchain?
Every ten minutes, the blockchain network checks in with itself to ensure that it is in a state of consensus. The network, which functions as a self-auditing ecosystem of digital value, reconciles any transaction that occurs in ten-minute intervals. A “block” refers to a collection of these transactions. As a result, two critical properties emerge from this they are:
Transparency data is embedded in the network as a whole, and it is available by definition. It can’t be tampered with because changing every single unit of data on the blockchain will require a massive amount of computational power to circumvent the entire network.
15. What is the Blockchain Trilemma?
The Blockchain Trilemma refers to a concept that has gained general acceptance, whereby a blockchain network can only optimize two of the following three properties simultaneously: Scalability, Security, and Decentralization.
The Three Pillars Explained
- Scalability: This is the capacity of a blockchain network to process a large number of transactions within a short period of time.
- Security: Protection against attacks, fraud, and manipulation of networks.
- Decentralization: Instead of relying on a central authority, multiple independent nodes are used.
Why It’s a Trade-Off
Making one property better can result in another property becoming worse. For instance:
- Increasing scalability may compromise decentralization.
- Strengthening security could also limit scalability.
- Maximizing decentralization may cause slower transaction speeds.
The blockchain trilemma points to the difficulty of creating systems that are fast, secure, and decentralized.
16. Difference Between Public, Private, and Consortium Blockchain
| Feature | Public Blockchain | Private Blockchain | Consortium Blockchain |
|---|
| Access Type | Open to everyone | Restricted to one organization | Restricted to multiple organizations |
| Decentralization Level | Fully decentralized | Centralized | Partially decentralized |
| Permission Requirement | No permission needed | Permission required | Permission required |
| Control Authority | Community-driven | Single entity controls | A group of entities controls |
| Transparency | Fully transparent | Limited transparency | Controlled transparency |
| Transaction Speed | Slower | Faster | Faster than public |
| Security Level | High (due to decentralization) | Moderate to High | High |
| Cost | Higher transaction cost | Lower cost | Medium |
| Examples | Bitcoin, Ethereum | Hyperledger Fabric | R3 Corda, Quorum |
| Use Cases | Cryptocurrencies, DeFi, NFTs | Internal business operations | Banking, Supply Chain, Finance |
17. What is the Genesis Block?
The Genesis Block is the first ever created in a blockchain. It is the foundation on which all other blocks are created.
Key Characteristics
- It is also called Block 0
- It does not have a previous block hash, as it is the first block
- It initializes the blockchain network
- It may carry symbolic or historical messages
18. Difference Between Soft Fork and Hard Fork
| Feature | Soft Fork | Hard Fork |
|---|
| Definition | Backward-compatible blockchain update | Not a backward-compatible update |
| Compatibility | Old nodes can still validate blocks | Old nodes cannot validate new blocks |
| Network Split | Does not create a new chain | Creates a new blockchain |
| Consensus Requirement | Majority adoption | Full network upgrade required |
| Risk Level | Lower | Higher |
| Impact | Minor protocol changes | Major rule changes |
| Examples | SegWit (Bitcoin) | Bitcoin Cash, Ethereum Classic |
In simple terms:
- Soft Fork = Upgrade without breaking the network
- Hard Fork = Upgrade that splits the blockchain
19. What is a DAO (Decentralized Autonomous Organization)?
A DAO is a blockchain-based organization that is governed by smart contracts instead of a central authority.
Key Features
- Decentralized governance structure (no single leader)
- Smart contract-based rules
- Token-based voting system
- Transparent and tamper-proof operations
- Community-driven decision-making
Examples
20. What Is Ethereum (ETH)?
Ethereum is an open-source software platform based on Blockchain technology that enables developers to build and deploy decentralized applications (i.e., applications that are not controlled by a single entity). You may construct a decentralized application in which the participants are the ones who make the decisions.
The following is the list of widely-used platforms for blockchain-based applications
- IBM Blockchain
- EOS
- OpenLedger
- Corda
- Ripple Blockchain
- Ethereum Blockchain
- IOTA
- Quorum
- OpenChain
- Hyperledger Sawtooth
22. What is the difference between Blockchain and Hyperledger?
| Feature | Blockchain | Hyperledger |
|---|
| Definition | A technology used to build decentralized and distributed systems for storing transactions securely. | An open-source blockchain framework designed for enterprise and business use cases. |
| Nature | General blockchain technology concept. | A blockchain platform and ecosystem under the Hyperledger project. |
| Network Type | Can be public or private blockchain networks. | Mainly designed for permissioned (private) blockchain networks. |
| Access Control | Often open and decentralized in public blockchains. | Restricted access with controlled participation. |
| Governance | Community-driven and decentralized governance. | Governed by organizations or consortium members. |
| Cryptocurrency Usage | Often includes native cryptocurrencies (e.g., Bitcoin, Ethereum). | Typically does not require cryptocurrencies for operation. |
| Use Cases | Cryptocurrencies, DeFi, NFTs, public applications. | Enterprise solutions like supply chain, banking, healthcare, and logistics. |
| Consensus Mechanism | Uses mechanisms like PoW, PoS, etc. | Uses modular consensus mechanisms optimized for enterprise needs. |
| Example Platforms | Bitcoin, Ethereum, Solana. | Hyperledger Fabric, Hyperledger Sawtooth. |
23. What are some of the popular Cryptocurrencies?
The most popular Cryptocurrencies are:
24. How does Bitcoin use Blockchain?
A transaction is a value transfer that is recorded in the blockchain between Bitcoin wallets. Bitcoin wallets store a private key, also known as a seed, which is used to sign transactions and provide mathematical proof that they came from the wallet’s owner.
25. Difference Between Bitcoin and Ethereum
| Feature | Bitcoin (BTC) | Ethereum (ETH) |
|---|
| Primary Purpose | Digital currency | Smart contracts & DApps platform |
| Consensus Mechanism | Proof-of-Work (PoW) | Proof-of-Stake (PoS) (post-Merge) |
| Transaction Speed | Slower (~7 TPS) | Faster (~15–30 TPS, scalable with Layer-2) |
| Smart Contracts | Not supported | Fully supported |
| Supply Limit | Fixed (21 million BTC) | No fixed hard cap |
| Energy Efficiency | Energy-intensive | Energy-efficient (PoS) |
| Use Cases | Store of value, payments | DeFi, NFTs, DAOs, Web3 |
| Launch Year | 2009 | 2015 |
In short:
- Bitcoin = Digital money
- Ethereum = Programmable blockchain platform
26. What is “Gas” in Ethereum, and How Are Gas Fees Calculated?
Gas is the fee required to execute transactions or smart contracts on Ethereum.
Why Gas Exists
- Prevents spam
- Compensates validators
- Prioritizes transactions
Gas Fee = Gas Units × Gas Price
Key Components
- Gas Units → Computational work required
- Gas Price → Cost per unit (in Gwei)
- Base Fee → Network congestion cost
- Priority Fee (Tip) → Incentive for faster processing
27. Difference Between Coin and Token
| Feature | Coin | Token |
|---|
| Runs On | Own blockchain | Built on another blockchain |
| Primary Purpose | Digital currency, store of value | Utility, governance, or asset |
| Creation | Native blockchain protocol | Smart contracts |
| Transaction Fees | Used to pay network fees | Often cannot pay base fees |
| Examples | Bitcoin (BTC), Ether (ETH) | USDT, UNI, LINK |
In short:
- Coin = Native blockchain currency
- Token = Asset built on top of an existing blockchain
28. Difference Between Layer 1 (L1) and Layer 2 (L2) Scaling Solutions
| Feature | Layer 1 (L1) | Layer 2 (L2) |
|---|
| Definition | Base blockchain network | Scaling layer built on top of L1 |
| Goal | Improve core blockchain performance | Reduce congestion & fees |
| Speed | Slower | Faster transactions |
| Cost | Higher fees | Lower fees |
| Security Source | Native blockchain | Inherits L1 security |
| Examples | Bitcoin, Ethereum, Solana | Polygon, Arbitrum, Optimism |
In short:
- L1 = Main blockchain
- L2 = Speed & cost optimization layer
29. What is Sharding in Blockchain?
Sharding is a scaling technique that splits a blockchain network into smaller parts called shards to process transactions in parallel.
Key Benefits
- Improves transaction throughput
- Reduces network congestion
- Lowers validation workload
- Enhances scalability
Blockchain Technical Mechanics and Consensus
30. What is Blockchain Wallet and How Does It Work?
A blockchain wallet is a piece of digital software that stores private and public keys, as well as tracks and records all transactions involving those keys on the blockchain. A blockchain wallet, in theory, does not store cryptocurrency; instead, all records belonging to these keys are stored on the blockchain on which the wallet is hosted.
Blockchain wallets have public and private keys. A public key and a private key are used in a similar way in blockchain wallets. A public key is similar to an email address in that it can be shared with others. When your wallet is created, a public key is created as well, which you can share with others to obtain funds. The private key is a closely guarded secret. It’s similar to your password in that it shouldn’t be compromised, and you shouldn’t share it.
31. What are Smart Contracts and how do they work?
A smart contract is a computer code-based agreement between two individuals. They are stored on a public ledger and cannot be modified because they run on the blockchain. A smart contract’s transactions are handled by the blockchain, which means they can be submitted automatically without the involvement of a third party.
The Smart contracts are secure, transparent, third-party-free, autonomous, and accurate.
Let me use an example to demonstrate how smart contracts work. If Alex decides to sell his home to Bob. Then they would pay a slew of fees to third parties such as real estate agents, banks, attorneys, and others. However, with a smart contract, they can simply write a statement stating that if Bob pays this amount of money, he will be given ownership of the property. Hence, smart contracts can cut down the actual process and give us trustworthy options for transactions.
32. What is a Blockchain Explorer?
A Blockchain Explorer is a piece of software that draws data from a blockchain using an API and a blockchain node, then uses a database to organize the data and present it to the user in a searchable format.
33. How Does Blockchain Create Blocks?
When the block size is reached, the blockchain creates blocks automatically. Since the block is a file, the transactions are saved until the file is complete. They are linked in such a way that the most recent block is connected to the previous one. A hash value is created using a mathematical function to identify a block. It also shows any modifications made to a block.
34. Can you define what an off-chain transaction is?
A transaction that takes place outside of the blockchain is known as an off-chain transaction. An on-chain transaction – often referred to as simply “a transaction” – modifies the blockchain and relies on the blockchain to establish its legitimacy, while an off-chain transaction records and validates the transaction using other methods.
35. Can you name some of the popular consensus algorithms?
The most popular consensus algorithms are:
- PBFT (Practical Byzantine Fault Tolerance)
- Proof-of-work
- Proof-of-stake
- Delegated proof-of-stake
- Proof-of-elapsed time
36. What Is the Difference Between Proof-Of-Stake (Pos) And Proof-Of-Work (PoW)?
The two most popular consensus algorithms, PoW and PoS, can be differed by their operation. PoW consumes a lot of resources, while PoS does not. Other significant differences include the need for a lot of computational power in PoW versus none or very little computational power in PoS. When compared to PoW, PoS is both more cost-effective and has a quicker completion time.
37. Name the steps that are involved in the Blockchain project implementation?
There is a total of six steps involved in the blockchain project implementation process, and they are:
- Identifying the requirements
- Consideration of screen ideas
- Blockchain project production
- Analysis of the Security Implementation’s Feasibility
- Managing and overseeing the project
38. What Is Consensus Algorithm?
The method of gaining consensus on a change of data over the system or any distributed network is known as a consensus algorithm. They are widely used in blockchains because they enable the network of unknown nodes to reach consensus on the data that is being stored or shared. Proof-of-Stake (PoS) and Proof-of-Work(PoW) are the most popular consensus algorithms.
39. What are the Merkle trees?
The Merkle tree is a fundamental component of blockchain technology. It’s a mathematical data structure made up of hashes of various data blocks that acts as a description of all the transactions in a block. It also enables fast and reliable content verification across a broad dataset. It also aids in the verification of data accuracy and content. Merkle is used for both Bitcoin and Ethereum. Merkle Tree is also known as Hash Tree.
40. What do you mean by a Coinbase transaction?
In a block, the first transaction is a Coinbase transaction. A miner will build this unique kind of bitcoin transaction. It is used by miners to receive the block reward for their efforts, as well as any other transaction fees.
Blockchain Security, Cryptography, and Attack Prevention
41. What Is Hashing in Blockchain?
The process of making an input item of any length, which represents an output item of a fixed length, is referred to as hashing in the blockchain. Take, for example, the use of blockchain in cryptocurrencies, where transactions of varying lengths are run through a given hashing algorithm, and all produce a fixed-length performance.
42. What is a 51% Attack?
A miner or a group of miners attempting to control more than 50% of a network’s hashing capacity, processing power, or hash rate is known as a 51 percent attack on a blockchain network.
The attacker may prevent new transactions from taking place or being verified in this attack. They can also reverse transactions that have already been verified while in charge of the network, resulting in a double-spending problem.
43. What exactly do you know about the security of a block?
Any users on a network cannot customize a block. As a result, it offers a high degree of security. Furthermore, every block is protected by cryptography, which is yet another vote in this case. As a result, there is no need to be concerned about the protection of data in a block.
44. What is Secret Sharing? Does it have any benefit in Blockchain technology?
It is completely obvious that security is extremely important in digital transactions. In Blockchain technology, secret sharing is a method of dividing secret or personal information into smaller units and sending them to network users. The original knowledge can only be merged with others if a person who has been assigned a share of the secret decides to do so. In Blockchain technology, there are a number of security benefits it can provide.
45. What is Double-Spending? Is it possible to double-spend in a Blockchain system?
It occurs when a single digital token is used several times, since the token is typically made up of a digital file that can be easily cloned. It simply causes inflation, and businesses are forced to take a significant loss. One of the main goals of Blockchain technology is to eradicate this method as much as possible.
Blockchain avoids double-spending by requiring several parties to validate a transaction before it is written to the ledger. It’s no exaggeration to claim that Bitcoin’s entire structure of Blockchain, mining, proof of work, complexity, and so on exists to create this history of transactions that is computationally impractical to change.
46. Explain the significance of a blind signature and how it is useful.
A blind signature is a form of digital signature in which the contents of a message are hidden (blinded) before they’re signed. As with a standard digital signature, the resulting blind signature can be publicly validated against the original, unblinded message.
Blind signatures are often used in privacy-related protocols where the signer and message author are not the same individual. Cryptographic voting systems and digital cash schemes are two examples.
47. When it comes to securing the transaction records, how will you handle risk management when it comes to securing the transaction records?
Risk management is essentially a method of identifying all risks and vulnerabilities to an organization’s financial records. The best thing to do with this strategy is to take the appropriate countermeasures as soon as possible.
Another option is to keep a contingency plan in mind. More methods, such as purchasing new risk management tools, may simply be considered based on the importance of knowledge. Data is most at risk from black-hat hackers.
Enrolling in a blockchain course to gain the skills needed for blockchain development, smart contract creation, and understanding the intricacies of blockchain systems.
48. What are the key principles in Blockchain that are helpful in eliminating the security threats that need to be followed?
To eliminate the security threats, the key Principles that are needed to follow are as follows. All these principles are fundamental and simple to apply. They are helpful in making transaction documents more valuable.
- Auditing
- Securing applications
- Securing testing and similar approaches
- Database security
- Continuity planning
- Digital workforce training
49. Difference between Public and Private Keys?
The cryptographic algorithm that enables peers in a blockchain to obtain funds in their wallets uses a public key. A pair of keys is created when a public key is connected to a private key. The private-public key pair is used to ensure that the blockchain’s security is maintained. A public key is a string of alphanumeric characters that is unique to a specific node or address.
A private key is an alphanumeric term that is used to encrypt and decrypt data associated with a public key. In blockchain security, it is also a component of the cryptographic algorithms. The key has been allocated to the key generator and can only be used by him. If he fails to do so, someone can gain access to the wallet’s information or data, as well as the address for which the private key is stored.
50. How Can You Stop Double-Spending?
With the support of the consensus algorithm, the blockchain prevents double-spending. The consensus algorithm verifies the transaction’s authenticity before recording it in the block. As a result, it is checked by several nodes, allowing for double-spending.
However, since more than 50% of the network is owned by one entity, a 51% network attack will make any blockchain vulnerable to double-spending.
51. What Do You Think About the Future of Blockchain?
Blockchain has a bright future. It is currently in its development phase, with both technical and adoption advancements. Its applications in almost every industry speak volumes about its future.
We will see a big effect on the blockchain, both industrially and in day-to-day life, as more and more investors become interested in blockchain technology. Other technologies, including AI, big data, etc., can also be used in conjunction to make it more effective and practical.
52. Difference Between a Hot Wallet and a Cold Wallet
| Feature | Hot Wallet | Cold Wallet |
|---|
| Internet Connection | Online | Offline |
| Security Level | Lower | Higher |
| Access Speed | Fast | Slower |
| Best For | Daily transactions | Long-term storage |
| Risk | More hack-prone | Safer from cyber attacks |
| Examples | MetaMask, Trust Wallet | Ledger, Trezor |
In short:
- Hot Wallet = Convenient but riskier
- Cold Wallet = Secure but less accessible
53. What is a Sybil Attack?
A Sybil Attack occurs when a malicious actor creates multiple fake identities (nodes) to gain control over a network.
Goals of the Attack
- Manipulate voting or consensus
- Disrupt blockchain operations
- Spread misinformation
Prevention Methods
- Proof-of-Work (PoW)
- Proof-of-Stake (PoS)
- Identity & cost-based validation
In short: Sybil Attack = One attacker pretending to be many users.
54. Explain Zero-Knowledge Proofs (ZK-SNARKs) in Simple Terms
Zero-Knowledge Proofs (ZK-SNARKs) allow someone to prove something is true without revealing the actual information.
Simple Analogy
You prove you know a password
Without revealing the password
Why ZK-SNARKs Matter
- Enhances privacy (private transactions)
- Improves scalability (Layer-2 rollups)
- Used in Zcash, zkSync, StarkNet
Smart Contracts and Blockchain Development
55. Write a Simple “Hello World” Smart Contract in Solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HelloWorld {
string public message = "Hello, World!";
function getMessage() public view returns (string memory) {
return message;
}
function setMessage(string memory _message) public {
message = _message;
}
}
What This Contract Does
- Stores a Hello World message
- Retrieves the message using getMessage()
- Updates the message using setMessage()
56. Difference Between require() and assert() in Solidity
| Feature | require() | assert() |
|---|
| Purpose | Input & condition validation | Detect critical errors |
| Failure Meaning | User or external error | Code bug or invariant failure |
| Gas Refund | Refunds remaining gas | Consumes all gas |
| Usage Type | Runtime checks | Internal logic validation |
| Error Handling | Custom error messages allowed | No custom messages |
Example Code Usage
require(balance >= amount, "Insufficient balance"); // Validate input
assert(totalSupply >= 0); // Ensure internal consistency
57. Write a Solidity Function to Accept Ether (Payable)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract EtherReceiver {
uint public totalReceived;
function deposit() public payable {
totalReceived += msg.value;
}
function getBalance() public view returns (uint) {
return address(this).balance;
}
}
Key Points
- payable allows the function to receive Ether
- msg.value contains the amount of Ether sent
- Contract balance stores received funds
58. What are Events in Solidity? (With Code Snippet)
Events are used to log contract activity on the blockchain so external apps (like DApps) can track transactions and state changes.
Event Example
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract EventDemo {
event Transfer(address indexed from, address indexed to, uint amount);
function send(address _to, uint _amount) public {
emit Transfer(msg.sender, _to, _amount);
}
}
Why Events Matter
- Enable off-chain tracking
- Improve DApp UI updates
- Reduce on-chain storage cost
- Help with auditing & transparency
59. How Do You Write a Modifier in Solidity?
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Ownable {
address public owner;
constructor() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "Not the contract owner");
_;
}
function restrictedAction() public onlyOwner {
// Only owner can call this function
}
}
How It Works
- modifier onlyOwner() checks caller identity
- require() blocks unauthorized access
- _ ; executes the function after validation
Applied using the onlyOwner keyword on functions
60. What is a Reentrancy Attack? (And How to Prevent It with Code)
A reentrancy attack happens when an attacker repeatedly calls a vulnerable function before the contract updates its state, draining funds.
Vulnerable Example (DO NOT USE)
function withdraw(uint amount) public {
require(balances[msg.sender] >= amount);
(bool sent, ) = msg.sender.call{value: amount}("");
require(sent);
balances[msg.sender] -= amount; // State update too late
}
Secure Version (Prevention)
function withdraw(uint amount) public {
require(balances[msg.sender] >= amount);
balances[msg.sender] -= amount; // Update state first
(bool sent, ) = msg.sender.call{value: amount}("");
require(sent);
}
Best Prevention Techniques
- Checks-Effects-Interactions pattern
- Use ReentrancyGuard
- Avoid call() when possible
- Update state before external calls
61. Write a Python Script to Generate a SHA-256 Hash
import hashlib
text = "Hello Blockchain"
hash_object = hashlib.sha256(text.encode())
hash_hex = hash_object.hexdigest()
print("SHA-256 Hash:", hash_hex)
Key Points
- Uses Python’s built-in hashlib
- SHA-256 produces a 256-bit fixed-length hash
- Commonly used in blockchain & cryptography
Blockchain System Design and Real-World Scenarios
62. You need to store large files (images/videos) for an NFT project. Do you store them on-chain?
Short Answer: No. Large NFT media files should be stored off-chain, most likely using IPFS.
It is not feasible to store images or videos on the blockchain itself, as it is too expensive, inefficient, and will cause bloat on the blockchain. Blockchains are meant for storing transactional data, not images or videos.
Best Practice Approach: The actual content of the NFT is stored on IPFS (InterPlanetary File System), which returns a content hash (CID). This is stored within the NFT’s metadata (tokenURI). This is immutable and keeps costs low.
63. You need to get real-time stock prices into your Smart Contract to trigger a trade. Since Blockchain has no internet access, how do you achieve this?
Smart contracts cannot access the internet, meaning they cannot fetch live stock prices or external data directly.
To achieve this, we employ a blockchain oracle solution such as Chainlink. An oracle acts as a bridge between the off-chain real world and on-chain smart contracts.
How it works:
The smart contract asks for price information → Chainlink retrieves the latest prices from trusted APIs → aggregates and verifies the prices → sends the verified price back on chain → the smart contract performs the trading logic.
This ensures that the system remains secure, decentralized, tamper-resistant, and reliable, which is vital in DeFi, automated trading, and financial smart contracts.
64. How would you architect a system to allow a user to pay for a coffee with Bitcoin, but the merchant receives Stablecoins (USDT) instantly?
The basic concept is that a payment gateway is used that supports the real-time conversion of the cryptocurrency. The user pays in Bitcoin, and once the payment is identified, the system converts the BTC into USDT.
In other words, the flow will be as follows: customer sends BTC → a backend service or crypto payment processor verifies the transaction → BTC is exchanged for USDT via an exchange (e.g., Binance or a DEX) → USDT is transferred instantly to the merchant’s wallet.
This setup protects merchants from Bitcoin price volatility, ensures fast settlement, and allows customers to pay using their preferred cryptocurrency while merchants receive a stable asset.
65. You are writing a lottery contract. You need a random number to pick the winner. Can you use block.timestamp or block.difficulty? Why is this dangerous?
No, it is unsafe to use block.timestamp or block.difficulty for randomness because they are subject to tampering by miners/validators. This implies that an attacker might be able to manipulate the outcome, making it unfair.
Due to the predictability and controllability of the block parameters, attackers could try to reorder the transactions and time the blocks in order to maximize their winning chances, thus compromising the integrity of the system and resulting in trust vulnerability.
The correct solution is to utilize Chainlink VRF. This is because Chainlink VRF offers a cryptographically secure and verifiable random number. This ensures that the random number is tamper-proof, unbiased, and fair. This is useful for lotteries and gaming smart contracts.
66. A function in your contract iterates through a list of 5,000 investors to pay dividends. What happens if the list grows to 50,000?
If the contract attempts to loop through 50,000 investors within a single transaction, it will exceed the block gas limit, leading to permanent failure of the transaction. This renders the function useless, which equates to a Denial of Service (DoS).
As this list increases, the cost of gas scales linearly, implying that the more investors are included, the more impossible it becomes for payouts to occur.
The correct solution is to avoid the use of the “Push” payment model, where the contract sends money to everyone, and instead use the “Pull over Push” pattern. In this approach, the contract records each user’s owed balance, and investors claim their dividends themselves by calling a withdrawal function. This spreads gas costs across users and prevents gas-limit failures.
Blockchain Salary Trends
Globally, depending on experience, expertise, and project exposure, the annual salary for blockchain developers in 2026 ranges from $95,000 to $210,000 or more, especially for professionals skilled in smart contracts, DeFi, and Web3 infrastructure.
In India, blockchain developer salaries vary significantly by experience and company size. The average salary now ranges between ₹6,00,000 and ₹28,00,000 per year, with experienced developers earning even higher compensation in product and Web3 startups.
Average Salary by Region (2026)
| Location | Low End | High End | Avg. Salary |
|---|
| Global (US & Europe) | $95k | $210k | $145k |
| Asia | $80k | $160k | $115k |
| Remote (Global Companies) | $100k | $220k | $155k |
Average Salary by Role (2026)
| Role | Avg. Salary ($) |
|---|
| Blockchain Developer | 120,000 |
| Blockchain Architect | 150,000 |
| Blockchain Administrator | 95,000 |
| Blockchain Consultant | 110,000 |
| Smart Contract Engineer | 135,000 |
Wish to Learn Blockchain? Click Here
Frequently Asked Questions
Q1. What job roles are available in the blockchain industry?
Common blockchain job roles include Blockchain Developer, Smart Contract Engineer, Blockchain Architect, Web3 Developer, Blockchain Consultant, and Blockchain Administrator, along with roles in blockchain security, DeFi development, and enterprise blockchain solutions.
Q2. What skills are required to become a blockchain developer?
Key skills include blockchain fundamentals, smart contract development, Solidity programming, cryptography basics, Web3 tools, distributed systems, and backend programming languages like Python, JavaScript, or Go.
Q3. What is the typical blockchain developer interview process?
The interview process generally includes:
Blockchain fundamentals questions
Smart contract or coding tests
System design or scenario-based questions
Security and optimization discussions
Project or portfolio discussion
Q4. Which companies are hiring blockchain professionals?
Companies hiring blockchain talent include Web3 startups, fintech firms, crypto exchanges, gaming platforms, and enterprises adopting blockchain solutions, along with tech companies building decentralized applications and infrastructure.
Q5. Is blockchain development a good career in 2026 and beyond?
Yes, blockchain remains a promising career due to growing adoption in finance, supply chain, gaming, digital identity, and decentralized applications, with strong demand for skilled professionals worldwide.