0% found this document useful (0 votes)
3 views

Unit 1 - Blockchain Basic.docx

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Unit 1 - Blockchain Basic.docx

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

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 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.
Blockchain Version
The brief description of the evolution of blockchain technology and its versioning from 1.0 to
3.0 are explained below.

Blockchain 1.0: Currency

The idea of creating money through solving computational puzzles was first introduced
in 2005 by Hal Finney, who created the first concept for cryptocurrencies (The implementation
of distributed ledger technology). This ledger allows financial transactions based on blockchain
technology or DLT to be executed with Bitcoin. Bitcoin is the most prominent example in this
segment. It is being used as cash for the Internet and seen as the enabler of an Internet of
Money.

Blockchain 2.0: Smart Contracts

The main issues that came with Bitcoin are wasteful mining and lack of network scalability. To
overcome these issues, this version extends the concept of Bitcoin beyond currency. The new
key concepts are Smart Contracts. It is small computer programs that "live" in the blockchain.
They are free computer programs which executed automatically and checked conditions which
are defined earlier like facilitation, verification or enforcement. The big advantage of this
technology that blockchain offers, making it impossible to tamper or hack Smart Contracts. A
most prominent example is the Ethereum Blockchain, which provides a platform where the
developer community can build distributed applications for the Blockchain network.
Quickly, the blockchain 2.0 version is successfully processing a high number of daily
transactions on a public network, where millions were raised through ICO (Initial Coin
Offerings), and the market cap increased rapidly.

Blockchain 3.0: DApps

DApps is also known as a decentralized application. It uses decentralized storage and


communication. Its backend code is running on a decentralized peer-to-peer network. A DApp
can have frontend code hosted on decentralized storages such as Ethereum Swarm and user
interfaces written in any language that can make a call to its backend like a traditional Apps.

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

Note: A blockchain can be used for the secure transfer of money, property, contracts, etc.
without requiring a third-party intermediary like bank or government. Blockchain is a software
protocol, but it could not be run without the Internet (like SMTP used in email).

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
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
information. This method ensures that all transactions are validated, and all valid
transactions are added one by one.

Difference between Blockchain and Database

Blockchain

A blockchain is a database or a ledger that stores information in a data structure called blocks. It
is based on distributed ledger technology which can be used between parties that don't trust each
other with data. It is because when you add anything onto the blockchain, it requires verification
from all other users available on the network.
Blockchain keeps information permanently in uniformly sized blocks, where each block stores
the hashed information from the previous block to provide cryptographic security. The
blockchain hashing uses SHA256 hashing algorithm, which is a one-way hash function. The
hashed information is the data and a digital signature from the previous block. The hashes of
previous blocks that go back to the very first block produced in the blockchain are known as
the genesis block. A blockchain data structure is in the form of a Merkle Tree, which is used as
an efficient way to verify data.

Advantage 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.
o Unchangeable transactions: Blockchain only allows insertion of data, which 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 Decentralized: It is because there is no central authority supervising anything. There are
standards rules on how every node exchanges the blockchain information.

Databases

A database is a kind of central ledger where the administrator manages everything. Here the
administrator gives rights to read, write, update, or delete operation. Since it is centralized in
nature, their maintenance is easy, and output is high. But it also has a drawback which, when
corrupted, can compromise the entire data and can even change the ownership of digital
records.

A database uses a client-server network architecture. Here database administrator has rights to
make changes in any part of the data and its structure.
Advantage of Database

The database has become popular because of the following.

o Controls database redundancy: It is because it stores all the data in one single database
file and that recorded data is placed in the database.
o Data sharing: In DBMS, the authorized users of an organization can share the data
among multiple users.
o Easily Maintenance: It can be easily maintainable due to the centralized nature of the
database system.
o Reduce time: It reduces development time and maintenance need.
o Backup: It provides backup and recovery subsystems which create an automatic backup
of data from hardware and software failures and restores the data if required.
o Multiple user interfaces: It provides different types of user interfaces like graphical user
interfaces, application program interfaces.

Blockchain vs Database

We can see the difference between blockchain and database in the below table.

SN Blockchain Database

1. Blockchain is decentralized The database is centralized because it has


because there is no admin or admins and in-charge.
in-charge.

2. Blockchain is permissionless The database required permission because it


because anyone can access it. can be accessed only by entities who have
rights to access.

3. Blockchains are slow. Databases are fast.

4. It has a history of records and It has no history of records and ownership of


ownership of digital records. records.

5. Blockchain is fully confidential. The database is not fully confidential.

6. Blockchain has only Insert The database has Create, Read, Update, and
operation. Delete operation.
7. It is a fully robust technology. It is not entirely robust technology.

8. Disintermediation is allowed Disintermediation is not allowed with the


with blockchain. database.

9. Anyone with the right proof of Only entities entitled to read or write can do
work can write on the so.
blockchain.

10. Blockchain is not recursive. The database is recursive. Here, we can go


Here, we cannot go back to back to repeat a task on a particular record.
repeat a task on any record.

Components of Blockchain
1. Node: Nodes are network participants and their devices permit them to keep track of the
distributed ledger and serve as communication hubs in various network tasks. A block
broadcasts all the network nodes when a miner looks to add a new block in transactions
to the blockchain.
2. Transactions: A transaction refers to a contract or agreement and transfers of assets
between parties. The asset is typically cash or property. The network of computers in
blockchain stores the transactional data as a copy with the storage typically referred to as
a digital ledger.
3. Block: A block in a blockchain network is similar to a link in a chain. In the field of
cryptocurrency, blocks are like records that store transactions like a record book, and
those are encrypted into a hash tree. There are a huge number of transactions occurring
every day in the world. The users need to keep track of those transactions, and they do it
with the help of a block structure. The block structure of the blockchain is mentioned in
the very first diagram in this article.
4. Chain: Chain is the concept where all the blocks are connected with the help of a chain
in the whole blockchain structure in the world. And those blocks are connected with the
help of the previous block hash and it indicates a chaining structure.
5. Miners: Blockchain mining is a process that validates every step in the transactions while
operating all cryptocurrencies. People involved in this mining they called miners.
Blockchain mining is a process to validate each step in the transactions while operating
cryptocurrencies.
6. Consensus: A consensus is a fault-tolerant mechanism that is used in computer and
blockchain systems to achieve the necessary agreement on a single state of the network
among distributed processes or multi-agent systems, such as with cryptocurrencies. It is
useful in record keeping and other things.
Data Storage and Management
1. Header: It is used to identify the particular block in the entire blockchain. It handles all
blocks in the blockchain. A block header is hashed periodically by miners by changing
the nonce value as part of normal mining activity, also Three sets of block metadata are
contained in the block header.
2. Previous Block Address/ Hash: It is used to connect the i+1th block to the ith block
using the hash. In short, it is a reference to the hash of the previous (parent) block in the
chain.
3. Timestamp: It is a system that verifies the data into the block and assigns a time or date
of creation for digital documents. The timestamp is a string of characters that uniquely
identifies the document or event and indicates when it was created.
4. Nonce: A nonce number which used only once. It is a central part of the proof of work in
the block. It is compared to the live target if it is smaller or equal to the current target.
People who mine, test, and eliminate many Nonce per second until they find that
Valuable Nonce is valid.
5. Merkel Root: It is a type of data structure frame of different blocks of data. A Merkle
Tree stores all the transactions in a block by producing a digital fingerprint of the entire
transaction. It allows the users to verify whether a transaction can be included in a block
or not.

