You are on page 1of 46

Blockchain

Unit 1. Introduction

Blockchain is a constantly growing ledger that keeps a permanent record of all the
transactions that have taken place in a secure, chronological, and immutable way. It can be
used for the secure transfer of money, property, contracts, etc. without requiring a third-party
intermediary such as bank or government. Blockchain is a software protocol, but it could not
be run without the Internet (like SMTP is for email).

What is Blockchain?

A blockchain is a constantly growing ledger which keeps a permanent record of all the
transactions that have taken place in a secure, chronological, and immutable way.

Let's breakdown the definition,

o Ledger: It is a file that is constantly growing.


o Permanent: It means once the transaction goes inside a blockchain, you can put up it
permanently in the ledger.
o Secure: Blockchain placed information in a secure way. It uses very advanced
cryptography to make sure that the information is locked inside the blockchain.
o Chronological: Chronological means every transaction happens after the previous
one.
o Immutable: It means as you build all the transaction onto the blockchain, this ledger
can never be changed.

A blockchain is a chain of blocks which contain information. Each block records all of the
recent transactions, and once completed goes into the blockchain as a permanent database.
Each time a block gets completed, a new block is generated.

Who uses the blockchain?

Blockchain technology can be integrated into multiple areas. The primary use of blockchains
is as a distributed ledger for cryptocurrencies. It shows great promise across a wide range of
Blockchain

business applications like Banking, Finance, Government, Healthcare, Insurance, Media and
Entertainment, Retail, etc.

Need of Blockchain

Blockchain technology has become popular because of the following.

o Time reduction: In the financial industry, blockchain can allow the quicker
settlement of trades. It does not take a lengthy process for verification, settlement, and
clearance. It is because of a single version of agreed-upon data available between all
stakeholders.
o Unchangeable transactions: Blockchain register transactions in a chronological
order which certifies the unalterability of all operations, means when a new block is
added to the chain of ledgers, it cannot be removed or modified.
o Reliability: Blockchain certifies and verifies the identities of each interested parties.
This removes double records, reducing rates and accelerates transactions.
o Security: Blockchain uses very advanced cryptography to make sure that the
information is locked inside the blockchain. It uses Distributed Ledger Technology
where each party holds a copy of the original chain, so the system remains operative,
even the large number of other nodes fall.
o Collaboration: It allows each party to transact directly with each other without
requiring a third-party intermediary.
o Decentralized: It is decentralized because there is no central authority supervising
anything. There are standards rules on how every node exchanges the blockchain
Blockchain

information. This method ensures that all transactions are validated, and all valid
transactions are added one by one.

History of Blockchain

The blockchain technology was described in 1991 by the research scientist Stuart
Haber and W. Scott Stornetta. They wanted to introduce a computationally practical
solution for time-stamping digital documents so that they could not be backdated or
tampered. They develop a system using the concept of cryptographically secured chain of
blocks to store the time-stamped documents.

In 1992, Merkle Trees were incorporated into the design, which makes blockchain more
efficient by allowing several documents to be collected into one block. Merkle Trees are
used to create a 'secured chain of blocks.' It stored a series of data records, and each data
records connected to the one before it. The newest record in this chain contains the history of
the entire chain. However, this technology went unused, and the patent lapsed in 2004.

In 2004, computer scientist and cryptographic activist Hal Finney introduced a system
called Reusable Proof Of Work(RPoW) as a prototype for digital cash. It was a significant
early step in the history of cryptocurrencies. The RPoW system worked by receiving a non-
exchangeable or a non-fungible Hashcash based proof of work token in return, created
an RSA-signed token that further could be transferred from person to person.

RPoW solved the double-spending problem by keeping the ownership of tokens registered on
a trusted server. This server was designed to allow users throughout the world to verify its
correctness and integrity in real-time.

Further, in 2008, Satoshi Nakamoto conceptualized the theory of distributed blockchains.


He improves the design in a unique way to add blocks to the initial chain without requiring
Blockchain

them to be signed by trusted parties. The modified trees would contain a secure history of
data exchanges. It utilizes a peer-to-peer network for timestamping and verifying each
exchange. It could be managed autonomously without requiring a central authority. These
improvements were so beneficial that makes blockchains as the backbone of
cryptocurrencies. Today, the design serves as the public ledger for all transactions in
the cryptocurrency space.

The evolution of blockchains has been steady and promising. The words block and chain
were used separately in Satoshi Nakamoto's original paper but were eventually popularized as
a single word, the Blockchain, by 2016. In recent time, the file size of cryptocurrency
blockchain containing records of all transactions occurred on the network has grown from 20
GB to 100 GB.

What Is a Cryptocurrency Public Ledger?

A public ledger derives its name from the age-old record-keeping system used to record
information, such as agricultural commodity prices, news, and analysis. The public ledger
was available for general public viewing as well as for verification. As cryptocurrency-based
blockchain systems emerged, which rely on a similar record-keeping and public verification
mechanism, the use of the public ledger gained popularity in the world of cryptocurrency.
This article explores cryptocurrency public ledgers, how they work, and the challenges they
face.

How Cryptocurrency Public Ledgers Work

A cryptocurrency is an encrypted, decentralized digital currency that facilitates the exchange


of value by transfer of cryptotokens between network participants. The public ledger is used
as a record-keeping system that maintains participants’ identities in secure and (pseudo-
)anonymous form, their respective cryptocurrency balances, and a record book of all the
genuine transactions executed between network participants.

To draw a parallel, think about writing a check to a friend, or making an online transfer to
their bank account for $200. In both cases, the details of the transaction will be updated in
the bank's records—the sender’s account is debited by $200 while the receiver’s account is
credited by the same amount. The bank’s accounting systems maintain the record of
balances and ensure that the sender’s account has sufficient funds; otherwise, the check
bounces or the online transfer will not be allowed. If the sender has only $200 in their
account, and they issue two $100 checks, the order in which the checks are
presented determines who will receive the money and whose check will bounce.

Verifying Transaction Details


The transaction's details in the bank's records can be queried and verified by the two parties
between whom the transaction took place. Additionally, the bank record is accessible only
by the designated bank officials and the concerned (central) authorities like the tax
department or the government on a need basis. No one else can have access to those details.

Public ledgers work the same way as bank records, although with a few differences.
Blockchain

Similar to the bank records, the transaction details on a cryptocurrency public ledger can be
verified and queried by the two transacting participants. However, no central authority or
network participants can know the identity of the participants. Transactions are allowed and
recorded only after suitable verification of the sender’s liquidity; otherwise, they are
discarded.

Since no central authority controls or maintains the ledger records, how is fairness regulated
on cryptocurrency ledgers?

Cryptocurrency Transactions on the Public Ledger


Physically, a public ledger can be viewed as a data management or storage system similar to
a database system of bank records. A blockchain is a form of public ledger, which is a series
(or chain) of blocks on which transaction details are recorded after suitable authentication
and verification by the designated network participants.

The recording and storage of all confirmed transactions on such public ledgers begin at the
creation and start of a cryptocurrency. As a block is filled to capacity with transaction
details, new ones are mined and added to the blockchain by the network participants called
miners.

Select network participants, often called full nodes, maintain a copy of the whole ledger on
their devices that are connected to the cryptocurrency network. Depending on the
participants’ interest and their spread across the globe, the public ledger is distributed as
participants connect and contribute to the blockchain network activities keeping it agile and
functional.

Since hundreds and thousands of participants maintain a copy of the ledger, they are aware
of the true state of the network in terms of who holds cryptotokens, how many tokens are
held, whether transactions are authentic and recorded to prevent any misuse like double
spending. A combination of the various intrinsic features of the public ledger, such
as consensus algorithms, encryption, and reward mechanisms, ensure that the participants’
identities are protected, and only genuine transactions are conducted on the network.

What is Bitcoin?

Satoshi Nakamoto introduced the bitcoin in the year 2008. Bitcoin is a


cryptocurrency(virtual currency), or a digital currency that uses rules of cryptography for
regulation and generation of units of currency. A Bitcoin fell under the scope
of cryptocurrency and became the first and most valuable among them. It is commonly
called decentralized digital currency.

A bitcoin is a type of digital assets which can be bought, sold, and transfer between the two
parties securely over the internet. Bitcoin can be used to store values much like fine gold,
silver, and some other type of investments. We can also use bitcoin to buy products and
services as well as make payments and exchange values electronically.

A bitcoin is different from other traditional currencies such as Dollar, Pound, and Euro,
which can also be used to buy things and exchange values electronically. There are no
physical coins for bitcoins or paper bills. When you send bitcoin to someone or used bitcoin
to buy anything, you don?t need to use a bank, a credit card, or any other third-party. Instead,
Blockchain

you can simply send bitcoin directly to another party over the internet with securely and
almost instantly.

How Bitcoin Works?

When you send an email to another person, you just type an email address and can
communicate directly to that person. It is the same thing when you send an instant message.
This type of communication between two parties is commonly known as Peer-to-Peer
communication.

