Unit 1 BCT Prof. Nilima S. Dandge
Unit 1 BCT Prof. Nilima S. Dandge
Unit 1 BCT Prof. Nilima S. Dandge
Introduction to Blockchain
A Blockchain is “an open, distributed ledger that can record transactions between two parties
efficiently and in a verifiable and permanent way”
The keywords: open (accessible to all), Distributed or Decentralized (no single party control),
efficient (fast and scalable), verifiable (everyone can check the validity of information),
permanent (the information is persistent).
Advantages of Blockchain
1. 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.
2. 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.
3. Reliability: Blockchain certifies and verifies the identities of each interested parties.
This removes double records, reducing rates and accelerates transactions.
4. 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.
5. Decentralized: It is because there is no central authority supervising anything. There
are standards rules on how every node exchanges the blockchain information. Every
node is independent in functioning.
6. Transparency: The digital distributed ledger system provides a great deal of
transparency to all those who are a part of the network. Each node in a network has its
own copy of the ledger and has the right to verify transactions. Due to this, no one can
hide their details and transactions from the other users ensuring fair trade.
2. Structure of Blockchain
Blockchain can be defined as the Chain of Blocks that contain some specific Information.
Thus, a Blockchain is a ledger i.e file that constantly grows and keeps the record of all
transactions permanently. This process takes place in a secure, chronological (Chronological
means every transaction happens after the previous one) and immutable way. Each time when a
block is completed in storing information, a new block is generated.
Contents of Header
1. Previous Hash:
As Blockchain is a collection of several interconnected nodes also called a block, so previous
hash stores the hashed value of the previous node’s address, First block in the blockchain is
called the Genesis Block and has no previous block hash value.
2. Timestamp:
Timestamp in the blockchain is used as proof that the particular block is used at what instance
of a time, also this timestamp is used as a parameter to verify the authenticity of any block.
Nonce is used by authentication protocols to ensure that old communications cannot be
reprocessed.
3. Nonce:
It is abbreviated as ‘number only used once’ which is a number added to a hashed—or
encrypted—block in a blockchain. nonces are used as the number that is used in a hash to
verify the transactions and other data contained in a block.
4. Merkle Root:
A Merkle root uses mathematical formulas to check if the data is not corrupted, hacked, or
manipulated. A Merkle tree is a data structure that is used in computer science applications. In
bitcoin and other cryptocurrencies, Merkle trees serve to encode blockchain data more
efficiently and securely.
It is a mathematical data structure composed of hashes of different blocks of data, and which
serves as a summary of all the transactions in a block. It also allows for efficient and secure
verification of content in a large body of data. It also helps to verify the consistency and
content of the data. Merkle Tree is also known as Hash Tree. The concept of Merkle Tree is
named after Ralph Merkle, who patented the idea in 1979. Fundamentally, it is a data structure
tree in which every leaf node labelled with the hash of a data block, and the non-leaf
node labelled with the cryptographic hash of the labels of its child nodes. The leaf nodes are
the lowest node in the tree.
Fig: Merkle Tree
The above example is the most common and simple form of a Merkle tree, i.e., Binary Merkle
Tree. There are four transactions in a block: TX1, TX2, TX3, and TX4. Here you can see, there
is a top hash which is the hash of the entire tree, known as the Root Hash, or the Merkle Root.
Each of these is repeatedly hashed, and stored in each leaf node, resulting in Hash 0, 1, 2, and
3. Consecutive pairs of leaf nodes are then summarized in a parent node by
hashing Hash0 and Hash1, resulting in Hash01, and separately hashing Hash2 and Hash3,
resulting in Hash23. The two hashes (Hash01 and Hash23) are then hashed again to produce
the Root Hash or the Merkle Root.
4. History of Blockchain
Cryptographer David Chaum first proposed a blockchain-like protocol in his 1982 dissertation
"Computer Systems Established, Maintained, and Trusted by Mutually Suspicious Groups."
Further work on a cryptographically secured chain of blocks was described in 1991 by Stuart
Haber and W. Scott Stornetta. They wanted to implement a system wherein document
timestamps could not be tampered with. In 1992, Haber, Stornetta, and Dave
Bayer incorporated Merkle trees into the design, which improved its efficiency by allowing
several document certificates to be collected into one block. Under their company Surety, their
document certificate hashes have been published in The New York Times every week since 1995.
The first decentralized blockchain was conceptualized by a person (or group of people) known
as Satoshi Nakamoto in 2008. Nakamoto improved the design in an important way using
a Hashcash-like method to timestamp blocks without requiring them to be signed by a trusted
party and introducing a difficulty parameter to stabilize the rate at which blocks are added to the
chain. The design was implemented the following year by Nakamoto as a core component of the
cryptocurrency bitcoin, where it serves as the public ledger for all transactions on the network. [3]
In August 2014, the bitcoin blockchain file size, containing records of all transactions that have
occurred on the network, reached 20 GB (gigabytes). In January 2015, the size had grown to
almost 30 GB, and from January 2016 to January 2017, the bitcoin blockchain grew from 50 GB
to 100 GB in size. The ledger size had exceeded 200 GB by early 2020.
The words block and chain were used separately in Satoshi Nakamoto's original paper, but were
eventually popularized as a single word, blockchain, by 2016
5. Centralized vs Decentralized vs Distributed
A centralized system has a centralized control with all administrative authority. Such systems
are easy to design, maintain, impose trust, and govern, but suffer from many inherent limitations,
as follows:
• They do not have a central point of failure, so more stable and fault tolerant
• Attack resistant, as no central point to easily attack and hence more secured
• Symmetric system with equal authority to all, so less scope of unethical operations and
usually democratic in nature
Security issue
Privacy issue—data sale privacy is being undermined
Some of the advantages of decentralized systems over centralized systems could be:
Elimination of intermediaries
6. Blockchain Vs Database
SN Blockchain Database
6. Blockchain has only Insert operation. The database has Create, Read, Update,
and Delete operation.
7. It is a fully robust technology. It is not entirely robust technology.
9. Anyone with the right proof of work Only entities entitled to read or write can
can write on the blockchain. do so.
10. Blockchain is not recursive. Here, we The database is recursive. Here, we can
cannot go back to repeat a task on any go back to repeat a task on a particular
record. record.
7. Layers of Blockchain
Following describes the layers of blockchain to understand the technology better and build a
comparative analogy between hundreds of blockchain/Cryptocurrency variants out there in
the market.
Application Layer
Because of the characteristics of blockchain, such as immutability of data, transparency
among participants, resilience against adversarial attacks etc., there are multiple applications
being built. Certain applications are just built in the application layer, taking for granted any
available “flavor” of blockchain, and some applications are built in the application layer and
are interwoven with other layers in blockchain. This is the reason the application layer
should be considered a part of blockchain. This is the layer where you code up the desired
functionalities and make an application out of it for the end users. It usually involves a
traditional tech stack for software development such as client-side programming constructs,
scripting, APIs, development frameworks, etc. For the applications that treat blockchain as a
backend, those applications might need to be hosted on some web servers and that might
require web application development, server-side programming, and APIs, etc. Ideally, good
blockchain applications do not have a client–server model, and there are no centralized
servers that the clients access, which is just the way Bitcoin works.
Execution Layer
The Execution Layer is where the executions of instructions ordered by the Application
Layer take place on all the nodes in a blockchain network. The instructions could be simple
instructions or a set of multiple instructions in the form of a smart contract. In either case, a
program or a script needs to be executed to ensure the correct execution of the transaction.
All the nodes in a blockchain network have to execute the programs/scripts independently.
Deterministic execution of programs/scripts on the same set of inputs and conditions always
produces the same output on all the nodes, which helps avoid inconsistencies.
Semantic Layer
The Semantic Layer is a logical layer because there is an orderliness in the transactions and
blocks. A transaction, whether valid or invalid, has a set of instructions that gets through the
Execution Layer but gets validated in the Semantic Layer. If it is Bitcoin, then whether one
is spending a legitimate transaction, whether it is a double-spend attack, whether one is
authorized to make this transaction, etc., are validated in this layer. You will learn in the
following chapters that Bitcoins are actually present as transactions that represent the system
state. To be able to spend a Bitcoin, you have to consume one or more previous transactions
and there is no notion of Accounts. This means that when someone makes a transaction,
they use one of the previous transactions where they had received at least the amount they
are spending now. This transaction must be validated by all the nodes by traversing previous
transactions to see if it is a legitimate transaction. Ethereum, on the other hand, has the
system of Accounts. This means that the account of the one making the transaction and that
of the one receiving it both get updated. In this layer, the rules of the system can be defined,
such as data models and structures.
Propagation Layer
The previous layers were more of an individual phenomenon: not much coordination with
other nodes in the system. The Propagation Layer is the peer-to-peer communication layer
that allows the nodes to discover each other, and talk and sync with each other with respect
to the current state of the network. When a transaction is made, we know that it gets
broadcast to the entire network. Similarly, when a node wants to propose a valid block, it
gets immediately propagated to the entire network so that other nodes could build on it,
considering it as the latest block. So, transaction/block propagation in the network is defined
in this layer, which ensures stability of the whole network. By design, most of the
blockchains are designed such that they forward a transaction/block immediately to all the
nodes they are directly connected to, when they get to know of a new transaction/block. In
the asynchronous Internet network, there are often latency issues for transaction or block
propagation. Some propagations occur within seconds and some take more time, depending
on the capacity of the nodes, network bandwidth, and a few more factors.
Consensus Layer
The Consensus Layer is usually the base layer for most of the blockchain systems. The
primary purpose of this layer is to get all the nodes to agree on one consistent state of the
ledger. There could be different ways of achieving consensus among the nodes, depending
on the use case. Safety and security of the blockchain is ascertained in this layer. In Bitcoin
or Ethereum, the consensus is achieved through proper incentive techniques called
“mining.” For a public blockchain to be self-sustainable, there has to be some sort of
incentivization mechanisms that not only helps in keeping the network alive, but also
enforces consensus. Bitcoin and Ethereum use a Proof of Work (PoW) consensus
mechanism to randomly select a node that can propose a block. There are many different
variants of consensus protocols such as Proof of Stake (PoS), delegated PoS (dPoS),
Practical Byzantine Fault Tolerance (PBFT), etc.,
8. Working of Blockchain
Any type of property or asset, whether physical or digital, such as laptops, mobile
phones, diamonds, automobiles, real estate, e-registrations, digital files, etc. can be
registered on blockchain. This can enable these asset transactions from one person to
another, maintain the transaction log, and check validity or ownerships. Also, notary
services, proof of existence, tailored insurance schemes, and many more such use
cases can be developed.
There are many financial use cases being developed on blockchain such as cross-
border payments, share trading, loyalty and rewards system, Know Your Customer
(KYC) among banks, etc. Initial Coin Offering (ICO) is one of the most trending use
cases as of this writing. ICO is the best way of crowdsourcing today by using
cryptocurrency as digital assets. A coin in an ICO can be thought of as a digital stock
in an enterprise, which is very easy to buy and trade.
Blockchain can be used to enable “The Wisdom of Crowds” to take the lead and
shape businesses, economies, and various other national phenomena by using
collective wisdom! Financial and economic forecasts based on the wisdom of
crowds, decentralized prediction markets, decentralized voting, as well as stocks
trading can be possible on blockchain.
The process of determining music royalties has always been convoluted. The
Internet-enabled music streaming services facilitated higher market penetration, but
made the royalty determination more complex. This concern can pretty much be
addressed by blockchain by maintaining a public ledger of music rights ownership
information as well as authorized distribution of media content.
This is the IoT era, with billions of IoT devices everywhere and many more to join
the pool. A whole bunch of different makes, models, and communication protocols
makes it difficult to have a centralized system to control the devices and provide a
common data exchange platform. This is also an area where blockchain can be used
to build a decentralized peer-to-peer system for the IoT devices to communicate with
each other. ADEPT (Autonomous Decentralized Peer-To-Peer Telemetry) is a joint
initiative from IBM and Samsung that has developed a platform that uses elements
of the Bitcoin’s underlying design to build a distributed network of devices—a
decentralized IOT. ADEPT uses three protocols: BitTorrent for file sharing,
Ethereum for smart contracts, and TeleHash for peer-to-peer messaging in the
platform. The IOTA foundation is another such initiative.
In the government sectors as well, blockchain has gained momentum. There are use
cases where technical decentralization is necessary, but politically should be
governed by governments: land registration, vehicle registration and management, e-
Voting, etc. are some of the active use cases. Supply chains are another area where
there are some great use cases of blockchain. Supply chains have always been prone
to disputes across the globe, as it was always difficult to maintain transparency in
these systems.
There are primarily two types of blockchains; Private and Public blockchain. However, there
is a third type of blockchain too, known as Consortium blockchain. Every blockchain consists of
a cluster of nodes functioning as a peer-to-peer (P2P) network system. Every node in a network
has a copy of the ledger which gets updated timely. Each node on all types of blockchain can
verify transactions, initiate or receive transactions and create blocks.
Public Blockchain: A public blockchain is a non-restrictive, permission-less
distributed ledger system. Anyone who has access to the internet can sign in on a
blockchain platform to become an authorized node and be a part of the blockchain
network. A node or user which is a part of the public blockchain is authorized to
access current and past records, verify transactions or do proof-of-work for an
incoming block (thus, do mining). We use public blockchains for mining and
exchanging cryptocurrencies thus, the most common public blockchains are Bitcoin
and Litecoin blockchains. Public blockchains are mostly secure if we follow
security rules and methods strictly. Although, it is only risky when the participants
don’t follow the security protocols sincerely.
Private Blockchain: A private blockchain is a restrictive or permissioned
blockchain operative only in a closed network. Private blockchains are usually used
within an organization or enterprise where only selected members are participants of
the blockchain network. The level of security, authorizations, permissions,
accessibility is in the hands of the organization. So, we use private blockchains for
similar purposes as a public blockchain but have a small and restrictive
network. Examples of private blockchains are; Multichain and Hyperledger
projects (Fabric, Sawtooth).
Consortium Blockchain: A consortium blockchain is a semi-decentralized type
where more than one organization manages the blockchain. Contrary to what we saw
in a private blockchain which a single organization control. Thus, in a consortium
blockchain, more than one organization or authority manages the blockchain. More
than one organization can act as a node in this type of blockchain and exchange
information or do mining. Examples of consortium blockchain are Energy Web
Foundation, R3, etc.