Types of Blockchain
1. Public Blockchain
A public blockchain is a concept where anyone is free to join and take part in the core activities
of the blockchain network. Anyone can read, write, and audit the ongoing activities on a public
blockchain network, which helps to achieve the self-determining, decentralized nature often
authorized when blockchain is discussed. Data on a public blockchain is secure as it is not
possible to modify once they are validated.
The public blockchain is fully decentralized, it has access and control over the ledger, and its
data is not restricted to persons, is always available and the central authority manages all the
blocks in the chain. There is publicly running all operations. Due to no one handling it singly
then there is no need to get permission to access the public blockchain. Anyone can set his/her
node or block in the network/ chain.
After a node or a block settle in the chain of the blocks, all the blocks are connected like
peer-to-peer connections. If someone tries to attack the block then it forms a copy of that data
and it is accessible only by the original author of the block.

Public Blockchain
Advantages:
1. Decentralization: High level of decentralization, which reduces the risk of single points
of failure and increases security.
2. Transparency: All transactions are visible to anyone, enhancing transparency and trust.
3. Immutability: Once data is recorded, it cannot be altered or deleted, providing a
permanent record.
Disadvantages:
1. Scalability Issues: Public blockchains often face scalability problems, with limited
transaction throughput and slower processing times.
2. Energy Consumption: Some consensus mechanisms, like Proof of Work (PoW), require
significant computational power and energy.
3. Privacy Concerns: Public visibility of transactions may lead to privacy issues, as
sensitive data can be exposed.
2. Private Blockchain
Miners need permission to access a private blockchain. It works based on permissions and
controls, which limit participation in the network. Only the entities participating in a transaction
will know about it and the other stakeholders not be able to access it.
It works based on permissions due to this it is also called a permission-based blockchain.
Private blockchains are not like public blockchains it is managed by the entity that owns the
network. A trusted person is in charge of the running of the blockchain it will control who can
access the private blockchain and also control the access rights of the private chain network.
There may be a possibility of some restrictions while accessing the network of the private
blockchain.
Private Blockchain
Advantages:
1. Performance and Speed: Faster transaction processing and higher throughput compared
to public blockchains due to fewer nodes and reduced consensus requirements.
2. Privacy: Transactions and data are visible only to authorized participants, enhancing
privacy.
3. Control: Centralized control allows for easier governance and compliance with
regulations.
Disadvantages:
1. Centralization: Less decentralized than public blockchains, which can introduce single
points of failure and reduce the security benefits.
2. Trust: Requires participants to trust the central authority or consortium managing the
blockchain.
3. Limited Transparency: Reduced transparency can make it harder for external auditors
to verify data.
3. Consortium Blockchain
A consortium blockchain is a concept where it is permissioned by the government and a group
of organizations, not by one person like a private blockchain. Consortium blockchains are more
decentralized than private blockchains, due to being more decentralized it increases the privacy
and security of the blocks. Those like private blockchains connected with government
organizations’ block networks.
Consortium blockchains lie between public and private blockchains. They are designed by
organizations and no one person outside of the organizations can gain access. In Consortium
blockchains all companies in between organizations collaborate equally. They do not give
access from outside of the organizations/ consortium network.
Advantages:
1. Efficiency: Better performance and efficiency than public blockchains due to fewer
nodes and optimized consensus mechanisms.
2. Shared Control: Governance is shared among consortium members, which can enhance
trust and cooperation.
3. Privacy and Security: Improved privacy and security compared to public blockchains,
as access is restricted.
Disadvantages:
1. Complex Governance: Decision-making can be complex due to multiple stakeholders
with potentially conflicting interests.
2. Less Decentralization: While more decentralized than private blockchains, consortium
blockchains still have a limited number of participants, which can reduce some
decentralization benefits.
3. Interoperability: Challenges can arise when integrating with other blockchain networks
or systems.
4. Hybrid Blockchain
Hybrid blockchains combine elements of both public and private blockchains. They aim to offer
the benefits of both types, allowing for controlled access and transparency. Examples include
Dragonchain and IBM’s Food Trust.
Advantages:
1. Flexibility: Offers the ability to balance transparency and privacy based on the needs of
the organization or project.
2. Scalability and Performance: Can be designed to optimize performance and scalability
while maintaining some degree of transparency.
3. Customizable Access: Allows organizations to control who can access certain data while
making some data available to the public.
Disadvantages:
1. Complexity: Implementation can be more complex due to the need to manage different
access levels and integrations.
2. Governance Challenges: Balancing governance between public and private aspects can
be challenging.
3. Potential for Confusion: This may requires lead to confusion among users and
stakeholders about the nature and scope of access and transparency.
Consensus Mechanisms in Blockchain
There are different kinds of consensus mechanism algorithms, each of which works on different
principles:
1. Proof of Work (PoW): Proof of Work requires a stakeholder node to prove that the work
is done and submitted by them certifying them to receive the right to add new
transactions in the blockchain. Examples include Bitcoin and Ethereum (before Ethereum
2.0).
2. Proof of Stake (PoS): The Proof of Stake is also a common consensus algorithm that
evolved as a low-cost low-energy-consuming, low-energy-consuming alternative for the
PoW algorithm. For providing the responsibilities the public ledger provides by the
virtual currency token like Bitcoin and Ethereum. Examples include Ethereum 2.0 and
Cardano.
3. Proof of Elapsed Time (PoET): PoET encrypts the passage of time cryptographically to
reach an agreement without expending many resources.
4. Delegated Proof of Stake (DPoS): Stakeholders elect a limited number of delegates to
validate transactions and create blocks on their behalf. It has higher transaction
throughput and faster block creation. In DPoS, risk of centralization and reliance on
elected delegates. Examples include EOS and TRON.
5. Proof of Authority (PoA): A small number of pre-approved validators are responsible
for creating blocks and validating transactions. PoA has high efficiency and low energy
consumption. There is a risk of centralization and dependency on the trustworthiness of
validators. Examples include VeChain and private Ethereum networks.
6. Practical Byzantine Fault Tolerance (PBFT): In PBFT, nodes reach consensus through
voting, even if some nodes act maliciously or fail. It is effective in handling Byzantine
faults and offers fast transaction processing. There is a complexity in scaling to large
networks. Examples include Hyperledger Fabric.
Cryptographic Foundations in Blockchain
Cryptography is important to the security and functionality of blockchain technology. Here is an
overview of the key cryptographic foundations used in blockchain:
1. Hash Functions: Hash functions are algorithms that generate a fixed-size output (hash)
from variable-size input data. They are designed to be fast and produce unique outputs for
different inputs. Hash functions are used to create block hashes, ensuring the integrity of
the data within the block and linking blocks together in the chain. Examples include
SHA-256 used in Bitcoin.
2. Digital Signatures: Digital signatures use asymmetric cryptography to verify the
authenticity and integrity of messages or transactions. They involve a private key to sign
data and a public key to verify the signature. Digital signatures secure transactions by
allowing users to sign transactions with their private keys and enabling others to verify
these signatures with the corresponding public keys. Examples include the Elliptic Curve
Digital Signature Algorithm (ECDSA) used in Bitcoin and Ethereum.
3. Public and Private Keys: In asymmetric cryptography, a key pair consists of a public
key, which is shared with others, and a private key, which is kept secret. The public key
encrypts data, and the private key decrypts it, or vice versa. Public and private keys are
fundamental for creating and managing wallets, securing transactions, and authenticating
users on the blockchain. Examples include RSA (Rivest-Shamir-Adleman), ECC (Elliptic
Curve Cryptography), etc.
4. Merkle Trees: Merkle trees are a type of hash tree where each leaf node represents a
hash of data, and each non-leaf node represents a hash of its child nodes. They are used to
efficiently and securely verify the integrity of large sets of data. Merkle trees are used to
organize and verify transactions within a block, allowing for efficient and secure
validation. Examples include the Merkle root in Bitcoin blocks.
Double Spending Problem
Double spending means spending the same money twice. As we know, any transaction can be
processed only in two ways. One is offline, and another is online.
Offline: A transaction which involves physical currency or cash is known as an offline
transaction.
Online: A transaction which involves digital cash is known as an online transaction.
Let us consider this example:
You go to Restaurants and order a cappuccino worth $5. You pay in cash. The service provider
at Restaurants instantly confirmed that you have paid, and you received your coffee in exchange
for the money. Now is it possible to spend the same $5 somewhere else to make another
purchase? The answer is NO. But what if the answer is YES? It means the same person can use
the same cash more than one times. This type of problem is known as Double Spending
Problem.

