Unit 1 Updated

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 113

BLOCKCHAIN ARCHITECTURE DESIGN

KIT-061
Unit-1
By-
Shrankhla Saxena
Assistant professor
CSIT Dept.
Overview of Blockchain
• Blockchain is a shared, immutable ledger that facilitates the process of
recording transactions and tracking assets in a business network.
• An asset can be tangible (a house, car, cash, land) or intangible
(intellectual property, patents, copyrights, branding).
• Virtually anything of value can be tracked and traded on a blockchain
network, reducing risk and cutting costs for all involved.
Importance of Blockchain
• Business runs on information. The faster it’s received and the more
accurate it is, the better.
• Blockchain is ideal for delivering that information because it provides
immediate, shared and completely transparent information stored on an
immutable ledger that can be accessed only by permissioned network
members.
• A blockchain network can track orders, payments, accounts, production
and much more.
• And because members share a single view of the truth, you can see all
details of a transaction end to end, giving you greater confidence, as well
as new efficiencies and opportunities.
Key elements of a blockchain

• Distributed ledger technology


• All network participants have access to the distributed ledger and its immutable
record of transactions. With this shared ledger, transactions are recorded only
once, eliminating the duplication of effort that’s typical of traditional business
networks.
• Immutable records
• No participant can change or tamper with a transaction after it’s been recorded to
the shared ledger. If a transaction record includes an error, a new transaction must
be added to reverse the error, and both transactions are then visible.
• Smart contracts
• To speed transactions, a set of rules — called a smart contract — is stored on the
blockchain and executed automatically. A smart contract can define conditions for
corporate bond transfers, include terms for travel insurance to be paid and much
more.
Working of Blockchain
• As each transaction occurs, it is recorded as a “block” of data
• Those transactions show the movement of an asset that can be tangible (a product) or
intangible (intellectual). The data block can record the information of your choice: who,
what, when, where, how much and even the condition — such as the temperature of a
food shipment.
• Each block is connected to the ones before and after it
• These blocks form a chain of data as an asset moves from place to place or ownership
changes hands. The blocks confirm the exact time and sequence of transactions, and the
blocks link securely together to prevent any block from being altered or a block being
inserted between two existing blocks.
• Transactions are blocked together in an irreversible chain: a blockchain
• Each additional block strengthens the verification of the previous block and hence the
entire blockchain. This renders the blockchain tamper-evident, delivering the key strength
of immutability. This removes the possibility of tampering by a malicious actor — and
builds a ledger of transactions you and other network members can trust.
Benefits of Blockchain
• Greater trust
• With blockchain, as a member of a members-only network, you can rest assured that
you are receiving accurate and timely data, and that your confidential blockchain
records will be shared only with network members to whom you have specifically
granted access.
• Greater security
• Consensus on data accuracy is required from all network members, and all validated
transactions are immutable because they are recorded permanently. No one, not even a
system administrator, can delete a transaction.
• More efficiencies
• With a distributed ledger that is shared among members of a network, time-wasting
record reconciliations are eliminated. And to speed transactions, a set of rules — called
a smart contract — can be stored on the blockchain and executed automatically.
Blockchain vs Database
Blockchain Database
• Blockchain is decentralized because there is no
admin or in-charge. • The database is centralized because it has admins
and in-charge.
• Blockchain is permissionless because anyone can
access it. • The database required permission because it can
be accessed only by entities who have rights to
• Blockchains are slow. . access.
• It has a history of records and ownership of digital • Databases are fast
records. • It has no history of records and ownership of
• Blockchain is fully confidential. records.
• The database is not fully confidential.
• Blockchain has only Insert operation.
• The database has Create, Read, Update, and
• It is a fully robust technology. Delete operation.
• Disintermediation is allowed with blockchain. • It is not entirely robust technology.
• Anyone with the right proof of work can write on • Disintermediation is not allowed with the database
the blockchain. • Only entities entitled to read or write can do so.
• Blockchain is not recursive. Here, we cannot go • The database is recursive. Here, we can go back to
back to repeat a task on any record. repeat a task on a particular record.
What is Cryptography
• Cryptography is technique of securing information and communications
through use of codes so that only those person for whom the information is
intended can understand it and process it.
• Thus preventing unauthorized access to information. The prefix “crypt”
means “hidden” and suffix graphy means “writing”.
• In Cryptography the techniques which are use to protect information are
obtained from mathematical concepts and a set of rule based calculations
known as algorithms to convert messages in ways that make it hard to
decode it.
• These algorithms are used for cryptographic key generation, digital signing,
verification to protect data privacy, web browsing on internet and to protect
confidential transactions such as credit card and debit card transactions.
Techniques used For Cryptography
• In today’s age of computers cryptography is often
associated with the process where an ordinary plain
text is converted to cipher text which is the text made
such that intended receiver of the text can only decode
it and hence this process is known as encryption. The
process of conversion of cipher text to plain text this is
known as decryption.
Features Of Cryptography are as follows:
1.Confidentiality:
Information can only be accessed by the person for whom it is intended and no
other person except him can access it.
2.Integrity:
Information cannot be modified in storage or transition between sender and
intended receiver without any addition to information being detected.
3.Non-repudiation:
The creator/sender of information cannot deny his or her intention to send
information at later stage.
4.Authentication:
The identities of sender and receiver are confirmed. As well as destination /origin
of information is confirmed.
Types Of Cryptography:
• In general there are three types Of cryptography:
1.Symmetric Key Cryptography:
It is an encryption system where the sender and receiver of message use a single common
key to encrypt and decrypt messages. Symmetric Key Systems are faster and simpler but
the problem is that sender and receiver have to somehow exchange key in a secure
manner. The most popular symmetric key cryptography system is Data Encryption
System(DES).
2.Hash Functions:
There is no usage of any key in this algorithm. A hash value with fixed length is
calculated as per the plain text which makes it impossible for contents of plain text to be
recovered. Many operating systems use hash functions to encrypt passwords.
3.Asymmetric Key Cryptography:
Under this system a pair of keys is used to encrypt and decrypt information. A public key
is used for encryption and a private key is used for decryption. Public key and Private
Key are different. Even if the public key is known by everyone the intended receiver can
only decode it because he alone knows the private key.
Permissionless vs. Permissioned
Blockchains
• All types of blockchains can be characterized as permissionless,
permissioned, or both. Permissionless blockchains allow any user
to pseudo-anonymously join the blockchain network (that is, to
become “nodes” of the network) and do not restrict the rights of the
nodes on the blockchain network.
• Conversely, permissioned blockchains restrict access to the network
to certain nodes and may also restrict the rights of those nodes on that
network. The identities of the users of a permissioned blockchain are
known to the other users of that permissioned blockchain.
Permissionless vs. Permissioned
Blockchains
• Permissionless blockchains tend to be more secure than permissioned
blockchains, because there are many nodes to validate transactions,
and it would be difficult for bad actors to collude on the network.
However, permissionless blockchains also tend to have long
transaction processing times due to the large number of nodes and the
large size of the transactions.
• On the other hand, permissioned blockchains tend to be more
efficient. Because access to the network is restricted, there are fewer
nodes on the blockchain, resulting in less processing time per
transaction.
Types of Blockchain Networks
• Public blockchain networks
• A public blockchain is one that anyone can join and participate in, such as
Bitcoin. Drawbacks might include substantial computational power required,
little or no privacy for transactions, and weak security. These are important
considerations for enterprise use cases of blockchain.
• Private blockchain networks
• A private blockchain network, similar to a public blockchain network, is a
decentralized peer-to-peer network. However, one organization governs the
network, controlling who is allowed to participate, execute a consensus protocol
and maintain the shared ledger. Depending on the use case, this can significantly
boost trust and confidence between participants. A private blockchain can be run
behind a corporate firewall and even be hosted on premises.
Types of Blockchain Networks
• Public blockchain networks
• Public blockchains are permissionless in nature, allow anyone to join, and are completely decentralized.
Public blockchains allow all nodes of the blockchain to have equal rights to access the blockchain, create
new blocks of data, and validate blocks of data. A public blockchain is one that anyone can join and
participate in, such as Bitcoin. Drawbacks might include substantial computational power required, little or
no privacy for transactions, and weak security. These are important considerations for enterprise use
cases of blockchain. To date, public blockchains are primarily used for exchanging and
mining cryptocurrency. You may have heard of popular public blockchains such as Bitcoin, Ethereum, and
Litecoin.
• Private blockchain networks
• Private blockchains, which may also be referred to as managed blockchains, are permissioned blockchains
controlled by a single organization. In a private blockchain, the central authority determines who can be a
node. The central authority also does not necessarily grant each node with equal rights to perform
functions. Private blockchains are only partially decentralized because public access to these blockchains
is restricted. Some examples of private blockchains are the business-to-business virtual currency exchange
network Ripple and Hyperledger, an umbrella project of open-source blockchain applications. A private
blockchain network, similar to a public blockchain network, is a decentralized peer-to-peer network.
However, one organization governs the network, controlling who is allowed to participate, execute a
consensus protocol and maintain the shared ledger. Depending on the use case, this can significantly boost
trust and confidence between participants. A private blockchain can be run behind a corporate firewall and
even be hosted on premises.
• Both private and public blockchains have drawbacks - public
blockchains tend to have longer validation times for new data than
private blockchains, and private blockchains are more vulnerable to
fraud and bad actors. To address these drawbacks, consortium and
hybrid blockchains were developed.
Types of Blockchain Networks
• Consortium blockchains
• Consortium blockchains are permissioned blockchains governed by a group of
organizations, rather than one entity, as in the case of the private blockchain.
Consortium blockchains, therefore, enjoy more decentralization than private
blockchains, resulting in higher levels of security. Multiple organizations can
share the responsibilities of maintaining a blockchain. These pre-selected
organizations determine who may submit transactions or access the data. A
consortium blockchain is ideal for business when all participants need to be
permissioned and have a shared responsibility for the blockchain. However,
setting up consortiums can be a fraught process as it requires cooperation
between a number of organizations, which presents logistical challenges as
well as potential antitrust risk.
Types of Blockchain Networks
• Hybrid blockchains
A hybrid blockchain is a unique type of blockchain technology that
amalgamates components of both public and private blockchain or tries to
utilize the ideal part of both public and private blockchain solutions. The
hybrid blockchain members can decide who can participate in the blockchain
or which transactions are made public. This brings the best of both worlds and
ensures that a company can work with its stakeholders in the best possible way.
Hybrid blockchains are blockchains that are controlled by a single
organization, but with a level of oversight performed by the public blockchain,
which is required to perform certain transaction validations. An example of a
hybrid blockchain is IBM Food Trust, which was developed to improve
efficiency throughout the whole food supply chain.
Digital Money to Distributed Ledger
• Distributed ledger technology (DLT) is a digital system for recording the transaction of
assets in which the transactions and their details are recorded in multiple places at the
same time. Unlike traditional databases, distributed ledgers have no central data store or
administration functionality.
• In a distributed ledger, each node processes and verifies every item, thereby generating
a record of each item and creating a consensus on its veracity. A distributed ledger can
be used to record static data, such as a registry, and dynamic data, such as financial
transactions.
• A distributed ledger is a type of database that is shared, replicated, and synchronized
among the members of a decentralized network.
• The distributed ledger records the transactions, such as the exchange of assets or data,
among the participants in the network.
• A peer-to-peer network is required as well as consensus algorithms to ensure replication
across nodes is undertaken. One form of distributed ledger design is
the blockchain system, which can be either public or private.
What is distributed ledger
technology?
• Distributed ledger technology (DLT) refers specifically to the
technological infrastructure and protocols that allow the simultaneous
access, validation and updating of records that characterizes
distributed ledgers. It works on a computer network spread over
multiple entities or locations.
• DLT uses cryptography to securely store data, cryptographic
signatures and keys to allow access only to authorized users.
• The technology also creates an immutable database, which means
information, once stored, cannot be deleted and any updates are
permanently recorded for posterity.
Protocols
• A blockchain is a network of multiple devices (nodes) — all equally important —
connected to each other through the internet.
• Essentially, a blockchain is a ledger which stores the record of what has come in and gone
out in a distributed p2p manner after the transaction has been verified by all
participating nodes.
• This distributed ledger works on pre-defined rules which are agreed upon by all the
participating nodes (the peers) in the network. These rules include:
1.a how-to for governing and validating transactions,
2.an algorithm that defines the mechanism for all participating nodes to interact with each
other, and,
3.(in some cases), application programming interface.
• These rules that govern a blockchain network are referred to as a protocol.
Protocols: Terminologies for Blockchain
Protocol
• Distributed Ledgers: Distributed ledgers are a type of database that are spread
across the multiple peers and the records are stored one after the other in a
continuous ledger. A distributed ledger, also known as a shared ledger, replicates,
shares, and synchronizes data digitally and shares it across the network in various
sites.
• Smart Contracts: a set of logic rules in the form of a coded script which can be
embedded into the blockchain to govern a transaction. It is an agreement
between two parties stored on a blockchain. It is a set of code that executes
automatically when the predetermined conditions are met. A smart contract is
stored on the public database; it cannot be moved or changed.
Protocols: Terminologies for Blockchain
Protocol
• Consensus algorithm: an algorithm that defines the way consensus will be
reached on the network to verify the transactions. A consensus algorithm
determines who is responsible for validating the records’ blocks and how
other participants can authenticate them. The algorithm ensures a standard
agreement among the participants regarding the state of a distributed ledger.
Protocols: Terminologies for Blockchain
Protocol
• Coins and Tokens: Every blockchain protocol needs a digital asset to keep the
network running. These are also used as incentives for the peers who
participate in the network. This entails the presence of digital assets such as
coins and tokens. The two terms are often used interchangeably in the realm
of blockchain but there is a subtle difference between the two.
• Coins are defined at the lowest level by the protocol itself. Coins are
the native digital asset of a blockchain network. For instance, bitcoin
protocol’s native currency is Bitcoin.
• Tokens are the digital assets that are defined at a higher level not by the
protocol but by smart contracts. For instance, the Ethereum protocol has a
native coin Ether. Ethereum allows developers to build, among other things,
Decentralized Applications (dApps) on its protocol. The node-communication
rules for one dApp can be different from another dApp which are defined by
smart contracts. Tokens are, therefore, the native digital asset of dApps.
Protocols: Terminologies for Blockchain
Protocol
• 51% Attack: the ability of someone controlling more than 50% of network nodes to revise
transaction history and indulge in double spending.
• A 51% attack occurs on the Proof-of-Work (PoW) algorithm when miners or groups of miners try to
hoard more than 50% of the network’s mining or computing power. The control of such mining
power can lead to blocking new transactions from being placed or getting confirmed. The PoW
algorithm is responsible for validating transactions and avoiding the double spending of
cryptocurrencies.
• Example: The nodes on a blockchain network are supposed to broadcast the blocks they form to the
entire network. If a node, or a group of nodes, begin to control more than 50% of the network, it can
indulge in forming blocks privately and not broadcast those to the network. The network would still
follow the public version of the blockchain and the node can indulge in double-spending by first
spending their money on the public blockchain and then on the private one.
• After that, since they control 51% of the network, they can broadcast their private version of the
blockchain and form longer chains. Because of the longest chain rule (which regards the longest
chain to be the most legitimate chain to mine on), the other participants will consider this to be the
correct chain. The previous transactions that were not included in this chain (because it was private)
will be reversed giving the malicious nodes access to other people’s money.
What is a dApp?
• A decentralized application (dApp) is a type of distributed open source software
application that runs on a peer-to-peer (P2P) blockchain network rather than on
a single computer. DApps are visibly similar to other software applications that
are supported on a website or mobile device but are P2P supported.
• The decentralized nature of dApps means that once a developer has released a
dApp's codebase, others can build on top of it. The app is free from the control of
a single authority. A dApp is developed to create a variety of applications,
including those for decentralized finance, web browsing, gaming and social
media.
• DApps are built on a decentralized network that is supported by a blockchain
distributed ledger. The use of blockchain enables a dApp to process data
through distributed networks and to execute transactions. dApps are also often
built using the Ethereum platform.
• Distributed ledger technologies like the Ethereum blockchain have helped
popularize dApps. The major advantages of dApps are that they are always
accessible and do not have a single point of failure.
Why does blockchain needs a protocol
• Due to decentralized nature of blockchain i.e. the centralized
authority is absent.
• To make it work as intended
• Peers need to be connected and maintain a ledger copy
• And on top of it there’s a consensus method to validate transactions
into blocks
• All this can be achieved using blockchain protocols.
Protocols: Steps to Create
• Step-by-step Guide
• Find Your Niche. ...
• Design a Workflow for Blockchain Integration. ...
• Choose Between New and Existing Blockchain. ...
• Choose Between Private and Public Blockchain.
• Choose a Relevant Consensus Mechanism.
• Choose a Relevant Platform. ...
• Decide Whether You Need Smart Contracts. ...
• Making a Final Decision.
Protocols: Bitcoin
• allowing crypto payment transactions over a decentralised network.
• Public, permissionless blockchain which anyone can join.
• Underlying technology components: cryptographic hash function, digital
signature, p2p network, private-and-public key encryption, and proof-
of-work (PoW) consensus algorithm.
• Every node has access to complete information on the blockchain.
Therefore, Decentralised.
• Users can conduct non-reversible transactions without the need to
explicitly trust a third-party.
• Native cryptocurrency Bitcoin
Protocols: Ethereum
• a blockchain platform for developers to launch their own blockchain
projects and decentralized applications.
• Public, permissionless blockchain
• Underlying technology components: cryptographic hash function, digital
signature, p2p network, private-and-public key encryption,
and proof-of-work consensus algorithm.
• Every node has access to complete information on the blockchain.
• Users can conduct non-reversible transactions without the need to
explicitly trust a third-party.
• Native cryptocurrency Ether.
Protocols: Hyperledger
• Hyperledger is an open-source enterprise project and acts as an umbrella for frameworks,
guidelines and standards, and tools to build blockchains and blockchain-based enterprise
applications.
• Creating a permissioned blockchain protocol that can be followed by enterprise solutions.
• The libraries included in the Hyperledger protocol aims to develop and deploy blockchain
solutions fast and efficiently.
• It provides industry-wide association and a framework that can be used across many
industries to enhance a transactions’ performance and speed.
• It is hosted by the Linux Foundation, and thus works effectively on servers across
enterprises.
• It includes member organizations that are leaders in finance, IoT, supply chains, etc.
• The sub-projects operating under Hyperledger are Hyperledger Fabric, Sawtooth,
Composer, Burrow, Explorer, and Cello.
Protocols: Hyperledger
• Key features-
• Enhanced productivity with help of frameworks and tools
• Good quality of code implementation due to its open source nature.
• Better at handling intellectual property
• Offers collaborative approach
Protocols: Corda
• It is another open-source blockchain project that is specifically designed for businesses.
• It is used to build blockchain platforms that can solve complex enterprise-related problems.
• Utilizes distributed ledger software along with consensus algorithms to ensure
transparency, traceability and transaction validation.
• It helps cut down record-keeping costs and provides development services such as Corda
App Consulting, User Interfaces, Regulated Tokens, etc.
• Corda allows businesses to transact directly with the help of its smart contract technology.
• Therefore, it can create interoperable blockchain networks to complete the transactions in a
secured infrastructure, ensuring transparency, traceability, and validation.
• The R3 banking consortium develops Corda, and most of the applications developed
through it have been implemented or deployed in the finance and banking industry.
Protocols: Corda
• Key features-
• Ability to create smart contracts
• Offers unique services and timestamping with notary pools
• Flow frameworks that enables enterprise to write complex protocols
and make them work with different user levels.
• Open source and permissioned
Protocols: Quorum
• Invented by JP Morgan, Quorum is an open-source blockchain protocol beneficial for businesses
in the finance sector.
• Aimed to solve finance sector problems
• A Quorum was built on the Ethereum framework, and it is growing towards becoming the best
possible enterprise blockchain protocol.
• It is also open source project and available under LGPL 3.0 license.
• It can be used to develop in-house tools or third-party applications. It was specifically designed to
be permissioned, ensuring the transactions are private.
• It uses a consortium approach, meaning it has to be authorized by a specified entity.
• Serves permissioned networks better.
• Quorum architecture includes three components — Quorum Node, Constellation — Transaction
Manager, and Constellation — Enclave.
• The architecture maintains a permissioned network with privacy and enhanced performance.
Protocols: Quorum
• Key features-
• Offers better performance
• Makes use of voting based consensus mechanisms
• Open source and fairly mature for an organizational application
• Offers trustworthy network and is enterprise ready for
implementation
• Offers enhanced transactions and contract privacy
Protocols: MultiChain
• MultiChain is also an open-source blockchain platform that offers APIs to provide
blockchain development services to update integration and complete the deployment
speedily.
• It provides a command-line interface along with the API to preserve and build the chain.
• It helps enterprises to create private blockchains for carrying out efficient transactions
and build blockchain-based applications.
• It allows for creating multiple key-value and identity databases on a blockchain network
for timestamping and data sharing.
• MultiChain technology is used by enterprises to conduct financial transactions.
• It allows the creation and deployment of private blockchains within the enterprise or
among two or more enterprises. Before carrying out the transfer of assets on the chain,
every node must be configured with MultiChain.
Blockchain Security
• Blockchain security is a comprehensive risk management system for a blockchain network, using
cybersecurity frameworks, assurance services and best practices to reduce risks against attacks
and fraud
• Blockchain technology's data structures have inherent security qualities because they are based
on consensus, cryptography, and decentralization principles. Each new block of information
connects to all the previous blocks in a way that it's nearly impossible to tamper with. In addition,
all transactions in a block get validated and agreed on by a consensus mechanism (authorized
users), guaranteeing that each transaction is true and accurate. Thus, there is no point of failure,
and a user can’t change transaction records.
• The records on a blockchain are secured through cryptography. Network participants have their
own private keys that are assigned to the transactions they make and act as a personal
digital signature. If a record is altered, the signature will become invalid and the peer network will
know right away that something has happened. Early notification is crucial to preventing further
damage.
Blockchain Security
• A blockchain network is only as secure as its infrastructure
• When establishing a private blockchain, you must decide the best platform for deployment. Even
though blockchain has inherent properties that provide security, known vulnerabilities in your
infrastructure can be manipulated by those with ill intent. Ideally, you should have an
infrastructure with integrated security that can:
• Prevent anyone — even root users and administrators — from accessing sensitive
information
• Deny illicit attempts to change data or applications within the network.
• Carefully guard encryption keys using the highest-grade security standards so they can never
be misappropriated.
• With these capabilities, your blockchain network will have the added protection it needs to
prevent attacks from within and without.
What makes the Bitcoin blockchain
safe?
• The cryptographic system makes transactions irreversible — in other
words, a block once created on the chain cannot be modified.
However, you can add information to it. This restricts people from
being able to reverse any transaction that has already taken place.
• The Bitcoin blockchain is public. While the words transparency and
public do not sound safe, in the case of Bitcoin it is. Despite the
anonymity of the user, all transactions on the network are accessible
to the public, making it difficult to hack or cheat the system.
• It is decentralized. The Bitcoin network is distributed and has
thousands of nodes all over the world that keep track of all
transactions happening on the system. This ensures that in case
something goes wrong on one server, there are others to pick up the
slack. Hacking into any one server is pointless.
Blockchain Security
• Blockchain Security Challenges
• Blockchain isn’t perfect. There are ways that cyber criminals can manipulate blockchain’s
vulnerabilities and cause severe damage. Here are four ways that hackers can attack blockchain
technology.
• Routing attacks. Blockchains depend on immense data transfers performed in real-time.
Resourceful hackers can intercept the data on its way to ISPs (Internet Service Providers).
Unfortunately, blockchain users don’t notice anything amiss.
• 51% attacks. Large-scale public blockchains use a massive amount of computing power to
perform mining. However, a group of unethical miners can seize control over a ledger if they can
bring together enough resources to acquire more than 50% of a blockchain network’s mining
power. Private blockchains aren’t susceptible to 51% attacks, however.
• Sybil attacks. Named for the book that deals with multiple personality disorder, Sybil attacks flood
the target network with an overwhelming amount of false identities, crashing the system.
• Phishing attacks. This classic hacker tactic works with blockchain as well. Phishing is a scam
wherein cyber-criminals send false but convincing-looking emails to wallet owners, asking for
their credentials.
Blockchain Security
• Blockchain Security Examples
• Mobilecoin: This California-based cryptocurrency company is developing a secure, user-friendly
cryptocurrency for businesses that cannot afford to implement ledger security measures
independently. Mobilecoin’s cryptocurrency replaces third-party transaction vendors, keeping all the
transaction data encrypted at both ends. The product works with Facebook Messenger, WhatsApp,
and Signal.
• Coinbase: Here’s another California-based cryptocurrency company. Coinbase is an exchange for
selling and purchasing digital currency. Running entirely on encryption, Coinbase stores wallets and
passwords in a secure database. Employees must undergo a rigorous background check to ensure
cryptocurrency safety.
• J.P. Morgan: J.P. Morgan is the largest and one of the most popular financial institutions in the United
States. It has developed an enterprise-focused version of Ethereum called Quorum, using blockchain
technology to process private transactions. J.P. Morgan uses smart contracts on their Quorum network
to create transparent yet cryptographically assured transactions.
Consensus
• A consensus mechanism enables the blockchain network to attain reliability and build a level of trust
between different nodes, while ensuring security in the environment.
• Consensus decision-making is a group decision-making process in which group members develop, and
agree to support a decision in the best interest of the whole.
• Objective
• Unified Agreement: The protocols embedded in the Distributed blockchain network ensures that the
data involved in the process is true and accurate, and the status of the public ledger is up-to-date.
• Align Economic Incentive: A consensus blockchain protocol, in this situation, offers rewards for good
behavior and punishes the bad actors. This way, it ensures regulating economic incentives too.
• Fair & Equitable: Consensus mechanisms enable anyone to participate in the network and use the
same basics.
• Prevent Double Spending: Consensus mechanisms works on the basis of certain algorithms that
ensures that only those transactions are included in the public transparent ledger which are verified
and valid.
• Fault Tolerant: The governed system would work indefinite times even in the case of failures and
threats.
Consensus Algorithms: 1. Proof of Work
• Developed by Satoshi Nakamoto, Proof of Work is the oldest consensus mechanism used in the Blockchain
domain. It is also known as mining where the participating nodes are called miners.
• In this mechanism, the miners have to solve complex mathematical puzzles using comprehensive
computation power. They use different forms of mining methods, such as GPU mining, CPU mining, ASIC
mining, and FPGA mining. And the one that solves the problem at the earliest gets a block as a reward.
• The Proof of Work mechanism is used by multiple cryptocurrencies like Bitcoin, Litecoin, ZCash,
Primecoin, Monero, and Vertcoin to name a few.
• In bitcoin consensus algorithm each block is intended to generate a hash value, and the nonce is the
parameter that is used to generate that hash value.
• In cryptography, a nonce (number once) is an arbitrary number that can be used just once in a
cryptographic communication. It is often a random or pseudo-random number issued in an authentication
protocol to ensure that old communications cannot be reused in replay attacks.
• The Proof of Work (PoW) has not only influenced the financial industry, but also healthcare, governance,
management and more. It has, in fact, offered the opportunity of multichannel payments and multi-
signature transactions over an address for enhancing security.
Consensus Algorithms: 2. Proof of Stake
(PoS)
• The most basic and environmentally-friendly alternative of PoW consensus protocol.
• The block producers are not miners, but they act like validators. They get the opportunity to create a block
over everyone which saves energy and reduces the time. However, for them to become a validator, they
are supposed to invest some amount of money or stake.
• Also, unlike that in the case of PoW, miners are provided with a privilege to take their transaction fees in
this algorithm for there is no reward system in this consensus model.
• This, as a whole, encouraged brands like Ethereum to upgrade their model from PoW to PoS in
their Ethereum 2.0 update. Also, it helped various Blockchain ecosystems like Dash, Peercoin, Decred,
Reddcoin, and PivX to function properly.
• Now, while PoS solved various issues earlier associated with PoW, there were many challenges still
undusted in the market. To mitigate those challenges and deliver an enhanced blockchain environment,
several variations of PoS came into existence.
Consensus Algorithms: 2. Proof of Stake
(PoS)
• The two popular variations of Proof of Stake (PoS) are DPoS and LPoS.
• Delegated Proof of Stake (DPoS)
• In the case of Delegated Proof of Stake (DPoS), the participants stake their coin and vote for a certain
number of delegates such that the more they invest, the more weightage they receive. For example: if
user A spends 10 coins for a delegate and user B invests 5 coins, A’s vote gets more weightage than that of
B.
• The delegates also get rewarded in the form of transaction fees or a certain amount of coins.
• Because of this stake-weighted voting mechanism, DPoS is one of the fastest blockchain consensus models
and highly preferred as a digital democracy. Some of the real-life use cases of this blockchain consensus
mechanism are Steem, EOS, and BitShares.
Consensus Algorithms: 2. Proof of Stake
(PoS)
• Leased Proof of Stake (LPoS)
• LPoS is an enhanced version of PoS consensus mechanism that operates on the Waves platform.
• Unlike the regular Proof-of-Stake method where each node with some amount of cryptocurrency is
entitled to add the next blockchain, users can lease their balance to full nodes in this consensus algorithm
blockchain. And the one that leases the bigger amount to the full node has a higher probability of
generating the next block. Also, the leaser is then rewarded with a percentage of transaction fee that has
been collected by the complete node.
• This PoS variant is an efficient and safe option for the development of public cryptocurrencies.
Consensus Algorithms: 3. Proof of Authority
• Proof of Authority is a modified version of Proof of Stake in which the identities of validators in the network
are at stake.
• Proof of Authority is a consensus algorithm that is based on reputation creating a practical and efficient
solutions for blockchain networks especially when it comes to private ones.
• The main form of leverage in PoA is none other than user’s identity, meaning that a block validator is not
staking coins, but their very own reputation.
• This means that PoA blockchains are secured by validating nodes that are randomly chosen to serve as
trustworthy entities.
• In this, to verify the validator’s identity, the identity is the resemblance between validators’ personal
identification and their official documentation.
• These validators put their reputation on the network. In Proof of Authority, the nodes (that become
validators) are the only ones allowed to produce new blocks.
• PoA uses a limited number of block validators, which makes the system highly scalable.
• Validators whose identity is at risk are incentivized to secure and preserve the blockchain network. In this
proof, the number of validators are fairly small, around 25 or less.
Advantages of PoA
• Unlike PoW and similar to PoS, PoA does not rely on solving puzzles in order to make
sure that there is a continuous connection between nodes.
• This means that a PoA validator does not require special equipment to help maintain
the network.
• This also is great for reducing the amount of power used.
• PoA also enjoys a greater speed for validating transactions.
• Blocks are generated in predictable sequence by taking into consideration the
number of validators, which means that the blockchain will enjoy a higher
transaction rate when compared to Pow or PoS.
• PoA also stands out thanks to its resistance to 51% attacks, that is due to the fact that
it is incredibly hard to get control over 51% authorities that are not connected
directly.
• Furthermore, nodes are pre-authenticated, so in that case that one is not available,
the network is able to remove it from the validation process.
Disadvantages of PoA
• PoA networks are more centralized.
• This does offer the benefit of a higher level of throughput, but it also
makes a PoA network more centralized.
• Because block rewards are visible to everyone in blockchain, anyone
can see how much a certain PoA validator has earned.
• This means that there is higher risk of corruption or manipulation, that
is why the validator needs to be the trusted entity.
• Becoming a validator is rather hard as candidate needs to pass a notary
exam which attests no criminal record and good moral standing of a
candidate while also filtering out those who are not committed.
Consensus Algorithms: 4. Byzantine Fault Tolerance (BFT)

