You are on page 1of 48

Blockchain

• A blockchain consists of a set of blocks, each block containing

the data, hash, and hash of the previous block.

• Distributed Decentralized Network.

• Immutable.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
INTRODUCTION
• Blockchain is a system of recording information in a way that makes it difficult or impossible to change,
hack, or cheat the system.

• A blockchain is essentially a digital ledger of transactions that is duplicated and distributed across the entire
network of computer systems on the blockchain.

• Each block in the chain contains a number of transactions, and every time a new transaction occurs on the
blockchain, a record of that transaction is added to every participant’s ledger. The decentralized database
managed by multiple participants is known as Distributed Ledger Technology (DLT).

• Blockchain is a type of DLT in which transactions are recorded with an immutable cryptographic signature
called a hash.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
INTRODUCTION(Cont…)
• This means if one block in one chain was changed, it would be immediately apparent it had been tampered with. If
hackers wanted to corrupt a blockchain system, they would have to change every block in the chain, across all of the
distributed versions of the chain.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
The Properties of Distributed Ledger Technology

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Distributed Ledger

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Peer-to-Peer Network

A network is a group of interconnected devices that exchange information,


these devices can be connected locally by a cable or wirelessly through the
internet.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Peer-to-Peer Network

The first keyword in the technical definition is peer-to-


peer. This means that there is no central controller in
the network, and all participants talk to each other
directly.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Introduction to Blockchain Network

• Blockchain at its core is a peer-to-peer distributed ledger that is


cryptographically secure, append-only, immutable (extremely hard to
change), and updateable only via consensus or agreement among
peers.
• Blockchain can be thought of as a layer of a distributed peer-to-peer
network running on top of the Internet, as can be seen below in the
diagram. It is analogous to SMTP, HTTP, or FTP running on top of
TCP/IP. This is shown in the following diagram:

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Fig:- The network view of a
blockchain

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
• A block is simply a selection of transactions bundled together in order
to organize them logically. It is made up of transactions and its size is
variable depending on the type and design of the blockchain in use. A
reference to a previous block is also included in the block unless it's a
genesis block. A genesis block is the first block in the blockchain that
was hardcoded at the time the blockchain was started. The structure
of a block is also dependent on the type and design of a blockchain,
but generally there are a few attributes that are essential to the
functionality of a block, such as the block header, pointers to previous
blocks, the time stamp, nonce, transaction counter, transactions, and
other attributes.
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
The structure of a block
Blockchain is a data structure; it is basically a linked list that
uses hash pointers instead of normal pointers. Hash pointers
are used to point to the previous block.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Generic elements of a blockchain

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Generic elements of a blockchain
1)Addresses
Addresses are unique identifiers that are used in a transaction on the blockchain to denote senders
and recipients.
An address is usually a public key or derived from a public key. While addresses can be reused by
the same user, addresses themselves are unique.
2) Transaction
A transaction is the fundamental unit of a blockchain. A transaction represents a transfer of value
from one address to another.
3) Block
A block is composed of multiple transactions and some other elements such as the previous block
hash (hash pointer), timestamp, and nonce.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
4) Peer-to-peer network

As the name implies, this is a network topology whereby all peers can communicate with each other and send and
receive messages.

5) Scripting or programming language

This element performs various operations on a transaction. Transaction scripts are predefined sets of commands for
nodes to transfer tokens from one address to another and perform various other functions. Turing complete
programming language is a desirable feature of blockchains.

6) Virtual machine

This is an extension of a transaction script. A virtual machine allows Turing complete code to be run on
a blockchain (as smart contracts) whereas a transaction script can be limited in its operation.

Virtual machines are not available on all blockchains; however, various blockchains use virtual machines
to run programs, for example Ethereum Virtual Machine (EVM) and Chain Virtual Machine (CVM).
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
7) State machine
A blockchain can be viewed as a state transition mechanism where by a state is modified from its
initial form to the next and eventually to a final form as a result of a transaction execution and
validation process by nodes.