In a physical currency, the double-spending


problem can never arise. But in digital cash-like bitcoin, the double-spending problem can arise.
Hence, bitcoin transactions have a possibility of being copied and rebroadcasted. It opens up the
possibility that the same BTC could be spent twice by its owner.
How Bitcoin handles the Double Spending Problem?
Bitcoin handles the double-spending problem by implementing a confirmation mechanism and
maintaining a universal ledger called blockchain.
Let us suppose you have 1 BTC and try to spend it twice. You made the 1 BTC transaction to
Alice. Again, you sign and send the same 1 BTC transaction to Bob. Both transactions go into
the pool of unconfirmed transactions where many unconfirmed transactions are stored already.
The unconfirmed transactions are transactions which do not pick by anyone. Now, whichever
transaction first got confirmations and was verified by miners, will be valid. Another transaction
which could not get enough confirmations will be pulled out from the network. In this example,
transaction T1 is valid, and Alice will receive the bitcoin.
What happened if both the transactions are taken simultaneously by the miners?
Suppose two different miners will pick both transactions at the same time and start creating a
block. Now, when the block is confirmed, both Alice and Bob will wait for confirmation on
their transaction. Whichever transaction first got confirmations will be validated first, and
another transaction will be pulled out from the network.
Now suppose if both Alice and Bob received the first confirmation at the same time, then there
is a race will be started between Alice and Bob. So, whichever transaction gets the maximum
number of confirmations from the network will be included in the blockchain, and the other one
will be discarded.
What Is Double-Spending?
Double-spending is the risk that a cryptocurrency can be used twice or more. Transaction
information within a blockchain can be altered if specific conditions are met. The conditions
allow modified blocks to enter the blockchain; if this happens, the person that initiated the
alteration can reclaim spent coins.
KEY points
● Double-spending occurs when someone alters a blockchain network and inserts a special
one that allows them to reacquire a cryptocurrency.
● Double-spending can happen, but it is more likely that a cryptocurrency is stolen from a
wallet that wasn't adequately protected and secured.
● Many variations of attacks could be used for double-spending—51% is one of the most
commonly cited attacks, while the unconfirmed transaction attack is most commonly
seen.
Understanding Double Spending
To understand double-spending, it helps to review how the blockchain works first. When a
block is created, it receives a hash—or encrypted number—that includes a timestamp,
information from the previous block, and transaction data. This information is encrypted using a
security protocol like the SHA-256 algorithm used by Bitcoin.
Once that block's information is verified by miners (in proof-of-work consensus), it is closed,
and a new one is created with the timestamp, transaction information, and previous block's hash.
A Bitcoin is awarded to the miner whose machine verified the hash.
For someone to double spend, a secret block has to be mined that outpaces the creation of the
real blockchain. They would then need to introduce that chain to the network before it caught
up—if this happened, then the network would recognize it as the latest set of blocks and add it
to the chain. The person that did this could then give themselves back any cryptocurrency they
had spent and use it again.
Preventing Double Spending
Double spending remains a risk; however, it is minimized by the blockchain. The likelihood of a
secret block being inserted into the blockchain is very slim because it has to be accepted and
verified by the network of miners.
The only chance a miner with illicit intentions has of inserting an altered block is to attempt to
get another user to accept a transaction using their secret block and cryptocurrency. Even then,
the likelihood that the modified block will be accepted is very slim.
The blockchain and consensus mechanism move so quickly that the modified block would be
outdated before it was accepted. Even if it was accepted, the network would still have passed up
the information in the block and would reject it.
There isn't actually any recorded instance of double-spending. The cryptocurrency community
believes that all double-spending has been thwarted. However, the attacks used for
double-spending are more often used for other purposes.
Cryptocurrency transactions take some time to verify because the process involves randomly
selecting numbers to solve the complex hash—this also takes up a great deal of computational
power. It is, therefore, exceedingly difficult to duplicate or falsify the blockchain because of the
immense amount of computing power needed to stay ahead of all of the other miners on the
network.
Double Spending Attacks
The most significant risk for blockchains comes in the form of a 51% attack, which can occur if
a miner controls more than 50% of the computing power that validates the transactions, creates
blocks, and awards cryptocurrency.
If this user—or users—controls a majority of the hashing in the blockchain, they will be able to
dictate transaction consensus and control the award of currency. In more popular
cryptocurrencies such as Bitcoin, this is very unlikely due to the number of miners and hashing
difficulty it has reached; however, new or forked cryptocurrencies with smaller networks are
susceptible to this attack.
Most commonly, the unconfirmed transaction attack is used to fool cryptocurrency users. If you
see one of these transactions, you shouldn't accept it because it can cause an attempted
double-spend attack.
Did Double-Spending Happen?
There have been occasions where double-spending attempts have been reported and stopped.
The attacks where it could happen generally lead to theft rather than double-spending.
Can You Copy a Bitcoin?
You cannot copy a Bitcoin because the blockchain and consensus mechanism would not accept
it.
What Are Examples of Double Spending Attacks?
Several variations of attacks could allow miners with bad intentions to double spend. Included
are the Finney attack, race attack, 51% attack, career attack, and unconfirmed transaction
attacks.
Investing in cryptocurrencies and other Initial Coin Offerings (“ICOs”) is highly risky and
speculative, and this article is not a recommendation by Investopedia or the writer to invest in
cryptocurrencies or other ICOs. Since each individual's situation is unique, a qualified
professional should always be consulted before making any financial decisions. Investopedia
makes no representations or warranties as to the accuracy or timeliness of the information
contained herein.
The Byzantine Generals' problem?
The Byzantine Generals' problem refers to the game theory problem. A group of generals
attacks a fortress; every general has an army and surrounds a fort from one side. Every general
has a preference about whether to attack or retreat. It has to be a coordinated attack or retreat to
incur minimum losses. Thus, a consensus is held, and the majority decision is implemented.
This consensus is formed after following the following steps:
1. Every general sends their own choice to all other generals.
2. After receiving the choice of all generals, every general calculates the votes in favor of
attacking and retreating.
3. If the majority is in favor of retreat, then they retreat; otherwise, they attack.
Suppose there is a traitor general who sends a retreat message to half generals and an attack
message to the other half generals. Then half of the generals may end up attacking while the
other half will retreat, causing the army to lose.
The following slides show all the scenarios of a successful attack, a successful retreat, and an
unsuccessful attack.
A successful attack
Application
● Blockchain: In blockchains, we've got a network of nodes (generals), and they have to
decide whether to add a block to their journal or not. All the nodes must make the same
decision (either to add the block or not) to maintain a constant state of the blockchain
across all the nodes. Otherwise, every node will have a different view of the blockchain,
making it hard to maintain the network.
● Distributed systems: In data centers, we have a lot of servers to handle user requests. All
these servers have their data; if a user request results in a change in data, then all the
servers need to update their data (to keep the data consistent across all the servers). If
some servers(generals) fail or send the wrong information at this point, this may bring
down the whole system.

