Blockchain - Interview Questions

Blockchain Basics


What is a blockchain?


Blockchain is a decentralized and distributed digital ledger used to record and store transactions across many computers in a peer-to-peer network. Blockchain was originally designed for the crypto-currency Bitcoin, but has evolved and can be applied to numerous other use cases. Blockchain can be applied to record, track and confirm transactions for virtually anything of value without the need for a central authority, reducing risk and cutting costs for all parties involved.


What are the key characteristics of a blockchain?


Following are the key characteristics of blockchain that gives organizations a high level of trust in the transaction data.

1. Decentralized and Distributed: Unlike a conventional database in which data is stored in central data servers, the data in a blockchain is stored in multiple computers across networks. This makes it impossible for someone to corrupt or manipulate the data.

2. Secure: Blockchain is encrypted. Each block of the blockchain is encrypted to make it secure and unique.

3. Smart contracts: Smart contracts are rules that define the type of transactions that participants can carry out in the blockchain. This ensures that everyone is playing by the same rules.

3. Consensus: There must be an agreement between all relevant parties before a transaction can be executed. This keeps out inaccurate or fraudulent data from the database.

Immutable: Once a transaction is agreed upon and recorded it cannot be changed. You can add another transaction to change its state, but the original transactions remains in history.


How does blockchain work?


Blockchain works as follows.

1. Transaction: Two parties who are part of the blockchain network exchange data. The data can be money, contracts, deeds or any asset that can be represented digitally.

2. Verification: The nodes or computers in the network verify if the transaction is valid based on rules preset on the network.

3. Block: The transaction is added to a block in the network. Each block is identified by a hash generated by an algorithm agreed upon by the network.

4. Mining and validation: Miners validate a block by solving a mathematical puzzle.

5. After the block is validated, it is distributed to all nodes through the network. Each node adds the block to the majority blockchain.


What are the key components of a blockchain ecosystem?


Following are the key components of a blockchain ecosystem.

1. Node application: Every computer that is part of a blockchain ecosystem must install and run an application. For example, in the Bitcoin network every computer must install and run the Bitcoin wallet application.

2. Shared ledger: Shared ledger is the data structure (Blockchain) that is distributed across all the nodes of a blockchain network. The shared ledger can be managed and viewed through the node application that runs on every computer in the network.

3. Consensus algorithm: Consensus algorithm is an algorithm implemented as part of the node application which provides the rules on how the block chain network arrives at a single view of the shared ledger.

4. Virtual machine: Virtual machine is a logical part of the node application. Virtual machine understands a wide range of instructions, manages the state of a digital contracts and enforces the terms of the contract.


What are blocks in a blockchain ecosystem?


Blockchain stores transactional data in blocks which are linked together to form a chain. Hence the name 'Blockchain'.

Each block contains the following.

1. A hash (a digital fingerprint or identifier) that uniquely identifies the block.

2. The hash of the previous block. This links the block to the previous block and hence forms the blockchain. It also prevents any block from being altered or a block being inserted between two existing blocks.

3. Transactions: Each block contains a batch of timestamped transactions.



What are the different types of blockchains?


There are three types of blockchains.

Public blockchain: Public blockchain is a public network which is open and anyone can participate in the network. Decision making happens by various decentralized consensus mechanisms such as proof of work (POW) and proof of stake (POS) etc.

Private blockchain: Private blockchain is the private property of an individual party or an organization. One person or organization is in charge of private blockchain and dictates the rules of the blockchain. Permission has to be granted to participate in the blockchain network.

Consortium or federated blockchains: In a consortium or federated blockchain network there are more than one party in in charge. Basically, a group of organizations or representative individuals come together and make decisions for the benefit of the whole network.


What are Merkle trees? What are the key benefits of Merkle trees?


Merkle trees are data structures in which every leaf node is a hash of a block of data, and every non-leaf node is a hash of its child nodes. Merkle tree is also called as a Hash tree.

Merkle trees are created from bottom up, by repeatedly hashing pairs of nodes until only one hash is left. This hash is called the root hash or the Merkle root.

Following are the key benefits of Merkle trees.

1. Data Integrity - Merkle trees provide a means to maintain and prove the integrity and validity of data. Merkle root maintains the integrity of data since it summarizes all data in related transactions. If a single transaction or the order of transactions change, then the Merkle root changes too.

2. Merkle trees require very little memory and disk space. The proofs are computationally fast and easy.

Merkle tree proofs and management require only tiny amounts of information to be transmitted across networks for verification.


How are merkle trees used in Blockchains?


Blocks in a Blockchain contain transactional data that must be secure, tamper proof and maintained in a chronological order. Blockchain uses Merkle trees to achieve these requirements.

The transactions in a block are hashed and and encoded into a Merkle tree.


 
Subscribe to our Newsletter

 
 
RECOMMENDED RESOURCES
Behaviorial Interview
Top resource to prepare for behaviorial and situational interview questions.

STAR Interview Example