Whenever you want to transfer money to someone over the internet, you need to use a service
of third-party such as banks, a credit card, a PayPal, or some other type of money transfer
services. The reason for using third-party is to ensure that you are transferring that money. In
other words, you need to be able to verify that both parties have done what they need to do in
real exchange.

For example, Suppose you click on a photo that you want to send it to another person, so you
can simply attach that photo to an email, type the receiver email address and send it. The
other person will receive the photo, and you think it would end, but it is not. Now, we have
two copies of photo, one is a simple email, and another is an original file which is still on my
computer. Here, we send the copy of the file of the photo, not the original file. This issue is
commonly known as the double-spend problem.

The double-spend problem provides a challenge to determine whether a transaction is real or


not. How you can send a bitcoin to someone over the internet without needing a bank or some
other institution to certify the transfer took place. The answer arises in a global network of
thousands of computers called a Bitcoin Network and a special type of decentralized laser
technology called blockchain.

In Bitcoin, all the information related to the transaction is captured securely by using maths,
protected cryptographically, and the data is stored and verified across the entire network of
computers. In other words, instead of having a centralized database of the third-party such as
banks to certify the transaction took place. Bitcoin uses blockchain technology across a
decentralized network of computers to securely verify, confirm and record each transaction.
Since data is stored in a decentralized manner across a wide network, there is no single point
of failure. This makes blockchain more secure and less prone to fraud, tampering or general
system failure than keeping them in a single centralized location.

Smart contracts defined


Blockchain

Smart contracts are simply programs stored on a blockchain that run when predetermined
conditions are met. They typically are used to automate the execution of an agreement so that
all participants can be immediately certain of the outcome, without any intermediary’s
involvement or time loss. They can also automate a workflow, triggering the next action
when conditions are met.
How smart contracts work
Smart contracts work by following simple “if/when…then…” statements that are written into
code on a blockchain. A network of computers executes the actions when predetermined
conditions have been met and verified. These actions could include releasing funds to the
appropriate parties, registering a vehicle, sending notifications, or issuing a ticket. The
blockchain is then updated when the transaction is completed. That means the transaction
cannot be changed, and only parties who have been granted permission can see the results.

Within a smart contract, there can be as many stipulations as needed to satisfy the participants
that the task will be completed satisfactorily. To establish the terms, participants must
determine how transactions and their data are represented on the blockchain, agree on the
“if/when...then…” rules that govern those transactions, explore all possible exceptions, and
define a framework for resolving disputes.

Then the smart contract can be programmed by a developer – although increasingly,


organizations that use blockchain for business provide templates, web interfaces, and other
online tools to simplify structuring smart contracts.

Benefits of smart contracts

Speed, efficiency and accuracy


Once a condition is met, the contract is executed immediately. Because smart contracts are
digital and automated, there’s no paperwork to process and no time spent reconciling errors
that often result from manually filling in documents.
Trust and transparency
Because there’s no third party involved, and because encrypted records of transactions are
shared across participants, there’s no need to question whether information has been altered
for personal benefit.
Security
Blockchain transaction records are encrypted, which makes them very hard to hack.
Moreover, because each record is connected to the previous and subsequent records on a
distributed ledger, hackers would have to alter the entire chain to change a single record.
Savings
Smart contracts remove the need for intermediaries to handle transactions and, by extension,
their associated time delays and fees.
Applications of smart contracts

Safeguarding the efficacy of medications

Sonoco and IBM are working to reduce issues in the transport of lifesaving medications by
increasing supply chain transparency. Powered by IBM Blockchain Transparent Supply,
Pharma Portal is a blockchain-based platform that tracks temperature-controlled
pharmaceuticals through the supply chain to provide trusted, reliable and accurate data across
multiple parties.
Increasing trust in retailer-supplier relationships
Blockchain

The Home Depot uses smart contracts on blockchain to quickly resolve disputes with
vendors. Through real-time communication and increased visibility into the supply chain,
they are building stronger relationships with suppliers, resulting in more time for critical
work and innovation.

Making international trade faster and more efficient


By joining we trade, the trade finance network convened by IBM Blockchain, businesses are
creating an ecosystem of trust for global trade. As a blockchain-based platform, we trade uses
standardized rules and simplified trading options to reduce friction and risk while easing the
trading process and expanding trade opportunities for participating companies and banks.

What are the blocks in blockchain?


A blockchain is exactly what it sounds like it is: a chain consisting of blocks of information.
These blocks are containers holding a record transactions on the blockchain. In the case
of Bitcoin, the transactions are primarily transfers of bitcoins. On some blockchains, they can
also contain a variety of other information, even code of computer programs.
Once transactions are added to the block, they cannot be reversed. And when a block is added
to the chain, it cannot be changed. All information held in blocks is going to stay there as
long as the blockchain exists. Blocks are added on top of one another in a linear way. One by
one, they form a chain holding the entire history of transactions on the network.

The exact structure of blocks can differ from blockchain to blockchain. This article will focus
on explaining the structure of a Bitcoin block. After all, that is the basis on which most other
blockchains were modelled.

BLOCKCHAIN BLOCK ESSENTIALS

 Blocks are the basic containers of information in a blockchain.

 They contain transaction data.

 Once added to the blockchain, a block cannot be changed.

 Blocks are secured with cryptographic methods.

The parts of a block

The body of a block contains transaction records. Storing these records safely is one of the
priorities of the blockchain. But to be able to function in a block chain, a block also needs a
few other elements. But before we find out what they are, let’s first see how data is stored in
blocks.

Cryptocurrencies earned their name because they rely heavily on cryptography. In the case of
blocks, the cryptographic principle used is called the hash function. A string of symbols,
called a hash, is determined through a hashing algorithm. Bitcoin uses SHA-256, but not all
cryptocurrencies use the same algorithm. This algorithm takes all the data in a block and
turns it into a unique string of symbols that serve as the block’s ID.
Blockchain

The hash of the block (the block header) is formed from the six elements that make up a
block:

1. The version number of the block,


2. The hash of the previous block in the chain,
3. A code generated from transaction data,
4. A timestamp of when the block was created,
5. The difficulty target that adjusts the difficulty of mining,
6. And a random string of characters called the nonce.

All except the last of these elements are known in advance before a block is added to the
chain. The nonce, however, remains a mystery. The purpose of crypto mining is to figure out
the nonce. The miner who first finds the nonce that satisfies the current difficulty requirement
adds the block to the chain, sealing it into the history of transactions.

Transaction

Blockchain technology is mostly about the transactions that we make digitally for ourselves.
Eventually, these transactions make their way to the various blocks that become part of the
Blockchain later on. So, it is important to understand the transaction life cycle in Blockchain
technology.

This lifecycle follows the journey of a single transaction as it makes its way through each
stage in the process of joining the blockchain. Transaction in simple words is the process of
sending money by the sender and the receiver receiving it. The Blockchain transaction is also
quite similar, but it is made digitally.

Let us understand the various stages in a blockchain transaction life cycle with the help of an
example.
Sourav and Suraj are two Bitcoin users. Sourav wants to send 1 bitcoin to Suraj.

1. First, Sourav gets Suraj’s wallet address (a wallet in the blockchain is a digital wallet
that allows users to manage their transactions). Using this information, he creates a
new transaction for 1 bitcoins from his wallet and includes a transaction fee of 0.003
bitcoin.

2. Next, he verifies the information and sends the transaction. Each transaction that is
initiated is signed by a digital signature of the sender that is basically the private key
of the sender. This is done in order to make the transaction more secure and to prevent
any fraud.

3. Sourav’s wallet then starts the transaction signing algorithm which signs his
transaction using his private key.

4. The transaction is now broadcasted to the memory pool within the network.
Blockchain

5. This transaction is eventually accepted by the miners. These miners, group this
transaction into a block, find the Proof of Work, and assign this block a hash value to
be mapped into the blockchain.

6. This block is now placed on the Blockchain.

7. As this block gains confirmation, it is accepted as a valid transaction in the network.

8. Once this transaction is accepted, Suraj finally gets his bitcoin.

The below diagram is a pictorial representation of the various stages in a transaction life
cycle as discussed above.

Distributed Consensus

A distributed consensus ensures a consensus of data among nodes in a distributed system


or reaches an agreement on a proposal. A consensus algorithm may be defined as the
mechanism through which a blockchain network reach consensus.

A distributed consensus ensures a consensus of data among nodes in a distributed system or


reaches an agreement on a proposal. This topic may be very familiar to any technicians that
work with distributed systems such as HDFS, MQ, ZooKeeper, Kafka, Redis,
and Elasticsearch. With the rapid development and the increasing complexity of distributed
Blockchain

networks, developers have always been exploring possible solutions to solve this persistent
problem in both theory and practice.

Next, with the rise of blockchain technology, especially public blockchains in open networks
and private blockchains in permissioned networks, this consensus problem has once again
received much attention and needs to be considered from a new perspective.

Public vs private blockchains: How do they differ

1. What is Public Blockchain ?


