Unit 1 BCT Prof. Nilima S. Dandge

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Unit-1 (Blockchain Fundamentals)

1. Introduction to Blockchain and its advantages

Introduction to Blockchain

Blockchain is the backbone Technology of Digital Cryptocurrency Bitcoin. The blockchain is a


distributed database of records of all transactions or digital event that have been executed and
shared among participating parties. Each transaction verified by the majority of participants of
the system. It contains every single record of each transaction. Bitcoin is the most popular
cryptocurrency an example of the blockchain. Blockchain Technology first came to light when
a person or Group of individuals name ‘Satoshi Nakamoto’ published a white paper on
“Bitcoin: A peer to peer electronic cash system” in 2008. Blockchain Technology Records
Transaction in Digital Ledger which is distributed over the Network thus making it
incorruptible. Anything of value like Land Assets, Cars, etc. can be recorded on Blockchain as
a Transaction.

Formal Definition of 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

Fig: 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.

Fig: Blockchain Data Structure


A block is composed of a header and a body, where a header contains the hash of previous
block, a timestamp, Nonce and the Merkle root. Transaction’s data which is stored in the block
body. We denote a transaction as TX and take the 3-th block, which only contains four
transactions, as an example to illustrate the structure of a Merkle tree

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.

3. Blockchain Merkle Tree

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 have a central point of failure, so are less stable.

• They are more vulnerable to attack and hence less secured.


• Centralization of power can lead to unethical operations.

• Scalability is difficult most of the time.


A decentralized system does not have a centralized control and every node has equal authority.
Such systems are difficult to design, maintain, govern, or impose trust. However, they do not
suffer from the limitations of conventional centralized systems. Decentralized systems offer the
following advantages:

• 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

A distributed system can also be decentralized. An example would be blockchain!


However, unlike common distributed systems, the task is not subdivided and delegated to
nodes, as there is no master who would do that in blockchain. The contributing nodes do not
work on a portion of the work, rather, the interested nodes (or the ones chosen at random)
perform the entire work.to all, so less scope of unethical operations and usually democratic in
nature

Limitations Of Centralized Systems


Trust issues

Security issue
Privacy issue—data sale privacy is being undermined

Cost and time factor for transactions

Some of the advantages of decentralized systems over centralized systems could be:
Elimination of intermediaries

Easier and genuine verification of transactions


Increased security with lower cost Greater transparency Decentralized and immutable

6. Blockchain Vs Database

SN Blockchain Database

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


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

2. Blockchain is permissionless because The database required permission


anyone can access it. because 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 digital records. ownership of records.

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

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.

8. Disintermediation is allowed with Disintermediation is not allowed with


blockchain. the database.

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.

Fig: Layers of Blockchain

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

Blockchain is a system of network of multiple nodes or computers which acts as a distributed


network over the internet, worldwide. Each node has the authority to make a transaction, verify a
transaction, receive a transaction and create a block. The blockchain is a cryptographically
linked chain of blocks (set of records) such that no one can falsify or modify the data stored in it.
Once we enter a set of transactions in a blockchain then it becomes a part of it forever.
Fig: Working of Blockchain
Step 1: Suppose, two nodes in a blockchain network say node A and node B wants to make a
new transaction.
Step 2: This transaction can only take place if all the other participant nodes in the network
verify it as a legitimate transaction. Thus, each node will receive the request to verify the
transaction to happen between A and B.
Step 3: Each node will check certain points about the transaction such as the authenticity of the
two nodes, is the transaction amount within limits, does A have sufficient funds to make this
transaction, etc.
Step 4: Once all the nodes check and verify all the aforementioned points, the transaction is
ready to take place. Then that transaction gets added into a memory pool or mem pool.
Step 5: Several such verified transactions get aggregated into mem pools and multiple mem
pools combine together to make a block. Every block has a defined memory limit to store
transactions.
Step 6: Every new block will have a block header, that consists of transaction data summary,
timestamp, hash code of the previous block and its own hash. Every block has its unique hash
code which acts like its fingerprint.
Step 7: In order to add a new block into the existing blockchain, nodes in the network need to do
proof-of-work. As we know, each block has its unique hash function which is an identification
code created using SHA256. Doing proof-of-work is decrypting this code and finding the correct
answer to this hash puzzle. To do proof-of-work, we need specialized computers that take on an
average of 10 minutes to crack the code automatically
Step 8: A block gets verified every time a node completes its proof-of-work and finds the correct
answer to the hash puzzle for that block. More and more nodes must verify or complete the
proof-of-work for the same block so that it finally gets added into the blockchain. Every block
has a unique set of transaction records. To create a new block and add it to the blockchain, one
must have a completely unique set of transactions in that.
Step 9: With this, a new block gets added and a transaction is completed between points A and
B.

9. Blockchain Uses and Use Cases


some of the initiatives that are already being taken across industries such as finance,
insurance, banking, healthcare, government, supply chains, IoT (Internet of Things), and
media and entertainment. A true sharing economy, which was difficult to achieve in
centralized systems, is possible using blockchain technology (e.g., peer-to-peer versions of
Uber, AirBNB). It is also possible to enable citizens to own their identity (Self-Sovereign
Digital Identity) and monetize their own data using this technology.

some of the existing use cases

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

10. Types of Blockchain

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.

You might also like