DEV Community

Cover image for Blockchain Interview Questions for Freshers 📝
Jemmy Dalsaniya
Jemmy Dalsaniya

Posted on • Edited on

Blockchain Interview Questions for Freshers 📝

Table of Contents

  1. What is Blockchain?
  2. What is Byzantine Fault Tolerance?
  3. What is Consensus Protocol?
  4. What is a Block?
  5. What values does a Block contain?
  6. What is the Genesis Block?
  7. What is a Ledger? How is Blockchain's distributed ledger different from a traditional ledger?
  8. What is Cryptography?
  9. What are the different types of Blockchain?
  10. What is a Smart Contract and its applications?
  11. What is the Ethereum Network? How many Ethereum networks are there?
  12. Where do nodes run smart contract code? What is EVM?
  13. What is a Dapp?
  14. What is Proof of Work?
  15. What is Proof of Stake?
  16. What is the nonce, and how is it used in mining?
  17. List and explain the parts of EVM memory.
  18. What does gas usage depend on, and how is the transaction fee calculated?
  19. What is a 51% attack?
  20. What are function modifiers in Solidity? Mention the most widely used modifiers.
  21. What features does Blockchain provide?
  22. What are Merkle Trees? Explain the concept.
  23. How do verifiers check if a block is valid?
  24. What is a trapdoor function, and why is it needed in blockchain development?
  25. What is mining?
  26. What is DAO and DAO Attack?
  27. What is chain forking and its types?
  28. What is Blockchain Wallet and How Does It Work?
  29. What is pruning?
  30. Blockchain vs Hyperledger?
  31. Can You explain the components of Blockchain Ecosystem?
  32. What is NFT?
  33. Explain interoperability.
  34. What is Mempool?

What is Blockchain?

Blockchain is a distributed, immutable ledger that stores transaction details in the form of permanent records called blocks, which are secured through cryptography.

Back to Top↑


What is Byzantine Fault Tolerance?

The recovery mechanism allow the algorithm to tolerate any number of faults over the lifetime of the system provided fewer than 1/3 of the replicas become faulty within small window of vulnerability.

In simple words if the block wanted to get inserted in blockchain or if any transaction have to be done in the blockchain , it has to be approved by the 66.66% or 2/3 of peers or block miners even though 1/3 block miner or peers reject it.

Back to Top↑


What is Consensus Protocol?

The Consensus protocol says that if only 51% of miners have the majority to add the block then that block will be added to the blockchain. Thus it need only 51% majority while Byzantine Fault Tolerance need approximately 67%.

Back to Top↑


What is a Block?

Blocks are files stored by a blockchain, where transaction data are permanently recorded. A block records some or all of the most recent transactions not yet validated by the network. Once the data are validated, the block is closed. Then, a new block is created for new transactions to be entered into and validated.

Back to Top↑


What values does a Block contain?

A block contains:

  • Nonce: A random number for mining and validation
  • Timestamp: Date and time of creation
  • Data: Information or transactions in the block
  • Prev Hash: Hash of the previous block, linking it to the current block
  • Hash: Unique identifier of the block, generated by hashing its contents

Back to Top↑


What is the Genesis Block?

The genesis block is the first block in the Blockchain which is also known as block 0. In Blockchain, it is the only block that doesn’t refer to its previous block.
It defines the parameters of the Blockchain such as,level of difficulty,consensus mechanism etc. to mine blocks

Back to Top↑


What is a Ledger? How is Blockchain's distributed ledger different from a traditional ledger?

A ledger is a constantly growing file. It maintains a permanent record of all transactions between two parties on the blockchain network. Blockchain ledgers are transparent, irreversible, and secure. They have no central authority and no single point of failure, and they share a copy of the ledger among all participants.

Back to Top↑


What is Cryptography?

Blockchain uses cryptography to secure identities and ensure safe transactions with a hash function. SHA-256, a cryptographic algorithm, generates a 64-character output for any input, which is irreversible.

Back to Top↑


What are the different types of Blockchain?

There are three types:

  • Public Blockchain: Visible to all users; open for any user to add transactions (e.g., Bitcoin, Ethereum)
  • Private Blockchain: Permissioned, specific users can verify and add transactions (e.g., Blockstack)
  • Consortium Blockchain: Consensus controlled by specific nodes, but visible to all participants (e.g., Ripple)

Back to Top↑


What is a Smart Contract and its applications?

Smart contracts are self-executing contracts with agreed terms between parties. They’re used in various applications like financial services, supply chain management, and legal agreements.

Back to Top↑


What is the Ethereum Network? How many Ethereum networks are there?

Ethereum is a blockchain-based distributed computing platform featuring smart contract functionality that enables users to create and deploy their decentralized applications

There are three types of networks in Ethereum:

  • Live network (main network) - Smart contracts are deployed on the main network

  • Test network (like Ropsten, Kovan, Rinkeby) - Allow users to run their smart contracts with no fees before deploying it on the main network.

  • Private network - Are those which are not connected to the main network. They run within the premises of the organization but carry the features of an Ethereum network.

Back to Top↑


Where do nodes run smart contract code? What is EVM?