Public blockchains are open networks that allow anyone to participate in the network i.e.
public blockchain is permissionless. In this type of blockchain anyone can join the network
and read, write, or participate within the blockchain. A public blockchain is decentralized
and does not have a single entity which controls the network. Data on a public blockchain
are secure as it is not possible to modify or alter data once they have been validated on the
blockchain.
Some features of public blockchain are :

 High Security –
It is secure Due to Mining (51% rule).

 Open Environment –
The public blockchain is open for all.

 Anonymous Nature –
In public blockchain every one is anonymous. There is no need to use your real name,
or real identity, therefore everything would stay hidden, and no one can track you based
on that.

 No Regulations –
Public blockchain doesn’t have any regulations that the nodes have to follow. So, there
is no limit to how one can use this platform for their betterment

 Full Transparency –
Public blockchain allow you to see the ledger anytime you want. There is no scope for
any corruption or any discrepancies and everyone has to maintain the ledger and
participate in consensus.

 True Decentralization –
In this type of blockchain, there isn’t a centralized entity. Thus, the responsibility of
maintaining the network is solely on the nodes. They are updating the ledger, and it
promotes fairness with help from a consensus algorithm .

 Full User Empowerment –


Typically, in any network user has to follow a lot of rules and regulations. In many
cases, the rules might not even be a fair one. But not in public blockchain networks.
Here, all of the users are empowered as there is no central authority to look over their
every move.
Blockchain

 Immutable –
When something is written to the blockchain, it can not be changed.

 Distributed –
The database is not centralized like in a client-server approach, and all nodes in the
blockchain participate in the transaction validation.

2. What is Private Blockchain ?


A private blockchain is managed by a network administrator and participants need consent
to join the network i.e., a private blockchain is a permissioned blockchain. There are one or
more entities which control the network and this leads to reliance on third-parties to
transact. In this type of blockchain only entity participating in the transaction have
knowledge about the transaction performed whereas others will not able to access it i.e.
transactions are private.
Some of the features of private blockchain are :

 Full Privacy –
It focus on privacy concerns.

 Private Blockchain are more centralized.

 High Efficiency and Faster Transactions –


When you distribute the nodes locally, but also have much less nodes to participate in
the ledger, the performance is faster.

 Better Scalability –
Being able to add nodes and services on demand can provide a great advantage to the
enterprise.

Difference between Public and Private blockchain :


Basis of Public BlockChain
S.noComparison Private BlockChain

In this type of blockchain anyone can read, In this type of blockchain read
write and participate in a blockchain. and write is done upon
Hence, it is permissionless blockchain. It invitation, hence it is a
1. Access – is public to everyone. permissioned blockchain.

Network
2. Actors – Don’t know each other Know each other

Decentralized
Vs Centralized A private blockchain is more
3. – A public blockchain is decentralized. centralized.

The order of magnitude is


Order Of The order of magnitude of a public more as compared to the
4. Magnitude – blockchain is lesser than that of a private public blockchain.
blockchain as it is lighter and provides
Blockchain

transactional throughput.

5. Native Token – Yes Not necessary

6. Speed – Slow Fast

Transaction per second is


Transactions Transactions per second are lesser in a more as compared to public
7. pre second – public blockchain. blockchain.

A public network is more secure due to A private blockchain is more


decentralization and active participation. prone to hacks, risks, and data
Due to the higher number of nodes in the breaches/ manipulation. It is
network, it is nearly impossible for ‘bad easy for bad actors to
actors’ to attack the system and gain endanger the entire network.
8. Security – control over the consensus network. Hence, it is less secure.

A public blockchain consumes more


energy than a private blockchain as it
requires a significant amount of electrical
Energy resources to function and achieve network Private blockchains consume
9. Consumption – consensus. a lot less energy and power.

Proof of Elapsed Time


(PoET), Raft, and Istanbul
Consensus Some are proof of work, proof of stake, BFT can be used only in case
10. algorithms – proof of burn, proof of space etc. of private blockchains.

In a private blockchain, there


In a public blockchain, no one knows who is no chance of minor
each validator is and this increases the risk collision. Each validator is
of potential collision or a 51% attack (a known and they have the
group of miners which control more than suitable credentials to be a
11. Attacks – 50% of the network’s computing power.). part of the network.

Potential to disrupt current business


models through disintermediation. There is Reduces transaction cost and
lower infrastructure cost. No need to data redundancies and replace
maintain servers or system admins legacy systems, simplifying
radically. Hence reducing the cost of documents handling and
creating and running decentralized getting rid of semi manual
12. Effects – application (dApps). compliance mechanisms.

Bitcoin, Ethereum, Monero, Zcash, Dash, R3 (Banks), EWF (Energy),


13. Examples – Litecoin, Stellar, Steemit etc. B3i (Insurance), Corda.
Blockchain

What is cryptocurrency and how does it works

Cryptocurrency – meaning and definition

Cryptocurrency, sometimes called crypto-currency or crypto, is any form of currency that


exists digitally or virtually and uses cryptography to secure transactions. Cryptocurrencies
don't have a central issuing or regulating authority, instead using a decentralized system to
record transactions and issue new units.

What is cryptocurrency?

Cryptocurrency is a digital payment system that doesn't rely on banks to verify


transactions. It’s a peer-to-peer system that can enable anyone anywhere to send and receive
payments. Instead of being physical money carried around and exchanged in the real world,
cryptocurrency payments exist purely as digital entries to an online database describing
specific transactions. When you transfer cryptocurrency funds, the transactions are recorded
in a public ledger. Cryptocurrency is stored in digital wallets.
Cryptocurrency received its name because it uses encryption to verify transactions. This
means advanced coding is involved in storing and transmitting cryptocurrency data between
wallets and to public ledgers. The aim of encryption is to provide security and safety.
The first cryptocurrency was Bitcoin, which was founded in 2009 and remains the best
known today. Much of the interest in cryptocurrencies is to trade for profit, with speculators
at times driving prices skyward.
How does cryptocurrency work?

Cryptocurrencies run on a distributed public ledger called blockchain, a record of all


transactions updated and held by currency holders.

Units of cryptocurrency are created through a process called mining, which involves using
computer power to solve complicated mathematical problems that generate coins. Users can
also buy the currencies from brokers, then store and spend them using cryptographic wallets.

If you own cryptocurrency, you don’t own anything tangible. What you own is a key that
allows you to move a record or a unit of measure from one person to another without a
trusted third party.

Although Bitcoin has been around since 2009, cryptocurrencies and applications of
blockchain technology are still emerging in financial terms, and more uses are expected in the
future. Transactions including bonds, stocks, and other financial assets could eventually be
traded using the technology.

Cryptocurrency examples

There are thousands of cryptocurrencies. Some of the best known include:

Bitcoin:

Founded in 2009, Bitcoin was the first cryptocurrency and is still the most commonly traded.
The currency was developed by Satoshi Nakamoto – widely believed to be a pseudonym for
an individual or group of people whose precise identity remains unknown.

Ethereum:
Blockchain

Developed in 2015, Ethereum is a blockchain platform with its own cryptocurrency, called
Ether (ETH) or Ethereum. It is the most popular cryptocurrency after Bitcoin.

Litecoin:

This currency is most similar to bitcoin but has moved more quickly to develop new
innovations, including faster payments and processes to allow more transactions.

Ripple:

Ripple is a distributed ledger system that was founded in 2012. Ripple can be used to track
different kinds of transactions, not just cryptocurrency. The company behind it has worked
with various banks and financial institutions.

Non-Bitcoin cryptocurrencies are collectively known as “altcoins” to distinguish them from


the original.

How to buy cryptocurrency

You may be wondering how to buy cryptocurrency safely. There are typically three steps
involved. These are:

Step 1: Choosing a platform

The first step is deciding which platform to use. Generally, you can choose between a
traditional broker or dedicated cryptocurrency exchange:

 Traditional brokers. These are online brokers who offer ways to buy and sell
cryptocurrency, as well as other financial assets like stocks, bonds, and ETFs. These
platforms tend to offer lower trading costs but fewer crypto features.
 Cryptocurrency exchanges. There are many cryptocurrency exchanges to choose from, each
offering different cryptocurrencies, wallet storage, interest-bearing account options, and
more. Many exchanges charge asset-based fees.

When comparing different platforms, consider which cryptocurrencies are on offer, what fees
they charge, their security features, storage and withdrawal options, and any educational
resources.

Step 2: Funding your account

Once you have chosen your platform, the next step is to fund your account so you can begin
trading. Most crypto exchanges allow users to purchase crypto using fiat (i.e., government-
issued) currencies such as the US Dollar, the British Pound, or the Euro using their debit or
credit cards – although this varies by platform.

Crypto purchases with credit cards are considered risky, and some exchanges don't support
them. Some credit card companies don't allow crypto transactions either. This is because
cryptocurrencies are highly volatile, and it is not advisable to risk going into debt — or
potentially paying high credit card transaction fees — for certain assets.
Blockchain

Some platforms will also accept ACH transfers and wire transfers. The accepted payment
methods and time taken for deposits or withdrawals differ per platform. Equally, the time
taken for deposits to clear varies by payment method.