Money and the Byzantine Generals Problem


Money is a prime example of the Byzantine Generals Problem. How should a society establish a
money that all members of a society can trust and agree upon? For much of history, societies have
selected precious metals or other rare goods, such as shells or glass beads, as money. In some ways,
gold solved the Byzantine Generals Problem: it was trusted and recognized across decentralized
systems, such as international trade. However, its weight and purity remained unreliable, and still
does to this day. The failure of gold to completely solve the Byzantine Generals Problem resulted in
trusted central parties, usually governments, taking over the establishment and issuance of money.
Governments monopolized mints in order to inspire trust in the weight and purity of the money.
Centralized systems obviously did not solve the Byzantine Generals Problem. Governments, the
trusted central authorities for money, constantly violated that trust by seizing, debasing, or changing
the money.
The root problem with conventional currency is all the trust that's required to make it work.
The central bank must be trusted not to debase the currency, but the history of fiat currencies
is full of breaches of that trust.

– Satoshi Nakamoto discussing the significance of Bitcoin’s decentralized nature.


In order for a money to solve the Byzantine Generals Problem, it would have to be verifiable,
counterfeit-resistant, and trustless. It was not until the invention of Bitcoin that this feat was
achieved.

How Bitcoin Solves the Byzantine Generals Problem


Bitcoin was the first realized solution to the Byzantine Generals Problem with respect to money.
Many proposals and projects preceding Bitcoin had attempted to create money separate from the
government, but all had failed in one way or another.

Proof-of-Work Solves the Byzantine Generals Problem


Bitcoin managed to solve the Byzantine Generals Problem by using a Proof-of-Work mechanism
in order to establish a clear, objective ruleset for the blockchain. In order to add information, called
blocks, to the blockchain, a member of the network must publish proof that they invested
considerable work into creating the block. This work imposes large costs on the creator, and thus
incentivizes them to publish honest information.
Because the rules are objective, there can be no disagreement or meddling with the information on
the Bitcoin network. The ruleset governing which transactions are valid and which are invalid is
also objective, as is the system for determining who can mint new bitcoin. Additionally, once a
block has been added to the blockchain, it is extremely difficult to remove, making Bitcoin’s
past immutable.
Thus, at all times, members of the Bitcoin network can agree on the state of the blockchain and all
transactions therein. Each node verifies for itself whether blocks are valid based on the
Proof-of-Work requirement and whether transactions are valid based on other requirements.
If any member of the network attempts to broadcast false information, all nodes on the network will
immediately recognize it as objectively invalid and ignore it. Because each node can verify all
information on the Bitcoin network itself, there is no need to trust other members of the network,
making Bitcoin a trustless system.

Public Key Cryptography in Blockchain

Public Key Cryptography or in short PKI is also known as asymmetric


cryptography. It uses two pairs of keys - public and private. A key is a some long
binary number. The public key is distributed worldwide and is truly public as its
name suggests. The private key is to be strictly held private and one should never
lose it.

In case of Bitcoin, if you ever lose the private key to your Bitcoin wallet, the entire
contents of your wallets would be instantly vulnerable to theft and before you know
it, all your money (the contents of your wallet) would be gone with no mechanism
in the system to trace out who stole it - that is the anonymity in the system that I
mentioned earlier.
The PKI accomplies two functions - authentication and the message privacy
through encryption/decryption mechanism

Authentication Function

When the two parties exchange messages, it is important to establish a trust


between the sender and the receiver. Especially, the receiver must trust the source of
message. Going to our earlier scenario (depicted in Figure 1) of Bob sending some
money to Lisa for purchasing of some goods from her, let us see how the PKI builds
this trust between Bob and Lisa. Look at below image −

In the first place, if Bob wants to send some money to Lisa, he has to create a
private/public key of its own. Note that both keys are always paired together and
you cannot mix the private and public keys of different individuals or different
instances.

Now, Bob says that he is sending $10 to Lisa. So he creates a message (a plain-text
message) containing Bob’s (sender) public key, Lisa’s (receiver) public key, and the
amount ($10).

The purpose of this remittance such as “I want to buy pumpkin from you” is also
added into the message. The entire message is now signed using Bob’s private key.
When Lisa receives this message, she will use the signature verification algorithm
of PKI and Bob’s public key to ensure that the message indeed originated from Bob.
How the PKI works is beyond the scope of this tutorial. The interested reader is
referred to this site for a more detailed discussion on PKI. This establishes the
authenticity of the message originator. Now, let us look at the message privacy.
Message Privacy function

Now, as Lisa has received her payment, she wants to send the link to her ebook
which Bob wants to buy. So Lisa would create a message and send it to Bob as
shown in image −

The Lisa creates a message such as “Here is the link to my ebook which you had
requested”, signs it with Bob’s public key that she has received in Bob’s request
message and also encrypts the message using some secret key which is shared
between the two during HTTPS handshake.

Now, Lisa is sure that only Bob can decode the message using the private key that is
held by Bob alone. Also, somebody intercepting the message would not be able to
recover its contents because the contents are encrypted by a secret key held only by
Bob and Alice. This guarantees to Lisa that access to her ebook is granted only to
Bob.