Nodes run smart contracts code on Ethereum Virtual Machine (EVM). It is a virtual machine designed to operate as a runtime environment for Ethereum-based smart contracts.

EVM is operated in a sandboxed environment (isolated from the main network). This is a perfect testing environment.

You can download the EVM, run your smart contract locally in an isolated manner and once you have tested and verified it, you can deploy it on the main network.

Back to Top↑


What is a Dapp?

A Dapp is a decentralized application which is deployed using smart contract. A Dapp has its back-end code (smart contract) which runs on a decentralized peer-to-peer network

Back to Top↑


What is Proof of Work?

In Blockchain, PoW is the process of solving a complex mathematical puzzle called mining. Here, the probability of mining a block is based upon the amount of computational work done by a miner. Miners spend a lot of computing power (with hardware) for solving the cryptographic puzzle.

Back to Top↑


What is Proof of Stake?

PoS is an alternative to PoW in which the Blockchain aims to achieve distributed consensus. The probability of validating a block relies upon the number of tokens you own. The more tokens you have, the more chances you get to validate a block. It was created as a solution to minimize the use of expensive resources spent in mining.

Back to Top↑


What is the nonce, and how is it used in mining?

In Blockchain, mining is a process to validate transactions by solving a difficult mathematical puzzle called proof of work. Now, proof of work is the process to determine a number (nonce) along with a cryptographic hash algorithm to produce a hash value lower than a predefined target. The nonce is a random value that is used to vary the value of hash so that the final hash value meets the hash conditions.

Back to Top↑


List and explain the parts of EVM memory.

  • Storage:Storage values are stored permanently on the Blockchain network.It is extremely expensive
  • Memory:Memory is a temporary modifiable storage. It can be accessed only during contract execution. Once the execution is finished, its data is lost
  • Stack:A stack is temporary and non-modifiable storage.Here, when the execution completes, the content is lost. Back to Top↑

What does gas usage depend on, and how is the transaction fee calculated?

Gas usage depends on storage and instructions in a smart contract. The transaction fee is calculated as:

Ether = Tx Fees = Gas Limit * Gas Price

Back to Top↑


What is a 51% attack?

In Blockchain, a 51% attack refers to a vulnerability where an individual or group of people controls the majority of the mining power (hash rate). This allows attackers to prevent new transactions from being confirmed. Further, they can double-spend the coins. In a 51% attack, smaller cryptocurrencies are being attacked.

Back to Top↑


What are function modifiers in Solidity? Mention the most widely used modifiers.

It can build additional features or apply restrictions on the function of smart contracts. The most extensively used function modifiers in solidity are:

  • View, which are functions that cannot modify the state of a smart contract. They are read-only functions. Refer to our video to see an example of a View function
  • Pure, which are functions that neither read nor write the state of a smart contract. They return the same result determined by its input values. Refer to our video to see an example of a Pure function

Back to Top↑


What features does Blockchain provide?

  • Decentralized: Blockchain is a decentralized technology. There is no central governing authority that manages the network. Rather every node has a copy of the ledger and each node contribute to maintaining the Blockchain network.
  • Immutable: Data stored in a blockchain cannot be altered or manipulated. Once a transaction is added to the ledger, it resides there permanently.
  • Security: It uses a strong encryption algorithm like SHA-256 which ensures another layer of security.
  • Open Ledger: The ledger is the record of transactions done and because it is visible to everyone, therefore is called an open ledger. Every node in the network has a copy of the ledger. So there is trust among participants as they can clearly check what is happening in the network.
  • Consensus Mechanism: Blockchain works on some consensus protocols. A consensus algorithm is a procedure through which all the nodes of the Blockchain network reach a common agreement about the present state of the distributed ledger.

Back to Top↑


What is Merkle Trees? Explain the concept.

Merkle trees data structure is also called a binary hash tree. It helps to verify whether a transaction can be added to a block or not. Every transaction is hashed through the proper algorithms. Each leaf node is a hash of the transaction and the non-leaf node is a hash of its previous hashes (child hashes). The hash generated at the end (or top of the tree) is called the Merkle Root.

This Merkle root is stored in the block header. Thus, a block header contains Merkle Root, Hash of the previous block, Timestamp, and Nonce. All of them help to make the block tamper-proof and maintain the integrity of the data.

This Merkle Tree structure is used by both Bitcoin and Ethereum.

Back to Top↑


How do verifiers check if a block is valid?

The block data structure is syntactically valid
The block header hash is equal to or less than the target (enforces the Proof-of-Work)

The block timestamp is less than two hours in the future (allowing for time errors)

The block size is within acceptable limits

The first transaction (and only the first) is a coinbase transaction

All transactions within the block are valid using the transaction checklist discussed in Independent Verification of Transactions
Back to Top↑


What is a trapdoor function, and why is it needed in blockchain development?

A trapdoor function is a function that is easy to compute in one direction but difficult to compute in the opposite direction unless you have special information. Trapdoor functions are essential for public key encryption—that’s why they are commonly used in blockchain development to represent the ideas of addresses and private keys.

Back to Top↑


What is mining?