An important factor to consider is fees. These include potential deposit and withdrawal
transaction fees plus trading fees. Fees will vary by payment method and platform, which is
something to research at the outset.

Step 3: Placing an order

You can place an order via your broker's or exchange's web or mobile platform. If you are
planning to buy cryptocurrencies, you can do so by selecting "buy," choosing the order type,
entering the amount of cryptocurrencies you want to purchase, and confirming the order. The
same process applies to "sell" orders.

There are also other ways to invest in crypto. These include payment services like PayPal,
Cash App, and Venmo, which allow users to buy, sell, or hold cryptocurrencies. In addition,
there are the following investment vehicles:
 Bitcoin trusts: You can buy shares of Bitcoin trusts with a regular brokerage account. These
vehicles give retail investors exposure to crypto through the stock market.
 Bitcoin mutual funds: There are Bitcoin ETFs and Bitcoin mutual funds to choose from.
 Blockchain stocks or ETFs: You can also indirectly invest in crypto through blockchain
companies that specialize in the technology behind crypto and crypto transactions.
Alternatively, you can buy stocks or ETFs of companies that use blockchain technology.

The best option for you will depend on your investment goals and risk appetite.

How to store cryptocurrency

Once you have purchased cryptocurrency, you need to store it safely to protect it from hacks
or theft. Usually, cryptocurrency is stored in crypto wallets, which are physical devices or
online software used to store the private keys to your cryptocurrencies securely. Some
exchanges provide wallet services, making it easy for you to store directly through the
platform. However, not all exchanges or brokers automatically provide wallet services for
you.

There are different wallet providers to choose from. The terms “hot wallet” and “cold wallet”
are used:

 Hot wallet storage: "hot wallets" refer to crypto storage that uses online software to protect
the private keys to your assets.
 Cold wallet storage: Unlike hot wallets, cold wallets (also known as hardware wallets) rely
on offline electronic devices to securely store your private keys.
What can you buy with cryptocurrency?

When it was first launched, Bitcoin was intended to be a medium for daily transactions,
making it possible to buy everything from a cup of coffee to a computer or even big-ticket
items like real estate. That hasn’t quite materialized and, while the number of institutions
accepting cryptocurrencies is growing, large transactions involving it are rare. Even so, it is
possible to buy a wide variety of products from e-commerce websites using crypto. Here are
some examples:
Blockchain

Technology and e-commerce sites:

Several companies that sell tech products accept crypto on their websites, such as
newegg.com, AT&T, and Microsoft. Overstock, an e-commerce platform, was among the
first sites to accept Bitcoin. Shopify, Rakuten, and Home Depot also accept it.

Luxury goods:

Some luxury retailers accept crypto as a form of payment. For example, online luxury retailer
Bitdials offers Rolex, Patek Philippe, and other high-end watches in return for Bitcoin.

Cars:

Some car dealers – from mass-market brands to high-end luxury dealers – already accept
cryptocurrency as payment.

Insurance:
In April 2021, Swiss insurer AXA announced that it had begun accepting Bitcoin as a mode
of payment for all its lines of insurance except life insurance (due to regulatory issues).
Premier Shield Insurance, which sells home and auto insurance policies in the US, also
accepts Bitcoin for premium payments.

If you want to spend cryptocurrency at a retailer that doesn’t accept it directly, you can use a
cryptocurrency debit card, such as BitPay in the US.

Cryptocurrency fraud and cryptocurrency scams

Unfortunately, cryptocurrency crime is on the rise. Cryptocurrency scams include:

Fake websites: Bogus sites which feature fake testimonials and crypto jargon promising
massive, guaranteed returns, provided you keep investing.
Virtual Ponzi schemes: Cryptocurrency criminals promote non-existent opportunities to
invest in digital currencies and create the illusion of huge returns by paying off old investors
with new investors’ money. One scam operation, BitClub Network, raised more than $700
million before its perpetrators were indicted in December 2019.
"Celebrity" endorsements: Scammers pose online as billionaires or well-known names who
promise to multiply your investment in a virtual currency but instead steal what you send.
They may also use messaging apps or chat rooms to start rumours that a famous
businessperson is backing a specific cryptocurrency. Once they have encouraged investors to
buy and driven up the price, the scammers sell their stake, and the currency reduces in value.
Romance scams: The FBI warns of a trend in online dating scams, where tricksters persuade
people they meet on dating apps or social media to invest or trade in virtual currencies. The
FBI’s Internet Crime Complaint Centre fielded more than 1,800 reports of crypto-focused
romance scams in the first seven months of 2021, with losses reaching $133 million.

Otherwise, fraudsters may pose as legitimate virtual currency traders or set up bogus
exchanges to trick people into giving them money. Another crypto scam involves fraudulent
sales pitches for individual retirement accounts in cryptocurrencies. Then there is
straightforward cryptocurrency hacking, where criminals break into the digital wallets where
people store their virtual currency to steal it.

Is cryptocurrency safe?
Blockchain

Cryptocurrencies are usually built using blockchain technology. Blockchain describes the
way transactions are recorded into "blocks" and time stamped. It's a fairly complex, technical
process, but the result is a digital ledger of cryptocurrency transactions that's hard for hackers
to tamper with.

In addition, transactions require a two-factor authentication process. For instance, you might
be asked to enter a username and password to start a transaction. Then, you might have to
enter an authentication code sent via text to your personal cell phone.

While securities are in place, that does not mean cryptocurrencies are un-hackable. Several
high-dollar hacks have cost cryptocurrency start-ups heavily. Hackers hit Coincheck to the
tune of $534 million and BitGrail for $195 million, making them two of the biggest
cryptocurrency hacks of 2018.

Unlike government-backed money, the value of virtual currencies is driven entirely by supply
and demand. This can create wild swings that produce significant gains for investors or big
losses. And cryptocurrency investments are subject to far less regulatory protection than
traditional financial products like stocks, bonds, and mutual funds.

Four tips to invest in cryptocurrency safely

According to Consumer Reports, all investments carry risk, but some experts consider
cryptocurrency to be one of the riskier investment choices out there. If you are planning to
invest in cryptocurrencies, these tips can help you make educated choices.

Research exchanges:

Before you invest, learn about cryptocurrency exchanges. It’s estimated that there are over
500 exchanges to choose from. Do your research, read reviews, and talk with more
experienced investors before moving forward.

Know how to store your digital currency:

If you buy cryptocurrency, you have to store it. You can keep it on an exchange or in a digital
wallet. While there are different kinds of wallets, each has its benefits, technical
requirements, and security. As with exchanges, you should investigate your storage choices
before investing.

Diversify your investments:

Diversification is key to any good investment strategy, and this holds true when you are
investing in cryptocurrency. Don't put all your money in Bitcoin, for example, just because
that's the name you know. There are thousands of options, and it's better to spread your
investment across several currencies.

Prepare for volatility:

The cryptocurrency market is highly volatile, so be prepared for ups and downs. You will see
dramatic swings in prices. If your investment portfolio or mental wellbeing can't handle that,
cryptocurrency might not be a wise choice for you.
Blockchain

Cryptocurrency is all the rage right now, but remember, it is still in its relative infancy and is
considered highly speculative. Investing in something new comes with challenges, so be
prepared. If you plan to participate, do your research, and invest conservatively to start.

One of the best ways you can stay safe online is by using a comprehensive antivirus.

What Is a Permissioned Blockchain?

A permissioned blockchain is a distributed ledger that is not publicly accessible. It can only
be accessed by users with permissions. The users can only perform specific actions granted
to them by the ledger administrators and are required to identify themselves through
certificates or other digital means.

You might consider the addition of permissioned users as an extra blockchain security
system. Administrators maintain an access control layer to allow certain actions to be
performed only by certain identifiable participants. Records are kept within the blockchain
of who is involved in the transactions. This makes permissioned blockchains different from
public blockchains.

Understanding Permissioned Blockchains

A blockchain can be built and accessed in multiple ways. Some blockchains need special
permissions to read, access, and write information. Others only require that you have the
ability to connect and can conduct work for the network. The intrinsic configuration of each
blockchain controls the participants' transactions and defines their roles in which each
participant can access and contribute to the blockchain.

It may also include maintaining the identity of each blockchain participant on the network.
Such blockchains are called permissioned blockchains.

Difference Between Permissionless and Permissioned Blockchains

Permissioned blockchains are similar to permissionless blockchains because they use the
same technologies. However, permissioned blockchains do not allow users to access the
blockchain without identification.

For example, a bank may be running a permissioned blockchain operated through a


designated number of nodes internal to the bank to track money transfers. You cannot access
this blockchain because you don't have the permissions required. In contrast, you could join
a permissionless blockchain like a cryptocurrency mining network once you have
established a semi-anonymous account in that network.

Much of the inner workings of the blockchains are the same. The key differences between
them are:

 Enterprise vs. Public use


 Decentralization
 Development
 Transparency
Blockchain

Enterprise vs. Public Use