• Byzantine Fault Tolerance, as the name suggests, is used to deal with Byzantine fault (also
called Byzantine Generals Problem) – a situation where the system’s actors have to agree
on an effective strategy so as to circumvent catastrophic failure of the system, but some
of them are dubious.
• Two Variations of BFT
• (a) Practical Byzantine Fault Tolerance (PBFT)
• PBFT is a lightweight blockchain algorithm that solves the Byzantine General’s
problems by letting users confirm the messages that have been delivered to them by
performing a computation to evaluate the decision about the message’s validity.
• The party then announces its decision to other nodes who ultimately process a
decision over it. This way, the final decision relies upon the decisions retrieved from
the other nodes.
• Stellar, Ripple, and Hyperledger Fabric are some use cases of this blockchain
consensus mechanism.
Consensus Algorithms: 4. Byzantine Fault Tolerance (BFT)

• (b) Delegated Byzantine Fault Tolerance (DBFT)


• Introduced by NEO, the Delegated Byzantine Fault Tolerance mechanism is
similar to the Delegated Proof of Stake (DPoS) consensus model. Here also, the
NEO token holders get the opportunity to vote for the delegates.
• However, this is independent of the amount of currency they invest. Anyone who
fulfills the basic requirements, i.e., a verified identity, right equipment, and
1,000 GAS, can become a delegate. One among those delegates is then chosen as
speaker randomly.
• GAS is the reward users receive for their activity on the network.
• The speaker creates a new block from the transaction that is waiting to be
validated. Also, he sends a proposal to the voted delegates who have the
responsibility to supervise all the transactions and record them on the network.
Consensus Algorithms: 4. Byzantine Fault Tolerance (BFT)