8) Nodes
A node in a blockchain network performs various functions depending on the role it takes. A node
can propose and validate transactions and perform mining to facilitate consensus and secure the
blockchain.

9) Smart contracts
These programs run on top of the blockchain and encapsulate the business logic to be executed
when certain conditions are met.
The smart contract feature is not available in all blockchains but is now becoming a very desirable
feature due to the flexibility and power it provides to the blockchain applications.
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Benefits and limitations of blockchain
❖ Decentralization

✓ This is a core concept and benefit of blockchain. There is no need for a trusted third party or intermediary to
validate transactions;

✓ instead a consensus mechanism is used to agree on the validity of transactions.

❖ Transparency and trust

✓ As blockchains are shared and everyone can see what is on the blockchain, this allows the system to be
transparent and as a result trust is established.

❖ Immutability

✓ Once the data has been written to the blockchain, it is extremely difficult to change it back.

✓ It is not truly immutable but, due to the fact that changing data is extremely difficult and almost impossible, this
is seen as a benefit to maintaining an immutable ledger of transactions.
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
❖ High availability

✓ As the system is based on thousands of nodes in a peer-to-peer network, and the data is replicated and
updated on each and every node, the system becomes highly available.

✓ Even if nodes leave the network or become inaccessible, the network as a whole continues to work, thus
making it highly available.

❖ Highly secure

✓ All transactions on a blockchain are cryptographically secured and provide integrity.

❖ Simplification of current paradigms

✓ The current model in many industries such as finance or health is rather disorganized, wherein multiple
entities maintain their own databases and data sharing can become very difficult due to the disparate nature of
the systems.

✓ But as a blockchain can serve as a single shared ledger among interested parties, this can result in simplifying
this model by reducing the complexity of managing the separate systems maintained by each entity.
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
❖Faster dealings

✓ In the financial industry, especially in post-trade settlement functions, blockchain can play a vital
role by allowing the quicker settlement of trades as it does not require a lengthy process of
verification, reconciliation, and clearance because a single version of agreed upon data is already
available on a shared ledger between financial organizations.

❖Cost saving

✓ As no third party or clearing houses are required in the blockchain model, this can massively
eliminate overhead costs in the form of fees that are paid to clearing houses or trusted third parties.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Challenges and limitations of blockchain technology

• As with any technology there are challenges that need to be addressed in order to make a system
more robust, useful, and accessible.

• Blockchain technology is no exception; in fact a lot of effort is being made in Academia and
Industry to overcome the challenges posed by blockchain technology.

A selection of the most sensitive challenges are presented as follows:


1. Scalability
2. Adaptability
3. Regulation
4. Relatively immature technology
5. Privacy
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Distributed ledger
• A ledger is spread across the network among all peers in the network, and each peer holds a copy
of the complete ledger.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
How blockchain accumulates blocks

• The goal of blockchain is to allow digital information to be recorded and distributed, but not edited.

• A blockchain is the foundation for immutable ledgers, or records of transactions that cannot be altered,
deleted, or destroyed. This is why blockchains are also known as a distributed ledger technology (DLT).

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Types of Blockchain

• Permissionless vs. Permissioned Blockchains:-

All types of blockchains can be characterized as permissionless, permissioned, or both.

✓ Permissioned Blockchain – A blockchain that requires permission from a central authority to join.

✓ Permissionless Blockchain – A blockchain that does not require permission to join.

✓ Private (or Managed) Blockchain – Permissioned blockchains controlled by owners.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Types of Blockchains
There are four types of blockchain structures:
1. Public Blockchains
✓ Public blockchains are permissionless in nature, allow anyone to join, and are completely decentralized.
✓ Public blockchains allow all nodes of the blockchain to have equal rights to access the blockchain, create new blocks of data,
and validate blocks of data.
Example:- Bitcoin, Ethereum, and Litecoin.
2. Private Blockchain
✓ Private blockchains, which may also be referred to as managed blockchains, are permissioned blockchains controlled by a
single organization. In a private blockchain, the central authority determines who can be a node. The central authority also
does not necessarily grant each node with equal rights to perform functions.
✓ Private blockchains are only partially decentralized because public access to these blockchains is restricted.
Examples:- of private blockchains are the business-to-business virtual currency exchange network Ripple and Hyperledger,
an umbrella project of open-source blockchain applications.
✓ Both private and public blockchains have drawbacks - public blockchains tend to have longer validation times for new data
than private blockchains, and private blockchains are more vulnerable to fraud and bad actors.
✓ To address these drawbacks, consortium and hybrid blockchains were developed.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
3. Consortium Blockchains