Bitcoin, the most popular cryptocurrency permissionless blockchain, allows anyone to
participate in the network in the capacity of a full node or a contributing miner. Anyone can
take a read-only role or make legitimate changes to the blockchain, like adding a new block
or maintaining a full copy of the entire blockchain.

As blockchain uses grow and mature, more businesses and governments have realized the
cost-saving benefits the technology introduces into an organization. As a result,
permissioned blockchains have become popular among industry-level firms and enterprises,
for which security, identity, and role definition are essential.

For instance, a manufacturer producing a product may use a permissioned blockchain that
ties into its supply chain management. The transactions on this blockchain would likely
involve logistics partners, financing banks, and other vendors involved in the supply and
financing processes. Each entity would have its own level of transparency and permissions
that it could use to streamline operations, track inventory, or monitor spending and
invoicing.

Decentralization
Permissionless blockchains have a broad decentralization in that they allow for more users
and can extend across a much larger network. On the other hand, permissioned blockchains
have limited decentralization as they are generally used for enterprise and business purposes,
requiring various amounts of centralization.

Development
Generally, permissionless blockchains are open source, which means that a community
develops them; they can be changed and used by anyone. Permissioned blockchains are
generally proprietary and controlled by the developers or the business using them.

A developer building a permissioned blockchain may opt to make a few select records, like
product name and quantity involved in a transaction, available for everyone to read.
However, only select participants are allowed to view the transaction price. Other
implementations may include limiting participants to act as nodes on the network, enhancing
the network's security.

All such permissioning and profile maintenance is handled by this access-control layer.
These differ from the un-permissioned or public blockchain networks, which don’t have a
control layer.

Transparency
Permissionless blockchains are much less transparent since they provide a certain amount of
anonymity for the users. Wallet addresses cannot generally be tracked back to the
blockchain users, and transactions are encrypted using various cryptography methods.

Permissioned blockchains require more transparency at certain levels since they are used for
conducting business. Nodes, or the users and their connections, are known and their
transactions are visible. Among many other benefits, this can defend a company against
double invoicing, spending, paying, or any other number of errors that can be made using
enterprise management programs.
Blockchain

What Is a Permissionless and a Permissioned Blockchain?

A permissioned blockchain requires user approval to join and is generally used for enterprise
purposes, whereas a permissionless blockchain is used for public purposes that require less
transparency and control.

What are Permissioned Blockchains Used for?

Permissioned blockchains are generally used to manage supply chains, create contracts,
verify payment between parties, and much more.

Basic blockchain security

Blockchain technology produces a structure of data with inherent security qualities. It's based
on principles of cryptography, decentralization and consensus, which ensure trust in
transactions. In most blockchains or distributed ledger technologies (DLT), the data is
structured into blocks and each block contains a transaction or bundle of transactions. Each
new block connects to all the blocks before it in a cryptographic chain in such a way that it's
nearly impossible to tamper with. All transactions within the blocks are validated and agreed
upon by a consensus mechanism, ensuring that each transaction is true and correct.

Blockchain technology enables decentralization through the participation of members across


a distributed network. There is no single point of failure and a single user cannot change the
record of transactions. However, blockchain technologies differ in some critical security
aspects.

How security differs by blockchain types

Blockchain networks can differ in who can participate and who has access to the data.
Networks are typically labeled as either public or private, which describes who is allowed to
participate, and permissioned or permissionless, which describes how participants gain access
to the network.

Public and private blockchains


Public blockchain networks typically allow anyone to join and for participants to remain
anonymous. A public blockchain uses internet-connected computers to validate transactions
and achieve consensus. Bitcoin is probably the most well-known example of a public
blockchain, and it achieves consensus through "bitcoin mining." Computers on the bitcoin
network, or “miners,” try to solve a complex cryptographic problem to create proof of work
and thereby validate the transaction. Outside of public keys, there are few identity and access
controls in this type of network.

Private blockchains use identity to confirm membership and access privileges and typically
only permit known organizations to join. Together, the organizations form a private,
members-only "business network." A private blockchain in a permissioned network achieves
consensus through a process called "selective endorsement," where known users verify the
transactions. Only members with special access and permissions can maintain the transaction
ledger. This network type requires more identity and access controls.
Blockchain

When building a blockchain application, it’s critical to assess which type of network will best
suit your business goals. Private and permissioned networks can be tightly controlled and
preferable for compliance and regulatory reasons. However, public and permissionless
networks can achieve greater decentralization and distribution.
What is Cryptographic Primitive in Blockchain?

Blockchain is a distributed, decentralized ledger. It comprises blocks connected to one


another. Each block comprises information such as transactions and a unique hash. The
medium of exchange in Blockchain is cryptocurrency or crypto.

What are Cryptographic Primitives?

In Blockchains, there are no third parties or Governments involved. It is fully decentralized


and various transactions happen in these networks. So security is of utmost importance in
Blockchain. Cryptographic primitives are used for building cryptographic protocols for a
strong secured network. They are the low-level algorithms that are used to build algorithms.
They are the basic building blocks of the cryptosystem. The programmers develop new
cryptographic algorithms with the help of cryptographic primitives.

Why Cryptographic Primitives are Important?

Cryptographic primitives are the basic building blocks for the development of security
protocols. Hence they are an integral part of the blockchain because of the following reasons:

 Security: To secure a transaction in the network or confidential information, strong


cryptography is required. So cryptographic primitives are used to develop high-level
algorithms.

 Encryption and Decryption: The Cryptographic primitives are used to develop


encryption and decryption algorithms. Encryption algorithms encrypt the data and
decryption algorithms decrypt the data as and when required.

 Validation: The validation of data is done with the help of digital signatures. These
digital signatures are public key primitives which the receivers use to validate the
message.

 Specific: Cryptographic primitives are very specific in nature. It means one


cryptographic primitive can perform only one function. For example, The encryption
algorithms developed using crypto primitives are only responsible for encrypting the
text. It is not responsible for hashing or decryption.

Combining Cryptographic Primitives

Cryptographic primitives are very specific in nature and new Cryptographic primitives cannot
be developed even by experts because it is very prone to errors and requires complex
mathematical analysis.

 Cryptographic designers combine the cryptographic primitives to form a strong


security protocol.
Blockchain

 For example, It is always beneficial to have a security protocol that can detect flaws
and remove the flaw as well.

 In the blockchain, SHA-256 a hashing algorithm is used in combination with a public


key algorithm to encrypt the data.

Types of Cryptographic Primitives

Below are some of the common cryptographic primitives:

 One way Hash Functions: It is a mathematical function used to encrypt variable


length data to fixed binary data. It is a one-way function. It means that once the input
has been converted to a binary sequence, there is no scope for reverting back. It is also
known as fingerprint or compression function. It is to be noted that a slight change in
input can also change the hash function. This is known as the avalanche effect. A
popular hash function is SHA-256.

 Symmetric Key cryptography: This is also known as Symmetric Encryption. Suppose


a message is encrypted using a key. The message is now converted to ciphertext
which is readable but has no meaning. The same key is used to decrypt the message.
A key is a variable used to encrypt or decrypt a text. It is basically used to ‘lock’ or
‘unlock’ data. In this cryptography, the key is shared between two users. The sharing
of keys is a problem. However, this technique is faster than public-key cryptography.
Examples are Advanced Encryption Standard (AES) and the Data Encryption
Standard (DES)

 Asymmetric key cryptography: It is also known as public key cryptography. Since


there is a problem with sharing keys in symmetric encryption, this method is used.
Here one key is public and another key is private. The public key is used to encrypt or
‘lock’ data. The private key is only accessible to the receiver. The receiver uses a
private key to ‘unlock’ the data. For example, Suppose Bob encrypts the data using
the public key. The public key is available to everyone but this key works in one way.
The receiver has the private key which works in one way and is used to decrypt the
message. Examples of public key algorithms are DSA and RSA

 Randomized Algorithms: These algorithms produce random ciphertexts for


encryption. The ciphertext is an encrypted text. It is very secure as random texts are
produced for encryption. It is impossible for hackers to find various combinations of
texts. It employs randomness as a logical part. It uses random inputs and gives correct
output. For Example, Monte Carlo

 Mix Network: It is a routing algorithm that uses public key cryptography to encrypt
data. The proxy servers take messages, encrypt them and shuffle them so that
communication cannot be traced. It basically breaks the flow of messages between the
sender and the target.
Blockchain

 Retrieval of Private information: It is a protocol that allows the user to retrieve


information from the database. Other users don’t get to know about it. The user can
anonymously retrieve data without taking permission.

 Initialization Vector: It is a number that is used along with a key for encryption. It is
used to prevent the duplicate generation of cipher text.

Blockchain Hash Function


A hash function takes an input string (numbers, alphabets, media files) of any length and
transforms it into a fixed length. The fixed bit length can vary (like 32-bit or 64-bit or 128-bit
or 256-bit) depending on the hash function which is being used. The fixed-length output is
called a hash. This hash is also the cryptographic by product of a hash algorithm. We can
understand it from the following diagram.

The hash algorithm has certain unique properties:

1. It produces a unique output (or hash).


2. It is a one-way function.

In the context of cryptocurrencies like Bitcoin

, the blockchain uses this cryptographic hash function's properties in its consensus
mechanism. A cryptographic hash is a digest or digital fingerprints of a certain amount of
Blockchain

data. In cryptographic hash functions, the transactions are taken as an input and run through a
hashing algorithm which gives an output of a fixed size.

SHA-256

A Bitcoin's blockchain uses SHA-256 (Secure Hash Algorithm) hashing algorithm. In 2001,
SHA-256 Hashing algorithm was developed by the National Security Agency (NSA) in the
USA.

How does the hashing process works?

For this hash function, we are going to use a program developed by Anders Brownworth.
This program can be found in the below link.

If we type any character in the data section, we will observe its corresponding cryptographic
hash in the hash section.

For example: We have type in data section: This is a great tutorial.

It will generate the corresponding Hash:

759831720aa978c890b11f62ae49d2417f600f26aaa51b3291a8d21a4216582a

Since the Hash function is a one-way function, there is no way to get back entire text from
the generated hash. This is different from traditional cryptographic functions like encryption
where you can encrypt something using the key and by using decryption, you can decrypt the
message to its original form.

Merkle Tree in Blockchain: What is it, How does it work and Benefits
What Is a Merkle Tree?

A hash tree, also known as a Merkle tree, is a tree in which each leaf node is labeled with the
cryptographic hash of a data block, and each non-leaf node is labeled with the cryptographic
hash of its child nodes' labels. The majority of hash tree implementations are binary (each
node has two child nodes), but they can also have many more child nodes.

But what actually is the Merkle tree in Blockchain, and how it is used in Blockchain? So, if
you want to know the answer to all these questions, then you are in the right place.
Blockchain

Merkle Tree in Blockchain: What is it, How does it work and Benefits
A hash tree, also known as a Merkle tree, is a tree in which each leaf node is labeled with the
cryptographic hash of a data block, and each non-leaf node is labeled with the cryptographic
hash of its child nodes' labels. The majority of hash tree implementations are binary (each
node has two child nodes), but they can also have many more child nodes.

But what actually is the Merkle tree in Blockchain, and how it is used in Blockchain? So, if
you want to know the answer to all these questions, then you are in the right place.

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

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

Cryptographic Hash Functions

 A hash function maps any type of arbitrary data of any length to a fixed-size output. It is
commonly used in cryptography since it is a cryptographic function.

 They are efficient and are well-known for one property: they are irreversible. It's a one-
way function that's only meant to work in one direction.

 Some of the Hash families available are Message Direct (MD), Secure Hash Function
(SHF), and RIPE Message Direct (RIPEMD).

Now, take an example, if you use the SHA256 hash algorithm and pass 101Blockchains as
input, you will get the following output

fbffd63a60374a31aa9811cbc80b577e23925a5874e86a17f712bab874f33ac9

In conclusion, these are the following key properties of the hash function:

 Deterministic

 Pre-Image Resistant

 Computationally Efficient

 Cannot be Reversed Engineered

 Collision Resistant
Blockchain

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.

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

Now, look at a little example of a Merkle Tree in Blockchain to help you understand the
concept.

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
Blockchain

And therefore, your Merkle Root is formed by combining these two hashes: Hash ABCD.

In reality, a Merkle Tree is much more complicated (especially when each transaction ID is
64 characters long). Still, this example helps you have a good overview of how the
algorithms work and why they are so effective.

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.

Why Is It Essential to Blockchain?


Blockchain

Think of a blockchain without Merkle Trees to get a sense of how vital they are
for blockchain technology. Let’s have one of Bitcoin because its use of Merkle Trees is
essential for the cryptocurrency and easier to grasp.

 If Bitcoin didn't include Merkle Trees, per se, every node on the network would have to
retain a complete copy of every single Bitcoin transaction ever made. One can imagine
how much information that would be.

 Any authentication request on Bitcoin would require an enormous amount of data to be


transferred over the network: therefore, you'll need to validate the data on your own.

 To confirm that there were no modifications, a computer used for validation would need a
lot of computing power to compare ledgers.

Merkle Trees are a solution to this issue. They hash records in accounting, thereby separating
the proof of data from the data itself.

 Proving that giving tiny amounts of information across the network is all that is required
for a transaction to be valid.

 Furthermore, it enables you to demonstrate that both ledger variations are identical in
terms of nominal computer power and network bandwidth.

Merkle Tree in Blockchain: What is it, How does it work and Benefits
Lesson 21 of 31By Simplilearn
Last updated on Aug 19, 202240592
Blockchain

PreviousNext
Table of Contents

What Is a Merkle Tree?


What Is a Merkle Root?
Cryptographic Hash Functions
Working of Merkle Trees
Benefits of Merkle Tree in Blockchain
View More
A hash tree, also known as a Merkle tree, is a tree in which each leaf node is labeled with the
cryptographic hash of a data block, and each non-leaf node is labeled with the cryptographic
hash of its child nodes' labels. The majority of hash tree implementations are binary (each
node has two child nodes), but they can also have many more child nodes.

But what actually is the Merkle tree in Blockchain, and how it is used in Blockchain? So, if
you want to know the answer to all these questions, then you are in the right place.

Professional Certificate Program in Blockchain

in Collaboration with IIT KanpurENROLL NOW

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

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

Caltech Blockchain Bootcamp

Learn how to set up private Blockchain networks.ENROLL NOW

Cryptographic Hash Functions

 A hash function maps any type of arbitrary data of any length to a fixed-size output. It is
commonly used in cryptography since it is a cryptographic function.

 They are efficient and are well-known for one property: they are irreversible. It's a one-
way function that's only meant to work in one direction.

 Some of the Hash families available are Message Direct (MD), Secure Hash Function
(SHF), and RIPE Message Direct (RIPEMD).

Now, take an example, if you use the SHA256 hash algorithm and pass 101Blockchains as
input, you will get the following output

fbffd63a60374a31aa9811cbc80b577e23925a5874e86a17f712bab874f33ac9

In conclusion, these are the following key properties of the hash function:

 Deterministic

 Pre-Image Resistant

 Computationally Efficient

 Cannot be Reversed Engineered

 Collision Resistant
Blockchain

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.

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

FREE Course: Blockchain Developer

Learn Blockchain Basics with the FREE CourseENROLL NOW

Now, look at a little example of a Merkle Tree in Blockchain to help you understand the
concept.

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:


Blockchain

 Hash AB

and

 Hash CD

And therefore, your Merkle Root is formed by combining these two hashes: Hash ABCD.

In reality, a Merkle Tree is much more complicated (especially when each transaction ID is
64 characters long). Still, this example helps you have a good overview of how the
algorithms work and why they are so effective.

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.

Blockchain Certification Training Course


Blockchain

Gain expertise in core Blockchain conceptsVIEW COURSE

Why Is It Essential to Blockchain?

Think of a blockchain without Merkle Trees to get a sense of how vital they are
for blockchain technology. Let’s have one of Bitcoin because its use of Merkle Trees is
essential for the cryptocurrency and easier to grasp.

 If Bitcoin didn't include Merkle Trees, per se, every node on the network would have to
retain a complete copy of every single Bitcoin transaction ever made. One can imagine
how much information that would be.

 Any authentication request on Bitcoin would require an enormous amount of data to be


transferred over the network: therefore, you'll need to validate the data on your own.

 To confirm that there were no modifications, a computer used for validation would need a
lot of computing power to compare ledgers.

Merkle Trees are a solution to this issue. They hash records in accounting, thereby separating
the proof of data from the data itself.

 Proving that giving tiny amounts of information across the network is all that is required
for a transaction to be valid.

 Furthermore, it enables you to demonstrate that both ledger variations are identical in
terms of nominal computer power and network bandwidth.
Blockchain

Use-Cases of Merkle Tree in Blockchain

There are more Merkle tree implementations out there.

 Git, a distributed version control system, is one of the most widely used. It is used to
handle projects by programmers from all around the world.

 Interplanetary File System, a peer-to-peer distributed protocol, is another suitable


implementation. It's also open-source, allowing computers to join and use a centralized
file system.

 It's part of the technique that generates verifiable certificate transparency logs.

 Amazon Dynamo DB and Apache Cassandra use it during the data replication process.
These No-SQL distributed databases use Merkle trees to control discrepancies.

What is Public Key Cryptography?

Public key cryptography is a security protocol that ensures the safety of data that we
exchange through a transaction in a blockchain network. The aspect of security is crucial
in a point-to-point network like blockchain. Because, in such a network, nodes do not
personally know and trust each other. There is a need for a robust security system in place.
One which secures the information they are sending or receiving without worrying about
security breaches. Also, this eliminates the need for all the nodes to know and trust each
other personally.

Public key cryptography is an asymmetric type of cryptography where we use a pair of


keys (public key and private key). It uses them to encrypt/decrypt the information and
verify the users. The process of public-key cryptography ensures two things i.e,