• These delegates have the freedom to share and analyze the proposals to check the
accuracy of data and honesty of the speaker. If then, 2/3rd of the delegates
validates it, the block is added to the blockchain.
• This type of Blockchain consensus protocol is also called ‘Ethereum of China’ and
can be a helpful resource in building a ‘smart economy’ by digitizing assets and
offering smart contracts on the blockchain.
Consensus Algorithms: 5. Direct Acyclic Graph (DAG)

• In this type of Blockchain consensus protocol, every node itself prepares to


become the ‘miners’. Now, when miners are eradicated and transactions are
validated by users itself, the associated fee reduces to zero.
• It becomes easier to validate transactions between any two closest nodes, which
makes the whole process lightweight, faster, and secure.
• The two best examples of DAG algorithms are IOTA and Hedera Hashgraph.
Consensus Algorithms:6. Proof of Capacity
• In the Proof of Capacity (PoC) mechanism, solutions for every complex
mathematical puzzle are accumulated in digital storages like Hard disks.
• Users can use these hard disks to produce blocks, in a way that those who are
fastest in evaluating the solutions get better chances for creating blocks.
• The process it follows is called Plotting. The two cryptocurrencies that rely on PoC
blockchain consensus protocol are Burstcoin and SpaceMint.
• PoC is an interesting mechanism where to mine a block one needs to prove that
one has more storage capacity in one’s hard drive.
• Before mining the system generates large data sets known as PLOTS.
• Plots are supposed to store on hard drive.
• The more plots one has the chances of getting a block to mine increases.
Consensus Algorithms: 7. Proof of Burn (PoB)
• This is alternate solution to PoW and PoS in terms of energy consumption
• Proof of Burn (PoB) consensus model works on the principle of letting miners
‘burn’ or ‘ruin’ the virtual cryptocurrency tokens, which further provides them
with a privilege to write blocks in proportion to the coins.
• The more coins they burn, the more are the chances of picking the new block for
every coin they get.
• But, in order to burn coins, they are required to send it to the address where it
couldn’t be spent for verifying the block.
• This is widely employed in the case of distributed consensus. And the finest
example of this consensus mechanism is the Slim coin.
Consensus Algorithms:8. Proof of Identity
• The concept of PoI (Proof of Identity) is just like that of the authorized identity.
• It is a piece of cryptographic confirmation for a users’ private key that is being
attached to each particular transaction.
• Each identified user can create and manage a block of data that can be presented
to others in the network.
• This blockchain consensus model ensures authenticity and integrity of the
created data. And thus, it is a good choice for introducing smart cities.
Consensus Algorithms: 9. Proof of Activity
• It is the convergence of PoW and PoS blockchain consensus models.
• In the case of PoA mechanism, miners race to solve a cryptographic puzzle at the
earliest using special hardware and electric energy, just like in PoW.
• However, the blocks they come across hold only the information about the
identity of the block winner and reward transaction.
• This is where the mechanism switches to PoS.
• The validators (shareholders appointed to validate transactions) test and ensure
the correctness of the block.
• If the block was checked many times, the validators activate to a complete block.
This confirms that open transactions are processed and are finally integrated into
the found block containers.
• Besides, the block reward is divided so that validators gain shares of it. e.g. Espers
and Decred coins
Consensus Algorithms: 10. Proof of Elapsed Time (PoET)

