DEV Community

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

Posted on • Updated on

Blockchain Interview Questions for Freshers 📝

  • What is Blockchain ?

-> Blockchain is a disrtibuted immutable ledger which stores transaction details in the form of immutable records called blocks which are secured using cryptography.

  • 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.

  • 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%.

  • What is 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.

  • Block contain what values ?

-> Block contain the following values

Nonce: A random number used for mining and validating the block.
Timestamp: The date and time when the block was created.
Data: The information or transactions stored in the block.
Prev Hash: The hash value of the previous block, linking it to the current block.
Hash: The unique identifier of the block, created by hashing the block's content.

BLock

  • What is genisis 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

  • What is ledger? How is Blockchain 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.

A Blockchain distributed ledger is highly transparent as compared to a traditional ledger.

Blockchain distributed ledgers are irreversible. Information registered on a distributed ledger cannot be modified whereas on a traditional ledger it is reversible.

A distributed ledger is more secure. It uses cryptography and every transaction is hashed and recorded whereas in traditional ledger security can be compromised.

In a distributed ledger, there is no central authority. It is a distributed system and the participants hold the authority to maintain the sanity of the network and are responsible for validating the transactions. Traditional ledgers are based on the concept of centralized control, which controls all transactions.

In a distributed ledger, identities are unknown and hidden whereas in traditional ledger identities of all participants have to be known before the transactions happen.

In a distributed ledger, there is no single point of failure as the data is distributed and information is shared across multiple nodes. If one node fails, the other nodes carry the same copy of the information.
In comparison, traditional ledgers have a single point of failure. If a single system crashes, the entire network comes to a standstill.
In a distributed ledger, data modification or change cannot be done but for a traditional ledger, it is possible.

The copy of the ledger is shared amongst participants in a distributed ledger while in a traditional ledger, a single copy is maintained in a centralized location. It is not shared amongst the participants.

  • What is cryptography?

-> Blockchain uses cryptography to secure users identities and ensure transactions are done safely with a hash function.

Cryptography uses public and private keys in order to encrypt and decrypt data. In the Blockchain network, a public key can be shared with all the Bitcoin users but a private key (just like a password) is kept secret with the users.

Blockchain uses SHA - 256 which is secure and provides a unique hash output for every input. The basic feature of this algorithm is whatever input you pass, it will give you a standard alphanumeric output of 64 characters. It is a one-way function from which you can derive an encrypted value from the input, but not vice-versa.

  • What are the different types of Blockchain?

-> There are three different types of Blockchain - Public, Private, and Consortium Blockchain.

Public Blockchain ledgers are visible to all the users on the internet and any user can verify and add a block of transactions to the Blockchain. Examples, Bitcoin, and Ethereum.

Private Blockchain ledgers are visible to users on the internet but only specific users in the organization can verify and add transactions. It’s a permissioned blockchain, although the information is available publicly, the controllers of the information are within the organization and are predetermined. Example, Blockstack.

In Consortium Blockchain, the consensus process is controlled by only specific nodes. However, ledgers are visible to all participants in the consortium Blockchain. Example, Ripple.

  • What is a smart contract and list some of its applications?

-> Smart contracts are self-executing contracts which contain the terms and conditions of an agreement between the peers.

  • What is the Ethereum network and how many Ethereum networks are you familiar with?

-> 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.

  • Where do nodes run a smart contract code? or 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.

  • 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

  • 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.

  • 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.

  • 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.

  • List and explain the parts of EVM memory.

-> The memory of an EVM is divided into three types:

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.

  • What does the gas usage in a transaction depend on and how is the transaction fee calculated?

-> Gas usage depends upon the amount of storage and set of instructions (codes) used in a smart contract. The transaction fee is calculated in Ether, which is given as:

Ether = Tx Fees = Gas Limit * Gas Price

  • 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.

  • 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

  • What are the features provided by Blockchain?

-> 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.

  • What is Merkle Trees? Explain their 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.

  • 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

  • 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.

  • 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.

  • 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.

  • What is chain forking and its types ?

-> Forks in blockchain means 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 soft fork you tend to add new rules such that they do not clash with the old rules.

Example : Bitcoin Cash and Bitcoin , Etherium and Etherium classic

  • 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.

  • What is pruninig?

-> 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

Top comments (0)