Question Bank Answers
Question Bank Answers
● Naming
● Access control
● Security
● Availability
● Performance
● Mutual exclusion of users, fairness
● Consistency in some cases
● Byzantine fault is the one where the faulty node exhibits malicious or
inconsistent behavior arbitrarily.
● difficult to handle since it can create confusion due to misleading information.
● This can be a result of an attack by adversaries, a software bug, or data
corruption.
● State machine replication protocols such as PBFT used to handle this fault.
5. List out the challenges in Distributed System Design.
● Peers refer to the nodes or computers that perform the same tasks and
have the same power within a block chain network,
● is based on the decentralization concept, which lets network participants
conduct transactions without needing any middle- man, intermediaries
or central server.
● no administrator is required to maintain track of user transactions on the
network.
● the peers in the network cooperate to handle deals and manage the BTC
● no common P2P protocol for blockchains has been suggested.
● Instead, different cryptocurrencies have developed and adapted their
own peer-to- peer protocols.
● NameNode :
○ aka master node
○ Manages all the slave nodes
○ Executes operations like opening,closing and renaming files
○ Stores metadata and requires high amount of ram
○ A single point of failure
● DataNode :
○ aka Slave Node
○ Does the actual work of reading,writing and processing the files
○ They also perform creation deletion and replication upon
instruction from the master node
○ Requires high memory as data is stored here
Let's assume we don't replicate and only one yellow block is present on
datanode D1. Now if the data node D1 crashes we will lose the block and
which will make the overall data inconsistent and faulty. So we replicate the
blocks to achieve fault-tolerance.
Note: No two replicas of the same block are present on the same datanode.
15. Explain the generic elements of a block chain with suitable diagrams.
1. Address
● Unique identifiers used in a transaction on the blockchain.
● They can be reused
● Good practice is for users to generate new address for each transaction to
prevent identification
2. Transaction
● fundamental unit of a blockchain.
● represents a transfer of value from one address to another.
● Each transaction includes details such as the sender’s address, recipient’s
address, amount, and digital signature, which authenticates and authorizes
the transfer.
3. Block
● composed of multiple transactions and some other elements such as the
previous block hash (hash pointer), timestamp, and nonce.
● Blocks are linked in chronological order to form the blockchain
4. Nodes
● performs various functions depending on the type of the blockchain used and
the role assigned to the node.
● 2 types of nodes -> full and light nodes
● Full nodes: store a complete copy of the Blockchain ledger
● Light nodes: only store the necessary data to verify transactions.
5. Smart Contract
● These programs run on top of the blockchain and encapsulate the business
logic to be executed when certain conditions are met.
● The smart contract feature is not available in all blockchains but is now
becoming a very desirable feature due to the flexibility.
● Enforceable and automatically executable
6. Virtual Machine
● is an extension of a transaction script
● allows Turing complete code to be run on a Blockchain
● Various blockchains use virtual machines to run programs, for example
Ethereum Virtual Machine (EVM) is used in Ethereum and Chain Virtual
Machine (CVM) used in chain core
7. State Machine
● can be viewed as a state transition mechanism.
● a state is modified from its initial form to the next and eventually to a final form
as a result of a transaction execution and validation process by nodes.
16. Compare and contrast the different types of blockchain. Also List out the
Benefits and limitations of block chain.
1. Public Blockchain
● They are open to the public, and anyone can participate as a node in the
decision-making process.
● Users may or may not be rewarded for their participation.
● These ledgers are not owned by anyone and are publicly open for anyone to
participate in.
● All users maintain a copy of the ledger on their local nodes
● Ex: Bitcoin and Ethereum
2. Private Blockchains
● open only to a consortium or group of individuals or organizations who have
decided to share the ledger among themselves.
● Ex: HydraChain and Quorum.
3. Semi-private Blockchains
● Part of the blockchain is private and part of it is public.
● The private part is controlled by a group of individuals, while the public part is
open for participation by anyone.
● The primary goal is to promote organizational collaboration to address
industry-specific challenges.
● This is still just a concept today, and no real world POCs are yet to be
developed.
4. Permissioned ledger
● is a blockchain where participants of the network are already known and
trusted.
● do not need to use a distributed consensus mechanism
● an agreement protocol is used to maintain a shared version of the truth about
the state of the records on the blockchain.
● There is also no requirement for a permissioned blockchain to be private as it
can be a public blockchain but with regulated access control.
6. Tokenized blockchains
● These blockchains are standard blockchains that generate cryptocurrency as
a result of a consensus process via mining or initial distribution.
● Ex: Bitcoin and Ethereum
7. Tokenless blockchains
● designed in such a way that they do not have the basic unit for the transfer of
value
● However, they are still valuable in situations where there is no need to
transfer value between nodes and only the sharing of data among various
trusted parties is required.
● This is similar to full private blockchains, the only difference being that use of
tokens is not required
BENEFITS
● Decentralization
● Transparency and trust
● Immutability
● High availability
● Highly secure
● Simplification of current paradigms
● Faster dealings
● Cost saving
LIMITATIONS
● Scalability
● Adaptability
● Regulation
● Relatively immature technology
● Privacy
● requires nodes to compete in a leader- election lottery, and the node that wins
proposes a final value.
● scale very well but perform very slowly.
● For example, the PoW used in Bitcoin falls into this category
● Proof-based, leader-election lottery based, or the Nakamoto consensus
whereby a leader is elected at random (using an algorithm) and proposes
a final value. This category is also referred to as the fully decentralized
or permissionless type of consensus mechanism. This type is well used
in the Bitcoin and Ethereum blockchain in the form of a PoW
mechanism. Scale very well but perform very slowly.
● BFT-based is a more traditional approach based on rounds of votes. This
class of consensus is also known as the consortium or permissioned
type of consensus mechanism. Perform well when there are a limited
number of nodes, but they do not scale well.
18. List and explain the different types of consensus mechanisms used in block
chain technology.
1. Proof of Work
● relies on proof that adequate computational resources have been spent
before proposing a value
● This scheme is used in Bitcoin, Litecoin, and other cryptocurrency
blockchains.
● only algorithm that has proven to be successful against any collusion attacks
like Sybil attack
2. Proof of Stake
● works on the idea that a node or user has an adequate stake in the system;
that is, the user has invested enough in the system so that any malicious
attempt by that user would outweigh the benefits of performing such an attack
on the network.
● Introduced by Peercoin and used in the Ethereum blockchain version called
Serenity.
● Coin Age -> criterion derived from the amount of time and number of coins
that have not been spent.
● chances of proposing and signing the next block increase with the coin age.
4. Proof of Importance
● not only relies on how large a stake a user has in the system, but it also
monitors the usage and movement of tokens by the user in order to establish
a level of trust and importance.
● used in the NEM coin blockchain.
5. Proof of Capacity
● uses hard disk space as a resource to mine the blocks.
● Different from PoW, where CPU resources are used.
● also known as hard drive mining
● first introduced in the Burstcoin cryptocurrency.
7. Proof of activity
● combination of PoS and PoW
● ensures that a stakeholder is selected in a pseudorandom but uniform
fashion.
● comparatively more energy-efficient mechanism as compared to PoW
● utilizes a new concept called Follow the Satoshi
● POW - first stage POS - other stages
8. Proof of Deposit
● Nodes that wish to participate in the network have to make a security deposit
before they can mine and propose blocks.
● This mechanism is used in the Tendermint blockchain.
19. Write a suitable scenario where the following consensus algorithms can be
used.
Proof of work
● When security is of utmost importance irrespective of time and
computer resources. An example given is Bitcoin.
Proof of stake
● A user wants to use a blockchain for quick transactions and lesser
computational resources are available
Proof of deposit
● If the user enters the blockchain purely for transactions and needs them
to be done quickly
Proof of importance
● when reliability is important, but the system allows for unauthorized
users to also participate in the blockchain.
Proof of activity
● This consensus is suitable for networks that want both security and
energy efficiency.
Proof of capacity
● When a network wants to leverage hard drive storage instead of
computational power.
Proof of storage
● Suitable for decentralized storage networks where participants are
rewarded based on the amount of storage they contribute, such as
Filecoin.
● provide a means of associating a message with an entity from which the message
has originated. Used to provide data origin authentication and non-repudiation
1. Preimage resistance
● h(x) = y
● h is the hash function, x is the input, and y is the hash.
● The first security property requires that y cannot be reverse-computed to x.
● x is considered a preimage of y, hence the name preimage resistance
● This is also called a one-way property.
3. Collision resistance
● h(x) != h(z)
● The collision resistance property requires that two different input messages
should not hash to the same output.
● This property is also known as strong collision resistance.
● Focuses on the difficulty of finding any two distinct inputs that produce the
same hash.
● This property ensures that it is difficult to find any two different messages that
hash to the same value, without specifying one of the messages beforehand.
● SHA-256 has the input message size < 264-bits. Block size is 512-bits, and it haFlis
a word size of 32-bits. The output is a 256-bit digest.
1. Preprocessing
● Padding of the message is used to adjust the length of a block to 512-bits if it
is smaller than the required block size of 512-bits
● Parsing the message into message blocks, which ensures that the message
and its padding is divided into equal blocks of 512-bits.
● Setting up the initial hash value, which consists of the eight 32-bit words
obtained by taking the first 32-bits of the fractional parts of the square roots of
the first eight prime numbers
● These initial values are randomly chosen to initialize the process, and they
provide a level of confidence that no backdoor exists in the algorithm.
2. Hash Computation
● Each message block is then processed in a sequence, and it requires 64
rounds to compute the full hash output.
● Each round uses slightly different constants to ensure that no two rounds are
the same.
● The message schedule is prepared.
● Eight working variables are initialized.
● The intermediate hash value is calculated.
● Finally, the message is processed, and the output hash is produced
● In the preceding diagram, a, b, c, d, e, f, g, and h are the registers. Maj and Ch are
applied bitwise.
● Σ0 and Σ1 perform bitwise rotation.
● Round constants are Wj and Kj, which are added, mod 232.
26.Give an appropriate scenario where the following wallets can be
used.
a. Non deterministic wallets
b. Brain Wallets
c. Mobile Wallets
d. Online Wallets
e. Hierarchical Deterministic Wallets
f. Paper Wallets
2. Deterministic wallets
● In this type of wallet, keys are derived out of a seed value via hash functions.
This seed number is generated randomly and is commonly represented by
human-readable mnemonic code words.
● Mnemonic code words are defined in BIP 39, a Bitcoin improvement proposal
for mnemonic code for generating deterministic keys.
● Makes the Private key management easier
4. Brain wallets
● The master private key can also be derived from the hash of passwords that
are memorized.
● The key idea is that this passphrase is used to derive the private key and if
used in HD wallets, this can result in a full HD wallet that is derived from a
single memorized password.
● This method is prone to password guessing and brute force attacks.
5. Paper wallets
● As the name implies, this is a paper-based wallet with the required key
material printed on it.
● It requires physical security to be stored.
6. Hardware wallets
● Another method is to use a tamper-resistant device to store keys. This
tamper-resistant device can be custom built
● or with the advent of NFC-enabled phones, this can also be a Secure
Element (SE) in NFC phones.
● Trezor and Ledger wallets (various types) are the most commonly used
Bitcoin hardware wallets
7. Online wallets
● Online wallets, as the name implies, are stored entirely online and are
provided as a service usually via the cloud.
● They provide a web interface to the users to manage their wallets and
perform various functions such as making and receiving payments.
● They are easy to use but imply that the user trusts the online wallet service
provider.
8. Mobile wallets
● Mobile wallets, as the name suggests, are installed on mobile devices.
● They can provide various methods to make payments, most notably the ability
to use smartphone cameras to scan QR codes quickly and make payments.
● Mobile wallets are available for the Android platform and iOS
● As the hash rate of the bitcoin network increased, the total amount of 32-bit nonces
was exhausted too quickly.
● In order to address this issue, the extra nonce solution was implemented, whereby
the coinbase transaction is used as a source of extra nonce to provide a larger range
of nonces to be searched by the miners.
bitcoin-cli getdifficulty
30.Represent a genesis block with a suitable diagram.
● Assume Alice wishes to pay Bob $1. If Alice and Bob pay with
actual currency, Alice will lose the $1 when the transaction is
completed.
● The dilemma becomes more difficult if Alice and Bob use digital
money.
● Digital money is in the form of a digital file that can be easily
copied. If Alice sends Bob a $1 digital file over email, for example,
Bob has no way of knowing if Alice has deleted her copy of the
file.
● If Alice still has the $1 digital file, she has the option of sending it
to Carol.
● Double spending is the term for this issue.
● If Alice sends money in digital format to Bob. Bob cannot know
for sure if Alice has deleted her copy of the file and she can choose
to send the same file to Carol.
● To avoid double spending, blockchain networks use a consensus
mechanism, like Proof of Work or Proof of Stake, which requires
all transactions to be validated by the majority of nodes before
being added to the blockchain.
● Additionally, each transaction includes unique cryptographic
signatures and references previous transaction outputs, ensuring
that each coin can only be spent once.
39. Assume that you are asked to establish a peer to peer connection
among non standard nodes in the bitcoin network. Identify suitable
protocol to do so and justify your answer.
Mr.X uses a wallet which stores randomly generated private keys for
making payments in the bitcoin network. -> Non Deterministic wallet
Mr.X uses a wallet in which keys are derived out of a seed value via
hash functions. -> Deterministic wallet
Mr.X uses a wallet which stores private keys in a tree structure
derived from a seed. -> Hierarchical Deterministic wallets
Mr.X uses a wallet in which master private key can also be derived
from the hash of passwords that are memorized -> Brain wallets
Mr.X uses a wallet which uses a tamper-resistant device to store keys.
-> Hardware wallets
Mr.X uses a wallet which provides various methods to make
payments, most notably the ability to use smartphone cameras to
scan QR codes quickly and make payments. -> Mobile wallets
41. Compare and contrast Hard Fork and Soft Fork in the Bitcoin
network.
HARD FORK
SOFT FORK
● A soft fork is a minor change of a blockchain protocol that results in two parallel
versions of the protocol, meaning that all blockchain nodes operate on the same
network, but some of them under the old rules and some under the new ones.
● A soft fork is an improvement of the blockchain's performance, with the old and new
protocols functioning harmoniously in the same network.
42. Discuss briefly about the elements of the Ethereum block chain.
43. List out the steps involved in Ethereum state transition functions.
44. Compare and Contrast the properties of Externally Owned Accounts and
Contract Accounts.
They are capable of sending They can get triggered and execute
transactions code in response to a transaction or a
message from other contracts.
They are controlled by private keys CAs can maintain their permanent
state and can call other contracts.
They are associated with a human They are not intrinsically associated
user with any user or actor on the
blockchain.
45. What are the different types of transactions in Ethereum Blockchain?
46. List out the essential parameters that are required when creating an
account.
● Sender
● Original transactor (transaction originator)
● Available gas
● Gas price
● Endowment, which is the amount of ether allocated
● A byte array of an arbitrary length
● Initialization EVM code
● Current depth of the message call/contract-creation stack (current depth
means the number of items that are already there in the stack)
● Automatically executable
● Enforceable
● Semantically sound
● Secure and unstoppable
Bitcoin Ethereum
The iterator performs various functions that are used to set the next state of the
machine and eventually the world state. The functions include;
● It fetches the next instruction from a byte array where the machine code is stored in
the execution environment.
● It adds/removes (PUSH/POP) items from the stack accordingly.
● Gas is reduced according to the gas cost of the instructions/opcodes.
● It increments the Program Counter (PC).
2. Scalability
● allow reasonable transaction throughput, which will be sufficient for all
business requirements and also a large number of users.
3. Deterministic Transactions
● This is a core requirement as if transactions do not produce the same result
every time they are executed regardless of who and where the transaction is
executed, then achieving consensus is impossible.
4. Identity
● To provide privacy and confidentiality services, a flexible PKI model that can
be used to handle the access control functionality is also required.
● The strength and type of cryptographic mechanisms is also expected to vary
according to the needs and requirements of the users
● In certain scenarios, it might be required for a user to hide their identity, and
as such, the Hyperledger is expected to provide this functionality.
5. Auditability
● It is expected that an immutable audit trail of all identities, related operations,
and any changes is kept.
6. Interoperability
● Currently, there are many blockchain platforms available, but they cannot
communicate with each other
● It is important that they are able to communicate with each other.
● There should be a common set of standards that all blockchains can follow in
order to allow communication between different ledgers.
7. Portability
● concerned with the ability to run across multiple platforms and environments
without the need to change anything at code level.
● It is envisaged to be portable, not only at infrastructure level but also at code,
libraries, and API levels, so that it can support uniform development across
various implementations of Hyperledger.
60. Assume the following scenario. Mr.X wants to discover the list of peers
participating in his peer to peer network and transfer 100 ether to his
immediate peer using hyperledger fabric. Explain the different kind of
message communication he is supposed to use in order to complete the
given scenario.
1. Peers
● Peers participate in maintaining the state of the distributed ledger.
They also hold a local copy of the distributed ledger.
● Peers communicate via gossip protocol.
● There are three types of peers
● Endorsing peers
○ simulate the transaction execution and generate a
read-write set.
○ Endorses execute and endorse transactions.
○ It should be noted that an endorser is also a committer too.
● Committing peers
○ receives transaction endorsed by endorsers, verify them
and then update the ledger with the read-write set.
○ verifies the read-write set generated by the endorsers along
with transaction validation.
● Submitters
○ has not been implemented yet. It is on the development
roadmap and will be implemented.
2. Orderer nodes
● receive transactions from endorsers along with read-write sets,
arrange them in a sequence, and send those to committing peers.
● Committing peers then perform validation and commit to the
ledger.
● All peers make use of certificates issued by membership services.
3. Clients
● software that makes use of APIs to interact with the Hyperledger
Fabric and propose transactions.
4. Channels
● allow the flow of confidential transactions between different
parties on the network.
● They allow using the same blockchain network but with separate
blockchains.
● Channels allow only members of the channel to view the
transaction related to them, all other members of the network will
not be able to view the transactions.
5. World State Database
● World state reflects all committed transaction on the blockchain.
● key-value store which is updated as a result of transactions and
chaincode execution.
● either LevelDB or CouchDB is used.
● LevelDB is a key-value store whereas CouchDB stores data as
JSON objects which allows rich queries to run against the
database
6. Transactions
● divided into two types: deployment transactions and invocation
transactions.
● The former is used to deploy new chaincode to the ledger, and the
latter is used to call functions from the smart contract.
● Transactions can be either public or confidential.
● Public transactions are open and available to all participants
whilst confidential transactions are visible only in a channel open
to its participants.
8. Smart contracts
● In Hyperledger Fabric the same concept of smart contracts is
implemented but they are called chain code instead of smart
contracts.
● They contain conditions and parameters to execute transactions
and update the ledger Chaincode is usually written in Golang and
Java.
62. Describe the membership services offered by hyper ledger fabric
These services are used to provide access control capability for the users of the
fabric network
● They make use of Certificate authority in order to support identity management and
authorization operations
● This CA can be internal which is a default interface in Hyperledger Fabric or
organization can opt to use an external CA
● Fabric CA issues enrollment certificates (E-Certs), which are produced by enrollment
certificate authority (E-CA).
● Once peers are issued with an identity, they are allowed to join the blockchain
network.
● There are also temporary certificates issued called TCerts, which are used for
one-time transactions.
● All peers and applications are identified using certificate authority.
● Authentication service is provided by the certificate authority.
1. Consensus Layer
● responsible for facilitating the agreement process between the participants on
the blockchain network.
● The consensus is required to make sure that the order and state of
transactions is validated and agreed
3. Communication Layer
● responsible for message transmission and exchange between the nodes on
the blockchain network.
5. Data Stores
● provides an ability to use different data stores for storing state of the ledger.
● This means that data stores are also pluggable and allows usage of any
database backend.
6. Policy Services
● provide the ability to manage different policies required for the blockchain
network.
● includes endorsement policy and consensus policy.
Legacy Wallet:
Bitcoin Mainnet:
Bitcoin Testnet:
74. Draw and explain the components of the Fabric application stack.
75. Prerequisite software: the base layer needed to run the software, for example,
Docker.
76. Fabric and Fabric samples: the Fabric executables to run a Fabric network along
with sample code.
77. Contract APIs: to develop smart contracts executed on a Fabric Network.
78. Application APIs: to develop your blockchain application.
79. The Application: your blockchain application will utilize the Application SDKs to
call smart contracts running on a Fabric network
(if required in detail)
Fabric Application Stack is a well-structured framework used to develop, deploy, and manage
blockchain applications on the Hyperledger Fabric platform. It consists of five layers, each building on
the previous one, from setting up infrastructure to creating and running a complete blockchain
application.
1. Prerequisite Software (Base Layer) - This layer provides the foundational software needed to run
the components of a Hyperledger Fabric network. It ensures the proper environment setup, using
virtualization tools and dependency managers to prepare the system for Fabric deployment. Tools
include -
● Docker - Fabric components like peer nodes, orders and CA run in isolated Docker
containers
● Kubernetes - large-scale networks opt for Kubernetes to orchestrate fabric containers across
multiple nodes
2. Fabric and Fabric Samples - core fabric network layer - This layer consists of the essential
binaries and sample projects that form the backbone of any Hyperledger Fabric network. It enables
the deployment of blockchain networks and serves as a sandbox for testing configurations. Fabric
components include peers, orderers and CA. Fabric Samples are example projects to help developers
get familiar with Fabric architecture and functionality
3. Contract APIs (Smart Contract Development Layer) - The smart contract layer, also called the
chaincode layer, defines the logic for business transactions. These contracts run on peer nodes and
enforce the rules for updating the ledger. Contract operations include - installation, deployment,
state management.
4. Application APIs (Development Layer for Blockchain Applications) - This layer provides SDKs
and APIs that developers use to create blockchain-based applications. It allows external applications
to interact with the Fabric network by calling smart contracts and querying the ledger. Key API
functions include - transaction submission, query operations, identity and authentication, event
listeners
5. The Application (Blockchain Application Layer) - This is the top-most layer where your
blockchain solution is deployed and operated. The application is responsible for delivering value to
end-users by leveraging the underlying Fabric network.
80. Write a chain code for asset transfer from one client to another client
using JavaScript.