1. Encryption of the information at the sender’s end using the public key (of the receiver).
This ensures that no third party can access or understand the encrypted information in or
out of the network. Only the intended receiver can decrypt and read the message using its
own private key.

2. Signing the message or information for verification using the sender’s private key. This
authenticates the identity of the sender and states that he is a legitimate node in the
blockchain network. The receiver verifies this by using the public key of the sender. This
verification process of users in a network is done through digital signatures.
Blockchain

Thus, public-key cryptography is a way of providing a digital identity to the user. Through
this one can carry out secure transactions within a blockchain network. Now let us
understand exactly how this happens.

There are three key elements in public-key cryptography i.e. (i) Pair of keys; Private and
public key, (ii) Cryptography wallet and wallet address, and (iii) Digital signature. Each of
these three elements contributes significantly to creating an authentic digital identity just
like our bank account, account number, and password. The only difference here is that it is
to exchange information or cryptocurrency within a blockchain network.

Public key cryptography uses special algorithms to create these keys. These algorithms
work in a unidirectional manner, i.e. the algorithm will first create a private key from it, a
public key, and from it, a public address. We cannot reverse the order of generation i.e. we
cannot compute the private key from a public key or wallet address from the public key.

This ensures the security of the public key cryptography system even more. It is because
the public key and public address are made public to carry out transaction and verification
processes.

Therefore, public-key cryptography ensures the integrity of the information, the


authenticity of the user, and the legitimacy of the transaction. A private key is like an
account password for a user. One can decrypt a coded message sent to them and make a
digital signature from it for verification.

A public key is open for the network which others use to verify a transaction and encrypt a
message. Thus, whenever a transaction takes place between two nodes, the private and
public keys of both the nodes take part in making the transaction secure. It does so by
encrypting the information and verifying the user by their digital signature. This double
layer of protection makes public-key cryptography the best security system for
blockchain.

Concept of keys: Public key and Private key

The cryptographic keys are the most essential element in public-key cryptography.
Without the function and significance of keys, there is not much left to understand in
public-key cryptography. So, let us learn the concept of keys!
Blockchain

As we know, we use a pair of keys i.e. Public key and Private key in public-key
cryptography. Both of these keys are generated using the Elliptic Curve cryptography
method. Firstly, it creates the private key and then it creates a public key from the private
key using the Elliptic Curve Algorithm (aka ECDSA). Therefore, both the private and
public keys are cryptographically and mathematically linked to each other.

There is an important thing to note here, i.e. the process of generating a public key from
the private key is irreversible. That is, we can obtain the corresponding public key from its
private key but we cannot obtain the private key from its public key. The algorithm is
designed in such a way that it requires a lot of computational power and time to brute
force the private key which is next to impossible.

This algorithm helps in keeping the private key private and untraceable from the public
key. Because a node in the blockchain network can only carry out transactions within the
network. It is possible if its private key is kept secret and its public key which others
know in the network.

The private and public keys are of a certain length depending on the algorithm used to
create them. Usually, the key length is 256 bits or can fall in the range of 1024 to 2048
bits. Now, the length of the public key seems a little too long for us to easily distribute it
in the network. So, we need to create a shorter public address from the public key using a
hashing function. Here, the public key is like an email address and public address is like
the username. It is obvious that sharing your username with others is easier than sharing
the entire email address.

Just like how we cannot compute a private key from its public key, we cannot compute a
public key from the public address. Public address (also called a Bitcoin address in a
Bitcoin network) is the first thing that we need if two nodes want to carry out a transaction
on the blockchain network.

Therefore, in Public-key cryptography the most important elements are a private key, a
public key, and the public address. All of this information is kept secure in a software
known as Wallet. A digital wallet is independent of the blockchain network. It stores the
important information of a blockchain node such as its address, private key, the public
key, and transaction balance.
Blockchain

Let us learn about the private and public key in a little more detail.

1. Private Key

A private key is a long series of alphanumeric characters that is unique for every
individual user or node in the blockchain network. A private key is like a password which
if shared can give away our confidential information. So, we must keep our private key
confidential from the network.

The digital wallets (software or hardware) essentially store the private key as its security is
very important. The usual format for storing the key is a wallet import format which has a
51 character long key. This length may vary depending upon the storage formats.

The two main functions of a private key in providing security in a blockchain network are:

a. The private key is used to decrypt a message that the sender encrypts using the public
key (of the receiver). This ensures that the intended receiver gets the encrypted message
and is safe from other users on the way. Once the message reaches the receiver intact, he
decrypts it into a readable format using his private key.

b. Another important function of the private key is securing the message or information by
digital signature. A digital signature is used to verify a blockchain transaction. In the
digital signature, the message is signed using the sender’s private key. In this way, the
receiver can verify that the message (using the sender’s public key) is actually sent by the
sender and not someone else.

2. Public Key

A public key is the counterpart of a private key as it is cryptographically derived from it.
A public key is available for all the nodes in the network. This helps in the verification of
a transaction by all the nodes in a blockchain network. Let’s suppose that you are a node
in the network and you want to send a message or information to another node.
Blockchain

To carry out a secure transaction you will sign the message from your private key and
send it for verification from the entire network. Each node can access your public key and
so they will verify the transaction as authentic and pass it. When all the nodes verify your
transaction using your public key the transaction can take place. Generally, a public
address is used for transactions rather than the public key because of its length. The public
key is long and not easily shareable. So, a shorter version of it is created by hashing which
is the public address.

The two main functions of a public key in providing security in a blockchain network are:

a. To encrypt a message or information using the public key of the receiver. This ensures
that only the receiver who has its corresponding private key can decrypt and read the
message.

b. To verify if the sender is authentic by confirming the digital signature. A digital


signature is done by the sender’s private key. A public key verifies the sender’s identity by
matching (complementing) with his private key.

Digital signatures in blockchain

After the private key and public key, another important aspect of public-key cryptography
is the digital signature. No transaction in a blockchain network is secure if it is not
digitally signed by the sender’s private key. The cryptography i.e. the encryption done
using the public and private keys ensures that the information we are sending to other
nodes is safe and no one in the middle can read or change it.

Whereas, the purpose of doing a digital signature before sending the information is to state
authority over the information and tokens (cryptocurrency). It is like signing a cheque where
you state that it is your money that you are giving from your authorized bank account.
Similarly, when you digitally sign the information you send in a blockchain network, you
say that you are an authorized node. And you rightfully own the tokens or currency you wish
to give to someone in the network. Therefore, the digital signature proves the ownership of
the funds and the account and protects them from forgery.
Now, let us learn how digital signatures are done.
Before we start understanding the entire process of digital signatures, we must know which
algorithm is used to create digital signatures. Similar to the private and public key, digital
signature is created by the Elliptic Curve Digital Signature Algorithm (ECDSA). An
important thing to note here is that ECDSA is not based on encryption. This means that the
keys are not encrypted, only the message or information that we are sending is encrypted.
This algorithm applies itself in two parts;
1. In the first part, it takes the private key and Merkel root (hash) of the transaction and
creates the signature by mathematical computations. Then this signed transaction is sent out
Blockchain

to other users on the blockchain network. They will all verify the signature of the sending
node using the second part of the algorithm.
2. In the second part, other nodes compute a binary result using the digital signature of the
sender, the transaction information, and the public key of the sender. If the mathematical
algorithm gives the result as True, then it is verified that the sender has sent the message from
an authentic node.
All the validating nodes or computers in the network will verify the digital signature by using
the sender’s public key.
How does Public-key cryptography work?
Now that we are through with all the important concepts related to public-key
cryptography. Let us move on to understand the entire process of public-key cryptography.
And how does it work to secure and verify a transaction on the blockchain.
Suppose you are a legitimate node on a blockchain network. Now, you need to have three
things in order to carry out secure transactions within the network; a private key, a public
key, and a wallet address, or a public address. For this, you need to install a blockchain wallet
software that will automatically create a pair of private key and public key and a wallet
address. This software is an independent platform from the blockchain. It gives you a digital
identity and a safe place to keep your keys.
Furthermore, your public address (aka wallet address) is like a mailbox and your private key
is like the key of that mailbox. Your mailbox or its address is known to everyone and anyone
can send you things using the mailbox. But, only you can open your mailbox and access the
contents inside it using the key to the mailbox. Similarly, anyone within the blockchain
network can send you tokens or messages to your public address. But only you can decrypt
and read that message using your private key.
Let us summarize the working of public-key cryptography with the help of a situation. Here
Raj wants to send a message to Aditi on a blockchain network. We call this exchange of
information between two nodes on the blockchain a “transaction”.
Step 1: Raj will take the message that he wants to share and encrypt it using Aditi’s public
key or public address. This will convert the message into an unreadable format.
Step 2: Raj will now take the hashed message and sign this message using his private key.
This is known as digitally signing the transaction (digital signature).
Step 3: Now, Raj is ready to send this message to Aditi via the blockchain network. But
before this, Raj needs to get this transaction verified by the entire blockchain network. Using
Raj’s public key, every node on the network will verify the digital signature of Raj and pass
the transaction.
Step 4: After successful verification, Aditi will receive the message but in an encrypted form
known as ciphertext. First off, Aditi will also verify the digital signature of Raj using his
public key or public address.
Step 5: Then, Aditi will decrypt the ciphertext using her private key. This will convert the
message into a readable format.
Step 6: The transaction is successfully carried out. Also, it is recorded on a new block in the
blockchain permanently. No one can deny that this transaction between Raj and Aditi did not
take place.
Benefits of Public Key Cryptography
Public key cryptography promises a lot of security benefits in an open network like
blockchain. Three most important aspects, as well as benefits of using public-key
cryptography as the security method, are; Confidentiality, Integrity, and Authenticity.
1. Confidentiality: Blockchain assures confidentiality of the data that we are sharing by
using a pair of keys. The public and private keys that are linked to each other make sure that
the data or information that we are sending is kept secret from others. It maintains
Blockchain