• PoET was introduced by Intel with an intent to take over cryptographic puzzles
involved in PoW mechanism by considering the fact that the CPU architecture
and the quantity of mining hardware knows when and at what frequency does a
miner win the block.
• It is based on the idea of fairly distributing and expanding the odds for a bigger
fraction of participants.
• And so, every participating node is asked to wait for a particular time to
participate in the next mining process.
• The member with the shortest hold-up time is asked to offer a block.
• At the same time, every node also comes up with their own waiting time, after
which they go into sleep mode.
Consensus Algorithms: 10.Proof of Elapsed Time (PoET)

• So, as soon as a node gets active and a block is available, that node is considered
as the ‘lucky winner’. This node can then spread the information throughout the
network, while maintaining the property of decentralization and receiving the
reward.
Consensus Algorithms:11. Proof of Importance
• Introduced by NEM, PoI is a variation of PoS protocol that considers the role of
shareholders and validators for its operation.
• However, this is not only influenced by the size and chance of their shares;
various other factors like reputation, overall balance, and no. of transactions
made through any particular address also plays a role in it.
• The networks based on POI consensus model are expensive to attack on and
rewards users for contributing to the network’s security.
Privacy
• A key aspect of privacy in blockchains is the use of private and public keys.

• Blockchain systems use asymmetric cryptography to secure transactions