Having seen both the features, Authentication and Message Privacy, implied by
PKI, let us move ahead to see how Bitcoin makes use of PKI to secure the public
ledger that I mentioned in the chapter “What is Bitcoin?”.

Blockchain - Hashing

One of the most important function in PKI is the hashing function. A hash function
maps the data of any arbitrary size to data of fixed size. Bitcoin uses SHA-256 hash
function that produces a hash (output) of size 256 bits (32 bytes). This is illustrated
in image –
Bob, while placing an order with Lisa, creates a message similar to the one shown
above. This message is hashed through a hash function that produces a 32 byte
hash. The beauty of this hash is for all practical purposes the hash (the 256-bit
number) is considered unique for the contents of the message. If the message is
modified, the hash value will change. Not only that given a hash value, it is
impossible to reconstruct the original message.
After having seen the importance of hashing, let us move on another concept in
Bitcoin that is mining.
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 byproduct 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 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.
Anders Brownworth Hash
Program: https://anders.com/blockchain/hash.html
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:
1. 759831720aa978c890b11f62ae49d2417f600f26aaa51b3291a8d21a4216582a

Now if we change the text: "This is a great tutorial." To "this is a great tutorial."
You will find the corresponding Hash:
1. 4bc35380792eb7884df411ade1fa5fc3e82ab2da76f76dc83e1baecf48d60018
In the above, you can see that we have changed only the first character case
sentence from capital "T" to small "t" and it will change the whole Hash value.
Note: If we write the same text again in a data section, it will always give the same
output. It is because you are creating a message digest of that one's specific amount
of data.
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.
Blockchain Block Hashing
In this section, we are going to learn how SHA-256 applies to build a block within a
blockchain. We will discuss here in the context of the Bitcoin blockchain and
understand how this ties into the role of miners. The minors are actually in the
process of building blocks, and these blocks are added to a blockchain to build out
what the Bitcoin blockchain will be.
In the below image, you can see that this block is composed of a block number, data
field, cryptographic hash associated with it and a Nonce.

In the above image, the generated hash would look like 00001acbm010gfh1010xxx.
I'd like to point out that this hash has four leading zeros. The four leading zero's
describes whether the block is valid or not. For practical purposes, you will see that
this hash is corresponding to the nonce, and the block number is corresponding to
the available data. Since the hash has four leading zeroes, therefore, it is a valid
block.
If we make any change in the data section, it will give the completely different hash
that can be shown in the below image.

If the newly generating hash does not have four leading zeroes, then it will not a
valid block. To make the block valid, we will do it by using the field called nonce.
Nonce stands for a Number Used Once in a cryptographic communication such
that the block's hash meets a certain criterion. This criterion could be generated a
hash that must have its leading four digits to be zero. Thus, the generated hash
would look like 00001acbm010gfh1010xxx.
A nonce is basically a random number which figures out how you can actually
make this specific block provide you with a valid hash. The way you can do this is
by changing the nonce manually. Generally, the miner starts with a Nonce value of
1 and keeps on incrementing it until the generated hash meets the specified
criterion. Thus, it may take several iterations until the desired hash with four
leading zeros is generated. The expected time for generating a block in
the bitcoin system is 10 minutes. Once the miner successfully mines the block, he
releases that block in the system and making it the last block in the chain.
In Anders Brownworth Hash Program, when we click mine button as shown in the
image, it will give the valid block. This block has a unique nonce with hash leading
four zeroes in the beginning.

How Block Hashes Work in Blockchain