confidentiality by encrypting the data using a public key and decrypting it on the other end
using its corresponding private key.
2. Integrity: Public-key cryptography also maintains the integrity of the data by encrypting
the data. Due to end encryption, no one except for the sender and the receiver has access to
the information. So, one can be sure that the data is intact and no one has changed it in the
middle.
3. Authenticity: Another important aspect and a major benefit of public-key encryption is the
authenticity of the user. Because it uses digital signatures in every transaction, it is impossible
for some to fake their identity. That is why every node on the blockchain network can be sure
that the sender is an authentic part of the network. This is how blockchain builds trust
amongst its users.
Limitations of Public Key Cryptography
Just like everything has a downside to it, there are a few limitations of public-key
cryptography.
1. The ability of mathematical algorithms to encrypt and decrypt data or messages is limited
to only a certain size of data. If there are large amounts of data that need to be encrypted the
algorithm runs slow. This slows down the process of encryption and demands greater
computational power.
2. If someone has access to the secret private key or accidentally exposes it to the network.
All the data encrypted using that private key will be in the wrong hands. One cannot restore
or re-encrypt the data once the private key is out.
3. If a node loses its private key, its data will forever be stuck and they cannot make
transactions from the same public address again. Such a node will not be able to access the
data encrypted by its private key.
What is Zero-Knowledge Proof?
Zero-Knowledge Proof is a cryptographic technique where no information is revealed during
a transaction except for the interchange of some value known to both the prover and verifiers
(the two ends of the process). The idea behind zero-knowledge proof is that a user can prove
to another user that they know an absolute value without actually revealing any other or extra
information.
ZKPs have the following three inherent properties:
 Completeness
The completeness property notes that the transaction is verified, and the prover is
permitted for processing the transaction ahead. When the transaction statement is true,
the verifier has the authority to permit the prover for the input he requested earlier.

 Soundness
The soundness property notes that the transaction is correct and not a part of any
fraudulent case. It means that if the transaction situation is otherwise and the
statement is wrong, the verifier cannot be convinced in any case. In this situation, the
verifier cannot certify the prover or permit the prover’s request for the inputs.

 Zero-knowledge
The verifier cannot have any information other than the current statement and the
statement’s authenticity being true or false. Any other information and private data of
various parties will be hidden.

At the top level, creating a Zero-Knowledge Proof requires the verifier’s questioning of the
prover to go through a series of actions that can be performed when the prover knows all the
Blockchain

required information correctly. The prover will eventually be proven wrong by the verifier’s
test with a higher degree of probability.

What are the two fundamental types of Zero-Knowledge Proof?

The two fundamental types of ZKPs include the following:

 Interactive ZKP
The actions associated with the concepts deal with mathematical probability. In
interactive ZKP, a prover needs to convince a specific verifier and repeat this process
for each verifier. In interactive ZKPs, the prover must complete a series of actions to
convince the verifier about a specific fact.

 Non-Interactive ZKP
Non-interactive ZKPs don’t have any voluntary interaction between the verifier and
the prover. In non-interactive ZKP, a prover creates proof that anyone can verify, and
the verification process can also be moved to a later stage. For a better mechanism of
non-interactive ZKPs, they need specific software.

Let’s now understand the concept of ZKP and its usage with technology. One prominent
usage of Zero-Knowledge proof is Zcash. Zcash is the initial application of zk-SNARKs and
the fundamental form of Zero-Knowledge cryptography.

Now we need to understand what is zk-SNARKs. zk-SNARKs is an acronym for Zero-


Knowledge Succinct Non-Interactive Argument of Knowledge. zk-SNARKs is a technology
that uses non-interactive ZKP.

zk-SNARKs works on the following three algorithms.

 Key Generator
A key generator establishes a parameter to generate a key pair. Here, a trusted source
can delete the private information after generating a private or public key pair. Then,
another key pair is generated using the public information. Of this pair, one would be
used for proving and another for verifying.

 Prover
The prover gets proving key and needs to prove his knowledge. He will receive and
verify the private key and then shall forward the statement.

 Verifier
The verifier will get the input from the prover and will validate the statement’s
authenticity.

Zk-SNARKS need to maintain the following four properties too.

 The verifier won’t learn anything other than the statement. If there is a challenge that
needs to be succinct, it should need only a few milliseconds for execution.
Blockchain

 Non-interactive: the process should be non-interactive.

 The proof should follow the principle of soundness, having zero-knowledge


encryption.

 Prover and verifier cannot carry on with the process without a trusted witness.

What are the various use cases of Zero-Knowledge Proof on the blockchain?

 Messengers on blockchain
Although messengers we have nowadays promised to be encrypted, unencrypted
blockchain can be the next big thing in the technological world. With the guarantee of
an un-encrypted yet robust solution, ZKPs and blockchain can co-create a value-
added messenger platform secured for one and all.

 Next-gen file system controls


ZKPs can help in adding multiple layers of security to files, logins. As a result, ZKPs
can present notable obstacles for hackers or manipulators to alter and retrieve the data.

 Protection of storage
ZKPs include a security protocol with the information included in the storage unit.
The access channels have formidable safeguards that create a highly secure and
seamless environment.

 Transferring private blockchain transactions


The most notable concern in private blockchain transactions is numerous loopholes
evident in conventional procedures. The productive integration of ZKP with private
blockchain transactions can create a powerful hacker-proof process.

 Data Security
Organizations that control sensitive data, such as banks and hospitals, must keep them
free from third-party access. ZKPs and blockchain together can make accessing data
impossible.

What are the advantages of Zero-Knowledge Proof?

Advantages of Zero-Knowledge Proof:

 Simplicity
Simplicity is probably the most noted attribute of ZKPs. It does not require any
software knowledge to operate but can offer superior solutions that impact our daily
lives. Moreover, as it is completely un-encrypted yet highly secure, it can offer the
best of both worlds seamlessly.

 Secure
ZKPs are extremely secure when it comes to sharing information. So, a user can use it
with confidence while not having to master the codes or analytics to understand its
basics.
Blockchain

 Time saver
ZKPs shorten the time required in blockchain transactions, offering value to users in a
noble manner.

 Privacy
Safeguarding the privacy of its users is the most appreciated characteristic of ZKPs. It
never requires sensitive data-sharing and hence is supremely private in general.

 Safety
Users of ZKPs are aware of the need for ZKPs to share data, and they can stay away
from any company that needs access to personal information without a valid reason.

Applications of Zero-Knowledge Proof

Apart from some blockchains such as ZCash, ZKPs are also used in private transactions that
do not reveal monetary data and receiver and sender information. The decentralized Oracle
networks that provide smart contracts off-chain data can also leverage ZKPs some facts about
off-chain data without actually exposing on-chain information.

DECO, a privacy-controlled oracle protocol within the Chainlink’s network, uses ZKPs in the
blockchain. DECO guarantees that data will remain private and tamper-proof by extending
HTTPS/TLS, the most basic data transfer protocols. DECO uses the most modern version of
TLS, needs no special hardware, and works in a backward-compatible manner, without any
server-side changes. So, DECO-enabled chainlink oracle nodes can check the proof of data
sourced from trusted servers without revealing on-chain data. DECO-like smart contracts
enable banking and financial institutions to offer undercollateralized loans, where the
borrower has proven creditworthiness. The borrowers can generate the credentials depending
on records from authoritative sources without revealing sensitive personal or professional
data.

Decentralized Identity protocols such as CanDID are a platform powered by ZKP where
users can retrieve their information and credentials without relying on a third party. These
credentials are signed by issuers who can authoritatively connect claims with users, including
citizenship, occupation, educational qualification etc. DECO allows an existing web server as
the issuer with key-sharing management to back up accounts and privacy- a hidden form of
Sybil resistance depending on definitive unique identifiers, such as Social Security Numbers
(SSNs).

By providing a way to monetize the proprietary and sensitive datasets, DECO helps
traditional institutions and data providers confidentially. Instead of posting all data on-chain,
these service providers can use attestations accessed from ZKPs to prove facts about the data
that will be published. It creates a new market for data providers to monetize and increase
their dataset revenue with zero data leakage.

You might also like