between users. In these systems, each user has a public and private key.
• These keys are random strings of numbers and are cryptographically related. It is
mathematically impossible for a user to guess another user's private key from
their public key.
• This provides an increase in security and protects users from hackers. Public keys
can be shared with other users in the network because they give away no
personal data.
Privacy
• Each user has an address that is derived from the public key using a hash
function. These addresses are used to send and receive assets on the blockchain,
such as cryptocurrency.
• Because blockchain networks are shared to all participants, users can view past
transactions and activity that has occurred on the blockchain.
• Senders and receivers of past transactions are represented and signified by their
addresses; users' identities are not revealed.
• Public addresses do not reveal personal information or identification; rather, they
act as pseudonymous identities that users do not use a public address more than
once; this tactic avoids the possibility of a malicious user tracing a particular
address' past transactions in an attempt to reveal information.
Privacy
• Private keys are used to protect user identity and security through digital
signatures.
• Private keys are used to access funds and personal wallets on the blockchain;
they add a layer of identity authentication.
• When individuals wish to send money to other users, they must provide a digital
signature that is produced when provided with the private key. This process
protects against theft of funds.
HASH
• Hashing is the process of taking an unlimited amount of input data and leveraging it for the
creation of specific amounts of output data.
• The input data does not have any fixed size, thereby offering considerable flexibility in the
selection of inputs for hashing.
• The importance of hashing in blockchain security is visible in the requirement of hashing for
adding blocks.
• The hash helps in offering confirmation regarding the production of output from the hashing
procedure.
• In addition, the hash also confirms that the output of the procedure has not been subject to
any unwanted tampering.
• The verification process generally involves calculations for confirming matches between hashes
and the originally published content.
• Any form of mismatch could clearly showcase evidence of modification or tampering in the
output hash.
Hash in Blockchain
• Every new blockchain begins with a genesis block which is responsible for
capturing data regarding almost anything that has happened on the blockchain to
date.
• As a result, the output of a hash function directly points out the most recent state
of the concerning blockchain.
• The new blocks always capture details associated with the previous block. Any
form of modification could change the hash of the chain, thereby helping in
easier and precise identification.
• Hashing in cryptography and blockchain is primarily a one-way function that
features a properly crafted algorithm without any concerns for reversal of
hashing process and exposure of original input.
Hash in Blockchain
• The applications of hashing in blockchain have to follow certain important
requirements such as,
1.Input could feature variable length
2.Output must have a fixed length
3.The hash function for any specific input presents relative ease of computing
4.Hash function features the collision-free trait, which ensures that you could not
have two different messages that produce a similar hash value.
5.Hash function is always one-way and clearly implies the extreme difficulty
associated with determining the input by referring to the output.
Features of Hash Functions
• Fixed Length Output (Hash Value)
• Hash function coverts data of arbitrary length to a fixed length. This
process is often referred to as hashing the data.
• In general, the hash is much smaller than the input data, hence hash
functions are sometimes called compression functions.
• Since a hash is a smaller representation of a larger data, it is also referred
to as a digest.
• Hash function with n bit output is referred to as an n-bit hash function.
Popular hash functions generate values between 160 and 512 bits.
• Efficiency of Operation
• Generally for any hash function h with input x, computation of h(x) is a fast
operation.
• Computationally hash functions are much faster than a symmetric
encryption.
Properties of Hash Functions
• Pre-Image Resistance
• This property means that it should be computationally hard to reverse a hash
function.
• In other words, if a hash function h produced a hash value z, then it should
be a difficult process to find any input value x that hashes to z.
• This property protects against an attacker who only has a hash value and is
trying to find the input.
• Second Pre-Image Resistance
• This property means given an input and its hash, it should be hard to find a
different input with the same hash.
• In other words, if a hash function h for an input x produces hash value h(x),
then it should be difficult to find any other input value y such that h(y) = h(x).
• This property of hash function protects against an attacker who has an input
value and its hash, and wants to substitute different value as legitimate value
in place of original input value
Properties of Hash Functions
• Collision Resistance
• This property means it should be hard to find two different inputs of any
length that result in the same hash. This property is also referred to as
collision free hash function.
• In other words, for a hash function h, it is hard to find any two different
inputs x and y such that h(x) = h(y).
• Since, hash function is compressing function with fixed hash length, it is
impossible for a hash function not to have collisions. This property of
collision free only confirms that these collisions should be hard to find.
• This property makes it very difficult for an attacker to find two input values
with the same hash.
• Also, if a hash function is collision-resistant then it is second pre-image
resistant.
Design of Hashing Algorithms
Design of Hashing Algorithms
• At the heart of a hashing is a mathematical function that operates
on two fixed-size blocks of data to create a hash code. This hash
function forms the part of the hashing algorithm.
• The size of each data block varies depending on the algorithm.
Typically the block sizes are from 128 bits to 512 bits.
• Hashing algorithm involves rounds of above hash function like a
block cipher. Each round takes an input of a fixed size, typically a
combination of the most recent message block and the output of
the last round.
• This process is repeated for as many rounds as are required to
hash the entire message.
Popular Hash Functions
1. Message Digest (MD)
• MD5 was most popular and widely used hash function for quite some
years.
• The MD family comprises of hash functions MD2, MD4, MD5 and MD6. It
was adopted as Internet Standard RFC 1321. It is a 128-bit hash function.
• MD5 digests have been widely used in the software world to provide
assurance about integrity of transferred file. For example, file servers
often provide a pre-computed MD5 checksum for the files, so that a user
can compare the checksum of the downloaded file to it.
• In 2004, collisions were found in MD5. An analytical attack was reported to
be successful only in an hour by using computer cluster. This collision
attack resulted in compromised MD5 and hence it is no longer
recommended for use.
Popular Hash Functions
2. Secure Hash Function (SHA)
• Family of SHA comprise of four SHA algorithms; SHA-0, SHA-1, SHA-2, and SHA-3. Though
from same family, there are structurally different.
• The original version is SHA-0, a 160-bit hash function, was published by the National Institute
of Standards and Technology (NIST) in 1993. It had few weaknesses and did not become very
popular. Later in 1995, SHA-1 was designed to correct alleged weaknesses of SHA-0.
• SHA-1 is the most widely used of the existing SHA hash functions. It is employed in several
widely used applications and protocols including Secure Socket Layer (SSL) security.
• In 2005, a method was found for uncovering collisions for SHA-1 within practical time frame
making long-term employability of SHA-1 doubtful.
• SHA-2 family has four further SHA variants, SHA-224, SHA-256, SHA-384, and SHA-512
depending up on number of bits in their hash value. No successful attacks have yet been
reported on SHA-2 hash function.
• Though SHA-2 is a strong hash function. Though significantly different, its basic design is still
follows design of SHA-1. Hence, NIST called for new competitive hash function designs.
• In October 2012, the NIST chose the Keccak algorithm as the new SHA-3 standard. Keccak
offers many benefits, such as efficient performance and good resistance for attacks.
Popular Hash Functions
3. RIPEMD
• The RIPEMD is an acronym for RACE Integrity Primitives Evaluation Message
Digest. This set of hash functions was designed by open research community
and generally known as a family of European hash functions.
• The set includes RIPEMD, RIPEMD-128, and RIPEMD-160. There also exist
256, and 320-bit versions of this algorithm.
• Original RIPEMD (128 bit) is based upon the design principles used in MD4 and
found to provide questionable security. RIPEMD 128-bit version came as a
quick fix replacement to overcome vulnerabilities on the original RIPEMD.
• RIPEMD-160 is an improved version and the most widely used version in the
family. The 256 and 320-bit versions reduce the chance of accidental collision,
but do not have higher levels of security as compared to RIPEMD-128 and
RIPEMD-160 respectively.
Popular Hash Functions
4. Whirlpool
• This is a 512-bit hash function.
• It is derived from the modified version of Advanced Encryption
Standard (AES). One of the designer was Vincent Rijmen, a co-
creator of the AES.
• Three versions of Whirlpool have been released; namely
WHIRLPOOL-0, WHIRLPOOL-T, and WHIRLPOOL.
Digital Signature in Blockchain
• Digital signatures are basically cryptographic proof systems that can help in
establishing trust on the blockchain.
• Trust in the blockchain system could ensure proving that the message could
originate from a particular source, thereby ruling out any concerns of hacking or
other discrepancies.
• Digital signatures can be considered as the digital counterparts of stamped seals
or handwritten signatures.
• However, they are capable of offering better security with the reduced possibility
of identity theft or impersonation.
• Digital signatures follow the specific precedents of asymmetric cryptography by
linking two different keys with mathematical links.
• The keys include a private key and a public key. It is possible to deploy a digital
signature system with the help of a secure hash function.
Digital Signature in Blockchain
• The importance of a digital signature in blockchain largely revolves around two
primary objectives such as,
1.Digital signatures ensure that the message received by a recipient has come from
the sender claiming to have sent the information. The property is known as non-
repudiation.
2.Digital signatures also provide assurance to recipients about the fact that
messages have not been through any modifications in transit. As a result,
infrastructures can find better safeguards against malicious intermediaries or
unintentional modifications.
How do digital signatures work?
• Digital signatures work by proving that a digital message or document was
not modified—intentionally or unintentionally—from the time it was
signed. Digital signatures do this by generating a unique hash of the
message or document and encrypting it using the sender’s private key. The
hash generated is unique to the message or document, and changing any
part of it will completely change the hash.
• Once completed, the message or digital document is digitally signed and
sent to the recipient. The recipient then generates their own hash of the
message or digital document and decrypts the sender’s hash (included in
the original message) using the sender’s public key. The recipient
compares the hash they generate against the sender’s decrypted hash; if
they match, the message or digital document has not been modified and
the sender is authenticated.
Relationship between Hashing and Digital
Signature
• In the case of blockchain, a digital signature system focuses on three basic phases
such as hashing, signature, and verification.
• Step 1: First of all, the blockchain hashes the message or digital data through the
submission of data via a hashing algorithm. The algorithm helps in generating a
hash value or the message digest with messages differing profoundly in size only
to give the same length of hash values upon hashing. As we already know, this is
the most fundamental trait in a hash function and exhibits a clear influence on
digital signatures. Hashing is mandatory in most blockchain applications for the
flexibility in using fixed-length message digests for the complete process.
Relationship between Hashing and Digital
Signature
• Step 2: The next step in the working of digital signature in blockchain refers to
signing. The sender of the message must sign it after hashing of information in
the message. At this point of the process, public key cryptography plays a critical
role. Many digital signature algorithms offer unique mechanisms, albeit with the
single approach of asymmetric cryptography. Since digital signatures are related
directly to the content in each message, digitally signed messages are likely to
have different digital signatures.
• Step 3: The final step in the use of blockchain-based digital signature refers to
verification. Recipients could easily check the validity of digital signatures
through the use of a public key. The signature could work as a unique digital
fingerprint of the concerned message. However, it is also important to pay
attention to the secure storage and management of keys for avoiding unwanted
circumstances.
Hashchain to Blockchain
• A hash chain is commonly defined as the repeated application of a cryptographic
hash function to a given data asset.
• This type of hash cryptography can be extremely useful in some specific security
setups.
• This hash chain of transactions is cryptographically secure and tamper-proof.
• Any change to Transaction would cause hashvalue to change, and that would
require an update to the hash value stored in every subsequent transaction on
the hash chain.
Hashchain to Blockchain
• When a digital asset transfers from one owner to another, its digital signature is
examined, verified, and digitally signed by the new owner, and then registered as
a new node on the hash chain.
• Although the details of the implementation vary dramatically across blockchain
technologies and versions, the basic idea is the same for all of them.
• For example, as shown in Figure, Bill is the owner of a digital asset and uses his
private key to initiate a transfer of that digital asset to Susan.
• Susan’s transaction record uses Bill’s public key to verify his signature. After this,
Susan’s public key is used to sign the digital asset, making Susan the new owner.
This creates a new transaction record—a new link on the transaction hash chain.
Hashchain to Blockchain
• Merkle Trees Some blockchains bundle up transactions using
another kind of hash chain: the binary hash chain, or Merkle
tree. A complete Merkle tree is referred to as a binary tree
structure because it branches twice at each level starting at the
root, as shown in Figure
What Is a Merkle Tree?
• Merkle trees, also known as Binary hash trees, are a
prevalent sort of data structure in computer science.
• In bitcoin and other cryptocurrencies, they're used to encrypt
blockchain data more efficiently and securely.
• It's a mathematical data structure made up of hashes of
various data blocks that summarize all the transactions in a
block.
• It also enables quick and secure content verification across
big datasets and verifies the consistency and content of the
data.
What Is a Merkle Root?
• A Merkle root is a simple mathematical method for
confirming the facts on a Merkle tree.
• They're used in cryptocurrency to ensure that data
blocks sent through a peer-to-peer network are whole,
undamaged, and unaltered.
• They play a very crucial role in the computation
required to keep cryptocurrencies like bitcoin and
ether running.
Working of Merkle Trees
• A Merkle tree totals all transactions in a block and generates a digital
fingerprint of the entire set of operations, allowing the user to verify
whether it includes a transaction in the block.
Working of Merkle Trees
• Merkle trees are made by hashing pairs of nodes
repeatedly until only one hash remains; this hash is
known as the Merkle Root or the Root Hash.
• They're built from the bottom, using Transaction IDs,
which are hashes of individual transactions.
• Each non-leaf node is a hash of its previous hash, and
every leaf node is a hash of transactional data.
Example of a Merkle Tree in Blockchain
• Consider the following scenario: A, B, C, and
D are four transactions, all executed on the
same block. Each transaction is then hashed,
leaving you with:
• Hash A
• Hash B
• Hash C
• Hash D
• The hashes are paired together, resulting in:
• Hash AB
• and
• Hash CD
• And therefore, your Merkle Root is formed
by combining these two hashes: Hash ABCD.
Benefits of Merkle Tree in Blockchain
• Merkle trees provide four significant advantages -
• Validate the data's integrity: It can be used to validate the data's
integrity effectively.
• Takes little disk space: Compared to other data structures, the Merkle
tree takes up very little disk space.
• Tiny information across networks: Merkle trees can be broken down
into small pieces of data for verification.
• Efficient Verification: The data format is efficient, and verifying the
data's integrity takes only a few moments.
Hashchain to Blockchain
• The work in setting up a Merkle tree is to create a series of leaf nodes by computing the
SHA-256 hash for the data contained in each transaction object (the Bitcoin blockchain
double-hashes each Merkle node; double-hashing can help strengthen the cryptographic
value in the hash result should a vulnerability be discovered in the SHA-256 algorithm).
• The Merkle tree requires an even number of leaf nodes—it’s customary to duplicate the
last leaf node if starting with an odd number. Then each pair of leaf nodes is hashed
together, producing a new hash value.
• Leaf A shows the hash for Transaction A as HA; Leaf B shows the hash for Transaction B as
HB and so on. This pattern continues at each tree level until you reach the final root node.
• The root node’s hash value is the crypto­graphic hash sum of all of the other hash sums in
the tree. Any change to the data in any of the leaf nodes causes the recomputed Merkle
tree root hash value to change.
Hashchain to Blockchain
• The Merkle binary hash tree structure offers some advantages.
• For example, it makes it easy to update data within a transaction and compute a
new Merkle root hash without having to build the entire Merkle tree from
scratch.
• For example, if Transaction E changes (it’s highlighted in Figure), all you need to
do is walk the tree efficiently back to the Merkle root, computing new hashes
once for each level.
• Thus, you first compute the new Leaf hash HE; then compute HEF from HE and HF;
then compute HEFGH from HEFand HGH; then compute a new Merkle root hash from
HABCD and HEFGH. Updating the Merkle root hash required only four computations
versus the 15 required to build the Merkle tree from scratch!
Hashchain to Blockchain
• To build a blockchain (see Figure), the binary hash chain data object containing
transactions must somehow be committed to a tamper-proof data store that
everyone can use (remember, this is a public blockchain—any node on the
network can read from or write to it).
• The Merkle tree structure contains transactions and is tamper-proof, so it would
seem it could serve as the blockchain. But there are several problems.
• In order for Bill to send his digital asset to Susan, Bill must trust the service or
Web site that acts as an agent to process his digital-asset transfer request, and he
must trust the server that persists the hash structure.
Hashchain to Blockchain
• Without a central node to process a new transaction or a central authority to
delegate them for processing, any node could process Bill’s pending transaction.
• A rogue or dominant node having superior processing power could allow invalid
or fraudulent transactions to occur and those could propagate to honest nodes.
• To solve that, the network could try to randomly assign a node to process Bill’s
transaction, but that again centralizes control and requires trust that the random
number generator is indeed enforcing randomness. To eliminate this issue,
blockchains use consensus algorithms
TOP BLOCKCHAIN COMPANIES
• BRD • TQ Tezos
• BitMEX • Mythical Games
• Chainalysis • Gemini
• Coinme • Circle
• • Coinbase
Netki
• Chronicled
• Paxful
• IBM
• Republic
• Voatz
• Spring Labs
• Steem
• SALT Lending • Shipchain

You might also like