✓ Consortium blockchains are permissioned blockchains governed by a group of organizations, rather than one
entity, as in the case of the private blockchain.

✓ Consortium blockchains, therefore, enjoy more decentralization than private blockchains, resulting in higher
levels of security.

4. Hybrid blockchains

✓ Hybrid blockchains are blockchains that are controlled by a single organization, but with a level of oversight
performed by the public blockchain, which is required to perform certain transaction validations.

✓ An example of a hybrid blockchain is IBM Food Trust, which was developed to improve efficiency
throughout the whole food supply chain.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Consensus
• Meaning :- A general agreement about something : an idea or opinion that is shared by all the
people in a group.

• Consensus is the backbone of a blockchain and, as a result, it provides decentralization of control


through an optional process known as mining.

• The choice of the consensus algorithm is also governed by the type of blockchain in use; that is,
not all consensus mechanisms are suitable for all types of blockchains.

• For example, in public permissionless blockchains, it would make sense to use PoW instead of a
simple agreement mechanism that is perhaps based on proof of authority. Therefore, it is essential
to choose an appropriate consensus algorithm for a particular blockchain project.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
CAP theorem
• CAP theorem, also known as Brewer's theorem, was introduced by Eric Brewer in 1998 as conjecture.
In 2002, it was proven as a theorem by Seth Gilbert and Nancy Lynch.

• The theory states that any distributed system cannot have consistency, availability, and partition
tolerance simultaneously:

• Consistency is a property which ensures that all nodes in a distributed system have a single, current, and
identical copy of the data.

• Availability means that the nodes in the system are up, accessible for use, and are accepting incoming
requests and responding with data without any failures as and when required. In other words, data is
available at each node and the nodes are responding to requests.

• Partition tolerance ensures that if a group of nodes is unable to communicate with other nodes due to
network failures, the distributed system continues to operate correctly.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
• This is explained with the following example.

• Let's imagine that there is a distributed system with two nodes. Now let us apply the three theorem
properties on this smallest of possible distributed systems only with two nodes.

• Consistency is achieved if both nodes have the same shared state; that is, they have the same up-to-date
copy of the data.

• Availability is achieved if both nodes are up and running and responding with the latest copy of data.

• Partition tolerance is achieved if communication does not break down between two nodes (either due to
network issues, Byzantine faults, and so forth), and they are able to communicate with each other.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Decentralization

• The basic idea of decentralization is to distribute control and


authority to the peripheries of an organization instead of one central
body being in full control of the organization.
• The fundamental basis of blockchain is that no single central authority
is in control.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Decentralization using blockchain

• Decentralization is a core benefit and service provided by blockchain


technology.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
• Centralized systems are conventional (client-server) IT systems in which there is a single authority that controls
the system, and who is solely in charge of all operations on the system.

All users of a centralized system are dependent on a single source of service.

Example: The majority of online service providers including Google, Amazon, eBay, Apple's App Store, and others
use this conventional model for delivering services.

• A distributed system, data and computation are spread across multiple nodes in the network. Sometimes, this term
is confused with parallel computing.

While there is some overlap in the definition, the main difference between these systems is that in a parallel
computing system, computation is performed by all nodes simultaneously in order to achieve the result.

Example, parallel computing platforms are used in weather research and forecasting, simulation and financial
modeling.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
• Decentralized system is a type of network where nodes are not dependent on a single master node; instead,
control is distributed among many nodes. the power from the central server and distributing it to the sub
departments who manage their own databases.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Methods of decentralization
• Two methods can be used to achieve decentralization: disintermediation and
competition (Contest-driven decentralization)

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Disintermediation