A blockchain is a concept of storing data digitally. This data comes in blocks. These
blocks are chained together and make the data immutable. When a block of data is
chained with the other blocks, its data can never be changed again. It will be
publicly available to anyone who wants to see it ever again and will be available in
the same sequence in which it was added to the blockchain. Nobody can change the
information once it is added in the blockchain.
In the previous section, we have learned how to build the block and the
cryptographic hashing ties into the whole process. Here you can see how blockchain
uses all these concepts together to preserve the integrity of a full blockchain.
Imagine a bunch of blocks of transaction data as of the following image.
In the above images, you can see that block assembles in chronological order.
Block number one is followed by block number two, then block number three, then
block number four, and you can continue it as long as you want. Here, you will find
that there is a block number field, data field, nonce field, hash value field,
and previous field. The previous field is corresponding to the hash value field of
the previous block.
We know that every block in a blockchain is cryptographically tied to the next
block. In the above example, the previous field in block one is zero because the
block one doesn't have a previous hash value, so its value is zero. In block number
two, you will find that there is a hash value in the previous field, which references
to the previous block hash value. This process is continuing until the last block.
Now imagine if the data in any block is altered. Let us say that we have altered in
block number 2, the data in block 2 is now different, and mining the block also gets
a new signature. The signature that corresponds with this new set of data is no
longer chained to other blocks. It just breaks block number 2 because the hash is no
longer valid and it also invalidates every single block that comes after it to the end
of the chain. It indicates to other users of this blockchain that some data in block 2
has been altered, and because the blockchain should be immutable, they reject this
change by shifting back to a previous record of the blockchain where all the blocks
are still chained together. This is the main advantage of the blockchain.
Now, if you try to fix it, the only way you can do it by figuring out a nonce which is
explained in the previous lesson. So we take simply one block and try that. If it
doesn't give a valid hash, try with two, three, four, and if none of them will work,
then simply mine it. When you mine a block, the system figures out that there is a
valid hash as it has got four leading zeroes. But as you notice that when you try to
hash block number two, this hash doesn't have four leading zeros. Therefore it's still
an invalid block. So you would have to mine this block as well. Also, you have to
do that with every single block all the way to the front of the chain to fix the
problem.
Understanding the importance of four leading zeroes in the hash
Now let's talk about how important it is to have four leading zeroes. These four
leading zeros are tied to something called difficulty level. The difficulty level is
something that's tied and built into the blockchain network which determines how
difficult it is for you to get the equivalent cryptographic hash for a block. In this
case, that difficulty level requires us to have a hash that is smaller than what we
have in the target.
For this specific purpose, we will need a target that has at least four leading
zeroes. For example, if the hash target is 0000a1b2c3d4e5f6, any hash less than or
equal to this number is a valid block hash. Many hashes would satisfy this
requirement, and anyone of those would be valid. However, it is a tough task to find
such a hash. Lesser the hash target, the more difficult it is to find a valid hash.
These difficulty levels keep increasing over time as new computers are added in
more cryptographic hashing to the bitcoin network. So, more hashing power means
the difficulty level needs to go up. This difficulty level is adjusted in every two
weeks to make sure that the computer which is actually competing to solve these
cryptographic problems take approximately a total of 10 minutes to mine a new
block.
Note: One block every 10 mins = 6 blocks per hour, 6 x 24 in a day, and 6 x 24 x 14
= 2016 blocks in two weeks.
For example: If we were to find a hash less than or equal to 0FFFF, we have
65,536 choices. However, if we were to find a hash less than or equal to 000FF, we
have only 256 choices. A lower target number means fewer choices. Usually, more
leading zeros we require in our hash, much harder it is to find a valid hash.
Distributed system
A distributed system, also known as distributed computing, is a system with
multiple components located on different machines that communicate and
coordinate actions in order to appear as a single coherent system to the end-user.
Overview
The machines that are a part of a distributed system may be computers, physical
servers, virtual machines, containers, or any other node that can connect to the
network, have local memory, and communicate by passing messages.
There are two general ways that distributed systems function:
1. Each machine works toward a common goal and the end-user views results as
one cohesive unit.
2. Each machine has its own end-user and the distributed system facilitates
sharing resources or communication services.
Although distributed systems can sometimes be obscure, they usually have three
primary characteristics: all components run concurrently, there is no global clock,
and all components fail independently of each other.
Benefits and challenges of distributed systems
There are three reasons that teams generally decide to implement distributed
systems:
● Horizontal Scalability
Since computing happens independently on each node, it is easy and generally
inexpensive to add additional nodes and functionality as necessary.
● Reliability
Most distributed systems are fault-tolerant as they can be made up of hundreds
of nodes that work together. The system generally doesn’t experience any
disruptions if a single machine fails.
● Performance
Distributed systems are extremely efficient because work loads can be broken
up and sent to multiple machines.
However, distributed systems are not without challenges. Complex architectural
design, construction, and debugging processes that are required to create an
effective distributed system can be overwhelming.
Three more challenges you may encounter include:
● Scheduling
A distributed system has to decide which jobs need to run, when they should
run, and where they should run. Schedulers ultimately have limitations,
leading to underutilized hardware and unpredictable runtimes.
● Latency
The more widely your system is distributed, the more latency you can
experience with communications. This often leads to teams making trade-offs
between availability, consistency, and latency.
● Observability
Gathering, processing, presenting, and monitoring hardware usage metrics for
large clusters is a significant challenge.
How a Distributed System Works
Hardware and software architectures are used to maintain a distributed system.
Everything must be interconnected—CPUs via the network and processes via the
communication system.
Types of distributed systems
Distributed systems generally fall into one of four different basic architecture
models:
1. Client-server
Clients contact the server for data, then format it and display it to the end-user.
The end-user can also make a change from the client-side and commit it back
to the server to make it permanent.
2. Three-tier
Information about the client is stored in a middle tier rather than on the client
to simplify application deployment. This architecture model is most common
for web applications.
3. n-tier
Generally used when an application or server needs to forward requests to
additional enterprise services on the network.
4. Peer-to-peer
There are no additional machines used to provide services or manage
resources. Responsibilities are uniformly distributed among machines in the
system, known as peers, which can serve as either client or server.
Example of a Distributed System
Distributed systems have endless use cases, a few being electronic banking systems,
massive multiplayer online games, and sensor networks.
Stack Path utilizes a particularly large distributed system to power its content
delivery network service. Every one of our points of presence (PoPs) has nodes that
form a worldwide distributed system. And to provide top notch content delivery,
StackPath stores the most recently and frequently requested content in edge
locations closest to the location it is being used.
Distributed systems at the edge
With Stack Path’s edge-compute services, virtual machines, and containers, users
can create their own distributed systems. By interconnecting VMs and containers,
while also leveraging the speed and agility that comes with edge computing, your
system can handle thousands of simultaneous requests at lightning-fast speed.
Consensus Mechanism and Distributed Consensus in Distributed Systems
What Is a Consensus Mechanism?
A consensus mechanism is a fault-tolerant mechanism that is used in computer
and blockchain systems to achieve the necessary agreement on a single data value
or a single state of the network among distributed processes or multi-agent systems,
such as with cryptocurrencies. It is useful in record-keeping, among other things.
On the Bitcoin blockchain, for instance, the consensus mechanism is known as
Proof-of-Work (PoW), which requires the exertion of computational power in order
to solve a difficult but arbitrary puzzle in order to keep all nodes in the network
honest.
KEY POINTS
● A consensus mechanism refers to any number of methodologies used to
achieve agreement, trust, and security across a decentralized computer
network.
● In the context of blockchains and cryptocurrencies, proof-of-work (PoW) and
proof-of-stake (PoS) are two of the most prevalent consensus mechanisms.
● Critics of Bitcoin miners have argued that PoW is overly energy-intensive,
which has sparked the creation of new and more efficient mechanisms.
Consensus Mechanism Explained
In any centralized system, like a database holding key information about driving
licenses in a country, a central administrator has the authority to maintain and
update the database. The task of making any updates—like
adding/deleting/updating names of people who qualified for certain licenses—is
performed by a central authority who remains the sole in-charge of maintaining
genuine records.
Public blockchains that operate as decentralized, self-regulating systems work on a
global scale without any single authority. They involve contributions from hundreds
of thousands of participants who work on verification and authentication of
transactions occurring on the blockchain, and on the block mining activities.
In such a dynamically changing status of the blockchain, these publicly shared
ledgers need an efficient, fair, real-time, functional, reliable, and secure mechanism
to ensure that all the transactions occurring on the network are genuine and all
participants agree on a consensus on the status of the ledger. This all-important task
is performed by the consensus mechanism, which is a set of rules that decides on
the legitimacy of contributions made by the various participants (i.e., nodes or
transactors) of the blockchain.
Blockchain Consensus Mechanisms
There are different kinds of consensus mechanism algorithms, each of which works
on different principles.
The proof of work (PoW) is a common consensus algorithm used by the most
popular cryptocurrency networks like bitcoin and litecoin. It requires a participant
node to prove that the work done and submitted by them qualifies them to receive
the right to add new transactions to the blockchain. However, this whole mining
mechanism of bitcoin needs high energy consumption and a longer processing time.
The proof of stake (PoS) is another common consensus algorithm that evolved as a
low-cost, low-energy consuming alternative to the PoW algorithm. It involves the
allocation of responsibility in maintaining the public ledger to a participant node in
proportion to the number of virtual currency tokens held by it. However, this comes
with the drawback that it incentivizes cryptocoin hoarding instead of spending.
While PoW and PoS are by far the most prevalent in the blockchain space, there are
other consensus algorithms like Proof of Capacity (PoC) which allow sharing of
memory space of the contributing nodes on the blockchain network. The more
memory or hard disk space a node has, the more rights it is granted for maintaining
the public ledger. Proof of Activity (PoA), used on the Decred blockchain, is a
hybrid that makes use of aspects of both PoW and PoS. Proof of Burn (PoB) is
another that requires transactors to send small amounts of cryptocurrency to
inaccessible wallet addresses, in effect "burning" them out of existence.
Another, called Proof of History (PoH), developed by the Solana Project and similar
to Proof of Elapsed Time (PoET), encodes the passage of time itself
cryptographically to achieve consensus without expending many resources.
A Digital Wallet for All Your Web3 Needs
From crypto to NFTs and beyond, accessing a wealth of DeFi platforms is simpler
than you might think. With OKX, a leading digital asset financial service provider,
you can access world-class security as you trade and store assets. You can also
connect existing wallets and win up to $10,000 when you complete a deposit of
more than $50 through a crypto purchase or top-up within 30 days of
registration. Learn more and sign up today.