Mining is the process of reaching consensus in blockchain networks. Mining serves two purposes. First, it creates new coins in a generated block. Second, it includes transactions in a distributed ledger by providing proof of work to the network; that is, proof that the generated block is valid.

Back to Top↑


What is DAO and DAO Attack?

A decentralized autonomous organization (DAO) is a self-governing organization implemented on the blockchain. It operates based on smart contracts and allows members to participate in decision-making and governance without central authority.

On June 17, 2016, the DAO was subjected to an attack exploiting a combination of vulnerabilities, including the one concerning recursive calls, that resulted in the transfer of 3.6 million Ether - around a third of the 11.5 million Ether that had been committed to The DAO - valued at the time at around $50 million.

“The DAO” is the name of the first DAO launched by ‘Slock.it‘, a blockchain firm built on the Ethereum platform.

The DAO was a type of investor-directed venture capital fund created through a token sale, and it grew to become one of the greatest crowdfunding campaigns in history.

Back to Top↑


What is chain forking and its types?

Forks in blockchain mean copying the code and modifying it to create a new software or product.

There are two types of forking:

Hard Forking: When the blockchain protocol is altered in a non-backwards-compatible way. When there is a change in the software that runs on the full nodes to function as a network participant, the change is such that the new blocks mined on the basis of new rules (in the Blockchain protocol) are not considered valid by the old version of the software.

Soft Forking: When the blockchain protocol is altered in a backwards-compatible way. In a soft fork, you tend to add new rules such that they do not clash with the old rules.

Example: Bitcoin Cash and Bitcoin, Ethereum and Ethereum Classic.

Back to Top↑


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.

Back to Top↑


What is pruning?

Pruning in blockchain is a process where old, unnecessary data is removed to save space and keep the blockchain efficient. It focuses on retaining only the essential information needed for the current state of the blockchain, allowing it to operate without storing the full history of all past transactions. This helps reduce storage requirements and improve performance.

Back to Top↑


Blockchain vs Hyperledger?

Blockchain: A decentralized, distributed ledger technology that records transactions across many computers securely and transparently. It's often public and open for anyone to participate in, like Bitcoin and Ethereum.

Hyperledger: A project under the Linux Foundation that provides a framework for building private, permissioned blockchain networks. Unlike public blockchains, Hyperledger networks are designed for businesses, where only authorized participants can access and contribute to the ledger. It's more focused on confidentiality and control within a consortium of trusted parties.

Back to Top↑


Can You explain the components of Blockchain Ecosystem?

Components of a blockchain: A blockchain network consists of nodes, a distributed ledger, an asset, and a consensus algorithm. Sometimes, it also includes a virtual machine and a state database.

Nodes: Nodes form the structure of the blockchain network. Nodes on the network are tasked with different responsibilities, such as a miner and a validator.

Distributed ledger: The distributed ledger is also known as the database of the blockchain. Every node on the network has a copy of the ledger to provide fault tolerance to the network. A ledger is immutable and visible to everyone on the blockchain network.

Asset: An asset can be virtually anything, either physical or non-physical, having a value recognized by the nodes in the network. Some examples of assets are as follows:

Financial transactions: Blockchains like Bitcoin and Dogecoin use a ledger to store the data of transactions of their cryptocurrencies.

Code blocks: Blockchains like Ethereum use it to store code in the form of smart contracts, which serves as the basis of the concept of Dapps.

Medical records: Private blockchains usually store patients’ medical records to maintain integrity in an untrustworthy environment.

Business transactions: Businesses can use private blockchains while performing transactions involving other businesses to ensure the integrity of the product and that certain conditions are met, leading to more security and accountability.

Consensus algorithm: The consensus algorithm sends the transaction performed by the miner to the validator nodes to reach a consensus. If consensus is reached, the transaction is added to the ledger, or else it is discarded.

Virtual machine: Blockchains like Ethereum run virtual machines on their nodes. They are used to execute code written in smart contracts. This is done to ensure that if the code being executed on the nodes contains malware, it will not affect the node executing the code. Instead, it will just affect the virtual machine running on top of the actual hardware, saving the node.

State Database: It is a key-value database that represents the current state of the network. It is calculated by traversing the ledger. It is used to save time during transactions, as during every transaction, the updated state of the network is required, and the traversal of the whole ledger in every transaction will slow down the network.

Back to Top↑


What is NFT?

Non-fungible tokens, often referred to as NFTs, are blockchain-based tokens that each represent a unique asset like a piece of art, digital content, or media. An NFT can be thought of as an irrevocable digital certificate of ownership and authenticity for a given asset, whether digital or physical.

Back to Top↑


Explain interoperability.

Interoperability refers to the ability of different blockchains or DApps to communicate with each other, exchange data, and interact with each other seamlessly. It allows for the flow of information and value across different blockchain networks.

Back to Top↑


What is Mempool?

The mempool acts as a waiting area for unmined blockchain transactions. These transactions have been validated but still need to be added to the blockchain. The phrase "mempool" is a contraction of "memory" and "pool," and it refers to a node's storage area where validated transactions wait to be mined and added to the blockchain.

Back to Top↑

Top comments (0)