Bank

You You friend USA

• All you need is the address of your friend on the blockchain. This way, the
intermediary; that is, the bank, is no longer required, and decentralization is
achieved by disintermediation.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Contest-driven decentralization

• In the method involving competition, different service providers compete with


each other in order to be selected for the provision of services by the system.

• While there are many benefits of decentralization, including transparency,


efficiency, cost saving, development of trusted ecosystems,
Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Storage

• Data can be stored directly in a blockchain, and with this fact it achieves decentralization.

• However, a significant disadvantage of this approach is that a blockchain is not suitable for storing
large amounts of data by design.

• It can store simple transactions and some arbitrary data, but it is certainly not suitable for storing
images or large blobs of data, as is the case with traditional database systems.

• A better alternative for storing data is to use Distributed Hash Tables (DHTs). DHTs were used
initially in peer-to-peer file sharing software, such as BitTorrent, Napster, Kazaa, and Gnutella.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
• Two primary requirements here are high availability and link stability, which means that data
should be available when required and network links also should always be accessible.

• Interplanetary File System (IPFS) by Juan Benet possesses both of these properties, and its vision
is to provide a decentralized World Wide Web by replacing the HTTP protocol.

• IPFS uses Kademlia DHT and Merkle Directed Acyclic Graph (DAG) to provide storage and
searching functionality, respectively.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Communication
• There is a need to provide control to individual users in such a way that access to their data is
guaranteed and is not dependent on a single third party.

• Access to the internet (the communication layer) is based on Internet Service Providers (ISPs)
who act as a central hub for internet users.

• If the ISP is shut down for any reason, then no communication is possible with this model.

• An alternative is to use mesh networks. Even though they are limited in functionality when
compared to the internet, they still provide a decentralized alternative where nodes can talk directly
to each other without a central hub such as an ISP.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Computing power
• Decentralization of computing or processing power is achieved by a blockchain
technology such as Ethereum, where smart contracts with embedded business logic can
run on the blockchain network.

• Other blockchain technologies also provide similar processing-layer platforms, where


business logic can run over the network in a decentralized manner.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Provide authentication and
identification services with
varying degrees of
Provide a storage layer too, but decentralization and
that severely hampers the speed security
and capacity of the system
Solutions such as IPFS and
BigchainDB are more
suitable to store large
amounts of data in a
decentralized way

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Decentralized Applications (Dapps)
• DApps that run on top of a blockchain in a peer-to-peer network. They represent the latest
advancement in decentralization technology.

• DApps, on the other hand, are software programs that can run on their respective blockchains, use
an existing established blockchain, or use only the protocols of an existing blockchain.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
The General Theory of Decentralized Applications, Dapps:

• The DApp should be fully open source and autonomous, and no single entity should be in control
of a majority of its tokens.

• Data and records of operations of the application must be cryptographically secured and stored on
a public, decentralized blockchain to avoid any central points of failure.

• A cryptographic token must be used by the application to provide access and rewards to those who
contribute value to the applications, for example, miners in Bitcoin.

• The tokens must be generated by the DApp according to a standard cryptographic algorithm. This
generation of tokens acts as a proof of the value to contributors (for example, miners).

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering
Operations of a DApp

• Establishment of consensus by a DApp can be achieved using consensus algorithms such as PoW
and PoS.
• So far, only PoW has been found to be incredibly resistant to 51% attacks, as is evident from
Bitcoin.
• Furthermore, a DApp can distribute tokens (coins) via mining, fundraising, and development.
• DApp examples:- Know Your Customer (KYC)-Chain,
OpenBazaar:- a decentralized peer-to-peer network that enables commercial
activities directly between sellers and buyers instead of relying on a central party, such as eBay and
Amazon.
Lazooz:- This is the decentralized equivalent of Uber.

Introduction to Blockchain and distributed ledger & 19CS3618 Department of Computer Science and Engineering

You might also like