Distributed Consensus in Distributed Systems


A procedure to reach a common agreement in a distributed or decentralized
multi-agent platform. It is important for the message passing system.
Example –
A number of processes in a network decide to elect a leader. Each process begins
with a bid for leadership. In traditional or conventional distributed systems, we
apply consensus to ensure reliability and fault tolerance. It means, in a decentralized
environment when you have multiple individual parties, and they can make their
own decision, then it may happen that some node or some parties are working
maliciously or working as a faulty individual. So in those particular cases, it is
important to come to a decision or common point of view. So having a common
point of view in an environment where people can behave maliciously or people can
crash the work in a faulty way, is the main difficulty. So under this kind of
distributed environment, our objective is to ensure reliability which means to ensure
correct operation in the presence of faulty individuals.
Features:
● It ensures reliability and fault tolerance in distributed systems.
● In the presence of faulty individuals, it is Ensure correct operations.
Examples –
Commit a transaction in a database, State machine replication, Clock
synchronization.
How to achieve distributed consensus :
There are some conditions that need to be followed in order to achieve distributed
consensus.
● Termination –
Every non-faulty process must eventually decide.
● Agreement –
The final decision of every non-faulty process must be identical.
● Validity –
Every non-faulty process must begin and ends with the same value.
● Integrity –
Every correct individual decides at most one value, and the decided value
must be proposed by some individual.
Here is one validation criterion, So basically we should reach a decision with a
value that must be the initial value of some process because it is silly to reach an
agreement when the agreed value reflects nobody’s initial choice.
The correctness of Distributed Consensus Protocol :
It can be described by the following two properties as follows.
● Safety Property –
It ensures that you will never converge to an incorrect value or correct
individuals in a network will never converge to an incorrect value.
● Liveness Property –
It states that every correct value must be accepted eventually which means
something good will eventually happen.
Application of Distributed Consensus :
● Leader election in a fault-tolerant environment for initiating some global
action without introducing a single point of failure.
● Maintaining consistency in a distributed network. Suppose you have different
nodes monitoring the same environment. If one of the nodes crashes, a
consensus protocol ensures robustness against such faults.

Types of Consensus Mechanisms


Proof of Work (PoW)
Used by Bitcoin, Ethereum, and many other public blockchains, proof of work
(PoW) was the very first consensus mechanism created. It is generally regarded to
be the most reliable and secure of all the consensus mechanisms, though concerns
over scalability are rife. While the term ‘proof of work’ was first coined in the early
1990s, it was Bitcoin founder Satoshi Nakamoto that first applied the technology in
the context of digital currencies.
In PoW, miners essentially compete against one another to solve extremely complex
computational puzzles using high-powered computers. The first to come up with the
64-digit hexadecimal number (‘hash’) earns the right to form the new block and
confirm the transactions. The successful miner is also rewarded ​with a
predetermined amount of crypto, known as a ‘block reward’.
As it requires large amounts of computational resources and energy in order to
generate new blocks, the operating costs behind PoW are notoriously high. This
acts as a barrier of entry for new miners, leading to concerns about centralisation
and scalability limitations.
And it’s not just the costs that are high. The most common criticism of PoW is the
impact the electrical consumption has on the environment. This has led many to
seek more sustainable, energy-efficient consensus protocols, such as proof of stake
(PoS).
Proof of Stake (PoS)
As the name suggests, this popular method of consensus revolves around a process
known as staking. In a proof of stake (PoS) system, miners are required to pledge a
‘stake’ of digital currency for a chance to be randomly chosen as a validator. The
process is not unlike a lottery whereby the more coins you stake, the better your
odds.
Unlike in PoW where miners are incentivised by block rewards (newly generated
coins), those who contribute to the PoS system simply earn a transaction fee.
PoS is seen as a more sustainable and environmentally-friendly alternative to PoW,
and one that’s more secure against 51% attack. However, as the system favours
entities with a higher number of tokens, PoS has drawn criticism for its potential to
lead to centralisation. Prominent PoS platforms include Cardano (ADA), Solana
(SOL), and Tezos (XTC).
Delegated Proof of Stake (DPoS)
A modification of the PoS consensus mechanism, delegated proof of stake (DPoS)
relies upon a reputation-based voting system to achieve consensus. Users of the
network ‘vote’ to select ‘witnesses’ (also known as ‘block producers’) to secure the
network on their behalf. Only the top tier of witnesses (those with the most votes)
earn the right to validate blockchain transactions.
To vote, users add their tokens to a staking pool. Votes are then weighted according
to the size of each voter’s stake – so the more skin in the game, the more voting
power. Elected witnesses who successfully verify transactions in a block receive a
reward, which is usually shared with those who voted for them.
Witnesses in the top tier are always at risk of being replaced by those deemed more
trustworthy and who therefore get more votes. They can even be voted out if they
fail to fulfil their responsibilities or try to validate fraudulent transactions. This
helps to incentivise witnesses to remain honest at all times, ensuring the integrity of
the blockchain.
Though less prevalent than PoS, DPoS is regarded by many as being more efficient,
democratic, and financially inclusive than its predecessor. It is used by Lisk (LSK),
EOS.IO (EOS), Steem (STEEM), BitShares (BTS), and Ark (ARK).
Proof of Activity (PoA)
Proof of activity (PoA) is a hybrid of the PoW and PoS consensus mechanisms. It
is used by the Decred (DCR) and Espers (ESP) blockchain projects.
In PoA systems, the mining process begins like PoW, with miners competing to
solve an elaborate mathematical problem using immense computing power. Once
the block is mined, however, the system switches to resemble PoS, with the
successfully generated block header being broadcast to the PoA network. A group
of validators are then randomly selected to sign off on the hash, validating the new
block. Like with PoS, the more crypto the validator holds, the higher their chances
of being selected. Once every chosen validator has signed the block, it is added to
the blockchain network and ready to record transactions. The block rewards are
then shared among the miner and validators.
Though the PoA system was designed with the intention of combining the very best
features of PoW and PoS, while avoiding their shortcomings, it has drawn criticism
for its energy-intensive mining phase and inherent partiality towards validators
holding a greater number of coins.
Proof of Authority (PoA)
Not to be confused with proof of activity (also ‘PoA’), proof of authority (PoA)
works by selecting its validators based on reputation. A modified version of PoS, it
was proposed by Ethereum co-founder and former CTO Gavin Wood in 2017.
In PoA, validators don’t stake coins. Instead, they must put their reputations on the
line for the right to validate blocks. This is very different from the majority of
blockchain protocols which usually do not require you to reveal your identity to
take part.
As this mechanism requires almost no computing power, it is far less
resource-intensive than some of its predecessors, in particular PoW. It is also one of
the less costly options, making it a heavily favoured solution for private networks,
such as JP Morgan (JPMCoin). Other PoA-based projects include VeChain (VET)
and Ethereum Kovan testnet.
Though highly scalable, where it compromises is in the decentralisation area, as
only a select few can participate in the network. Additionally, the requirement for
the validators to be identifiable also increases the risk of corruption and third-party
manipulation.
Proof of Burn (PoB)
Another more sustainable alternative to Bitcoin’s PoW algorithm is proof of burn
(PoB). In PoB, miners gain the power to mine a block by ‘burning’ (destroying) a
predetermined amount of tokens in a verifiable manner – namely, sending them to
an ‘eater address’ where they cannot be recovered or spent. The more coins burned,
the greater the chances of being randomly selected.
Unlike in PoS where miners are able to retrieve or sell their locked coins should
they ever leave the network, burned coins are irretrievably lost. This method of
requiring miners to sacrifice short-term wealth in order to gain the lifetime privilege
to create new blocks helps to encourage long-term commitment from miners. The
act of burning coins also leads to coin scarcity, limiting inflation and driving up
demand.
Cryptocurrencies that use the proof of burn protocol include Slimcoin (SLM),
Counterparty (XCP), and Factom (FCT).
Proof of Capacity / Proof of Space (PoC / PoSpace)
Unlike the majority of its predecessors which grant mining rights based on
computational power or coins staked, proof of capacity (PoC) – also known as
proof of space (PoSpace) – bases its mining algorithm on the amount of space
available in a miner’s hard drive.
In PoC, miners generate a list of all the possible hashes beforehand in a process
called ‘plotting’. These plots are then stored on a hard drive. The more storage
capacity a miner has, the more possible solutions. The more solutions, the higher
the chances of possessing the correct combination of hashes and winning the
reward.
As it doesn’t require expensive or specialised equipment, PoC opens up
opportunities for the average person to participate in the network. As such, it is a
less energy-intensive and more decentralised alternative to some of the more
prevalent consensus mechanisms covered in this guide. However, as of yet, not
many developers have chosen to adopt the system, and there are concerns about its
susceptibility to malware attacks. The mechanism is currently used by Signum
(SIGNA) – formerly Burstcoin (BURST), Storj (STORJ), and Chia (XCH).
Proof of Elapsed Time (PoET)
Usually used on permissioned blockchain networks (those that require participants
to identify themselves), proof of elapsed time (PoET) leverages trusted computing
to enforce random waiting times for block construction. It was developed by Intel in
early 2016 and is based on a special set of CPU instructions called Intel software
guard extensions (SGX).
A time-lottery-based consensus algorithm, PoET works by randomly assigning
different wait times to every node in the network. During the waiting period, each
of these nodes goes to ‘sleep’ for that specified duration. The first to wake up (that
is, the one with the shortest waiting time) is awarded the mining rights. This
randomisation guarantees that every participant is equally as likely to be the winner,
ensuring fairness within the network.
The PoET consensus mechanism is highly efficient, less resource-intensive, and
scalable. It has been implemented in Hyperledger’s Sawtooth.
Proof of History (PoH)
As the name suggests, proof of history (PoH) provides proof of historical events.
Developed by Solana, PoH allows for ‘timestamps’ to be built into the blockchain
itself, verifying the passage of time between transactions without having to rely on
other nodes.
This timestamping method is enabled by what’s known as a SHA-256,
sequential-hashing verifiable delay function (VDF). It works by taking the output of
a transaction and using it as input for the next hash, which enables everyone to
clearly see which event took place in a particular sequence. As the VDFs can only
be solved by a single CPU score, PoH severely reduces the processing weight of the
blockchain, making it faster and more energy-efficient than many of his
contemporaries.
As PoH is only employed by Solana, it has yet to be tested on a large scale.
Proof of Importance (PoI)
First introduced by NEM (XEM), proof of importance (PoI) selects its miners based
on certain criteria in a process called ‘harvesting’. Common factors include the
number and size of transactions in the last 30 days, amount of vested currency, and
network activity. It’s based on these factors that an importance score is attributed to
nodes. The higher the score, the higher the probability of being chosen to harvest a
block and receive the accompanying transaction fee.
Though similar to PoS, PoI’s use of additional metrics does away with the former’s
tendency to inherently reward the rich by taking into account participants’ overall
support of the network. As such, simply staking high in POI does not necessarily
guarantee a chance of winning the block.
In Conclusion
There’s no one-size-fits all approach when it comes to verifying the authenticity of
distributed blockchain platforms. Each consensus mechanism comes with its own
set of advantages and trade-offs. While PoW and PoS are certainly the most
prevalent, a variety of new and evolving algorithms are continuing to emerge. For a
more in-depth discussion on the underlying principles of consensus, read this: How
to Agree: Different Types of Consensus for Blockchain
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, 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.
Blockchain Bitcoin Cash

Bitcoin Cash is peer-to-peer electronic cash for the Internet. It is fully


decentralized, with no central bank, and do not require any trusted third parties to
operate.
Bitcoin Cash is a cryptocurrency developed from a hard fork of the bitcoin
network. It came in existence from the mid of 2017. Bitcoin Cash is different from
Bitcoin. It is the upgraded version of the bitcoin core software. It
is faster, cheaper and more reliable to use. It increases the block size of bitcoin
from 1 MB to 8 MB and allowing for around two million transactions to be
processed per day.
How Bitcoin Cash came in existence?
The Bitcoin blockchain is a constantly updated ledger, and all transactions that take
place on the bitcoin network are listed there. In the bitcoin network, the first
transaction block took place on January 2009, and each new blocks are added to
this Bitcoin blockchain approximately every 10 minutes. The bitcoin protocol
ensures that every single block which gets added to the blockchain is valid and
conforms to the rules of bitcoin. Furthermore, each block that is added in the
blockchain contains a cryptographic hash of the previous block.
On August 1st, 2017, at block number 478,558, there was a split. The ViaBTC pool
produced a 1.9 MB block which is not valid on the legacy Bitcoin network because
bitcoin has a 1 MB limit. This new block did not have the 1 MB limit, and instead,
it included 1.9 MB. It causes a split which resulted in the creation of Bitcoin Cash.
The computers that are mining Bitcoin Cash have a protocol that limits the block
size at 8 MB rather than 1 MB.

What is a Bitcoin Hard Fork?


A fork takes place when a blockchain splits into two different paths forward. In the
case of bitcoin hard fork, to make transaction speeds faster on the network, one
group(miners) within the bitcoin community wanted to increase the size of blocks
on the bitcoin blockchain. As a result, the bitcoin blockchain may split into two
different versions, resulting in two different chains with a separate coin in each one
which gives birth of Bitcoin Cash.
As you can see in this diagram, there is a split that takes place on the network and
essentially creates a new Blockchain with altered rules. The original and the forked
version of the cryptocurrency had identical blockchains up to the block when the
split occurred. After the split happened, everyone who held bitcoins before the hard
fork, received the same amount of Bitcoin Cash tokens.

What differs Bitcoin Cash from other Cryptocurrencies?


1. Bitcoin Cash is based on the Bitcoin original source code with the difference
of bigger blocks (8MB) size.
2. In contrast to Bitcoin, bitcoin cash does not focus on becoming a store of
value. Instead, its main aims are to be used for digital payments only.

You might also like