You are on page 1of 35

Blockchain-II

Dr. Maumita Chakraborty


University of Engineering and Management Kolkata

Dr. Maumita Chakraborty, UEM Kolkata 1


Basic Distributed Computing

Dr. Maumita Chakraborty, UEM Kolkata 2


Centralized Systems: Characteristics
Central Server /
• Global Clock Authority
• Single Central Unit
• Failure prone
• Scaling: Vertical scaling
• Components and Architecture Nodes

– Components: Any device such as


computer, mobile etc.
– Communication objects: Cables
and internet components.
– Architecture: Central node serves
all the other node of the system.

Dr. Maumita Chakraborty, UEM Kolkata 3


Centralized Systems: Limitations
• Blockages observed when traffic increases on central server as there
are limited number of ports.
• After a certain point, if we scale the hardware/software of the
central system, performance of central node will not be affected.
• Backup of central system is very critical.
• Maintenance of central system is complex.

Dr. Maumita Chakraborty, UEM Kolkata 4


Centralized Systems: Advantages
• Easy to secure (service easy between client and server)
• Cost effective for small deployments up to a certain level.
• Easy to detach nodes from the overall network (as nodes are
independent).

Dr. Maumita Chakraborty, UEM Kolkata 5


Decentralized System: Characteristics
• Every node is autonomous
and owns different clocks.
No synchronization among
them. Nodes
• Each node is empowered to
process the data and work
as a central unit.
• If one of the nodes fail,
Nodes
system does not fail.
• Nodes follow peer-to-peer
sharing the
workload
(P2P) architecture. Any
node can work as master
node and go for decision-
making.

Dr. Maumita Chakraborty, UEM Kolkata 6


Decentralized System: Limitations
• Complex to form the consensus as all nodes are decision-makers and
can behave in their own way.
• Not vouched for small-scale deployments, not feasible because of
cost benefit analysis.
• Because of autonomous nature, it is complex and difficult to realize
huge transactions.
• Difficult to find the point of failure.
• Difficult to know which node is serving the system for decision
making.

Dr. Maumita Chakraborty, UEM Kolkata 7


Decentralized System: Advantages
• No traffic issue as load can be balanced across nodes.
• Highly available system as one node can take charge of others in case
of failure.
• Nodes are independent, achieve autonomous nature and provide
better overall control.

Dr. Maumita Chakraborty, UEM Kolkata 8


Distributed Ledger technology
• In Blockchain technology, a distributed ledger is a decentralized ledger of all the
information that is recorded onto the Blockchain by consensus.
• One can imagine it to be a database similar to an accounting ledger where financial
transactions are recorded, except that it is not restricted to financial data. Here a
transaction refers to any digital data including text, picture, or audio files.
• Unlike the typical database that is either centrally located in one server or spread out
among several selected servers, this database is distributed to all parties and locations.
• It can be accessed by every single member of the Blockchain network, thus ensuring
incorruptibility as malicious changes cannot be made when everyone has simultaneous
access to all records.

Dr. Maumita Chakraborty, UEM Kolkata 9


Power of Distributed Ledgers:
• Can be used without a central authority by individuals or entities with no basis to trust each other.
• Can be used to create value or transfer assets.
• Can be used to transfer value or the ownership of assets. (A human being or smart contract can initiate the
transfer).
• Can be used to record those transfers. (Records are difficult to alter, sometimes called immutable).

Dr. Maumita Chakraborty, UEM Kolkata 10


Types of Blockchain
• In Blockchain, user nodes can be
Private or Public, based on
whether the network is open or
accessible to anyone with an
internet connection.
• What rights does the node have
determines whether it is a
permissioned or permissionless
Blockchain.
• Permissionless: If rights are not
defined by a central entity or group of
entities. All nodes have equal rights.
• Permissioned: Central entity or group
restricts the roles of the nodes.

Dr. Maumita Chakraborty, UEM Kolkata 11


Public Blockchain

Key features Drawbacks


• Open to public: anyone can join network and • Poor scalability.
be a node.
• No permissions required for reading/sending • Low transaction processing speed (approx.
transactions. 10 mins to create a block).
• PoW (Proof-of-Work) is used, where nodes • Consensus mechanism requires huge
solve hash puzzles and submit the resultant amount of energy and computation power.
block to rest of the network for consensus.
• No single point of failure: Validation done by • Participants with supercomputers have
all nodes. better chances of mining than the others:
• High cryptographic methods used to secure risk of decentralization.
data.
• Establishes a process of trust.
• Examples: Bitcoin, Litecoin, Ethereum

Dr. Maumita Chakraborty, UEM Kolkata 12


Private Blockchain

Features Challenges
• Not open to public: Participants known to each other, trust is • Not decentralized.
assured.
• Participants pre-approved by organization, ledger and its • If nodes are trusted (unlike in Blockchain) it may be cheaper
access distributed among participants. to go with traditional database.
• Central authority/owner controls permission to read, write or • Not considered a legitimate Blockchain as it is permissioned.
audit ledger. Immutability and trust of transactions are in question (as
• Central authority controls consensus process. being controlled by a single authority).
• High cryptographic methods secure data. • Organization must agree on who has the highest power to be
• High transaction processing speed: take seconds to create a the central authority.
block.
• Very low energy consumption (supercomputers not required
for processing).

 Scalable and cryptographically secured from organization’s point of view.


 More cost effective.
 Mostly used by organizations that have strict privacy and compliance requirements.
 Examples: Multichain, MonaxDr. Maumita Chakraborty, UEM Kolkata 13
Consortium Blockchain

Features Drawbacks
• Also known as federated Blockchain • Not fully decentralized.
• Permissioned Blockchain, hybrid between public • Different organizations have different
and private Blockchain: Any node can initiate and
receive transactions. Permission to write or audit requirements. Challenge is to agree on a standard
the ledger is determined by a group of pre- set of rules.
approved individuals or organization (consortium).
• Consensus process done by nodes who have full
access to ledger.
• High cryptographic methods secure data.
• Faster than public Blockchain with higher
scalability.
• Have better transaction privacy and traceability.
• Examples: R3 Corda, Hyperledger fabric

Dr. Maumita Chakraborty, UEM Kolkata 14


Hybrid Blockchain
Features
• Consists of a public Blockchain (where anyone can participate) and a private Drawbacks
network (restricted to participants invited by a central authority).
• Ledger is distributed, either central body or network members can decide which
transaction data can be public and which needs to be confined to specific
• Relatively new
members. ecosystem.
• Private network creates hash of transactions and pass it to the public network
for validation.
• Some processes are public, others are private.
• Public and private networks have consensus protocols of their own.
• Data is immutable and secured.
• Has highest transaction processing speed.
• No malicious party can either enter the private network or the robust consensus
mechanism of the public network.
• Data is auditable, as and when required.
XinFin, a non-profit organization based in Singapore, built the first hybrid Blockchain platform.
Dr. Maumita Chakraborty, UEM Kolkata 15
Dr. Maumita Chakraborty, UEM Kolkata 16
Types of Blockchains
Public Blockchain Private Blockchain Consortium Blockchain Hybrid Blockchain
Organization
Type

Common Chain of blocks – Peer-to-peer architecture – Public key cryptography – Immutable – Byzantine Fault
features Tolerance - Auditable

Users Anonymous; but Known & Trusted Known & Trusted Anonymity for public
web-tracking and participants participants network members; Private
cookies pose a risk network members are
to privacy known within the private
network.
Access Open and Access fully restricted Selectively open; relevant Centralized control of
transparent to all transparency provided providing access, hence
privacy and confidentiality
maintained
Dr. Maumita Chakraborty, UEM Kolkata 17
Public Blockchain Private Blockchain Consortium Blockchain Hybrid Blockchain
Network Type Decentralized; zero Centralized; single Partially decentralized; Zero point of failure
points of failure point of failure multiple points of failure
Operation Anyone can read or Pre-approved Pre-approved participants Any combination is
initiate or receive participants can read can read and/or initiate possible; Operations are
transactions and/or initiate transactions customizable. Central
transactions authority decides which
transactions can be made
public and which are
private
Verification Anyone can be Single validator node Only privileged members of The public network
made a node and or central authority to the consortium can validate verifies the block
take part in the create a block and create a block
consensus process
to validate
transactions and
create a block
Immutability Secured by hashing Secured by Secured by distributed Secured by hashing at the
distributed consensus consensus public network and
secured by distributed
consensus by the private
blockchain

Dr. Maumita Chakraborty, UEM Kolkata 18


Public Blockchain Private Blockchain Consortium Blockchain Hybrid Blockchain
Consensus PoW, PoS etc. Voting or variations of Voting or variations of DPoS in public and
Mechanism PoW/PoS consensus PoW/PoS consensus variations in private
algorithms algorithms
Incentivization Incentivizes miners Users limited to Limited incentivization Can incentivize users in
to grow the within a company; the main public network
network hence, incentivization
is not relevant
Security Security based on Security is dependent Security is dependent on the Very high as hackers or
consensus on the blockchain blockchain architecture unknown parties cannot
protocols and hash architecture adopted adopted access the system
functions. Higher
the security, lower
the performance
Trust Trust-free system; Trusted; central Trusted; need to trust the Trust-free system;
trust is enforced via control majority consensus by public
cryptographic proof blockchain

Dr. Maumita Chakraborty, UEM Kolkata 19


When to use what type of Blockchain?

Dr. Maumita Chakraborty, UEM Kolkata 20


Blockchain-as-a-Service (BaaS)
• Concept similar to Software-as-a-Service (SaaS) Model.
• Complexity of infrastructure and cost of setting up and operating the
blockchain may discourage from adopting blockchain.
• Businesses can leverage the cloud-based solution to build their
blockchain apps, smart contracts and other blockchain functions.
• The cloud-based service provider maintains the infrastructure and
other back-end operations, including storage, bandwidth
management, security and resource allocation.

Dr. Maumita Chakraborty, UEM Kolkata 21


What is Consensus?
• Consensus: General agreement or opinion shared by all the people in
a group.
• Protocol: System of standard rules that are acceptable by all parties to
control information exchange in a network.
• Consensus Protocol:
• Set of rules and procedures for attaining a unified agreement (consensus)
between the participating nodes on the status of the network.
• Rules that define how different actors in a distributed ledger authenticate and
validate the transactions added to it.
• Aim to overcome the classic problem of a distributed computing system
known as Byzantine Generals Problem.

Dr. Maumita Chakraborty, UEM Kolkata 22


Byzantine Generals Problem

Dr. Maumita Chakraborty, UEM Kolkata 23


Byzantine Generals Problem
• Two Byzantine (Roman) armies led by different generals preparing to attack a city.
• City is strong enough to withstand individual attack of either army but not strong enough to
withstand a coordinated attack by the two armies at the same time.
• The two generals, General X and General Y need to agree on the time of the attack.
• One general need to take a leadership role and send messenger to the other general through the
city, who then sends back an acknowledgement in agreement.
• There is no way for either of the generals to guarantee that the other one has received their
message. Dilemma is between 2 generals.
• In a distributed network, dilemma is between all participants or nodes.
• Solution to Byzantine Generals problem -> Consensus algorithm in Blockchain
• Consensus mechanism aims to overcome the following trust risks in a distributed network system:
• Authenticity: Message should be easily verifiable to ensure that it is genuine and not tampered with.
• Unity: A collective agreement by all parties should be there on action to be taken.
• Fault Tolerance: Traitors or hackers should not be able to compromise the process.

Dr. Maumita Chakraborty, UEM Kolkata 24


Objectives of Consensus Protocol

1. 2. 3.

Unified Agreement Fault Tolerant Collaborative and


Participatory

4. 5. 6.

Egalitarian Incentivisation Prevent Double-Spend


Dr. Maumita Chakraborty, UEM Kolkata 25
Objectives of Consensus Protocol
• Unified Agreement:
• Agreement on which data is valid and accurate.
• Ensured by protocol rules embedded in the network.
• Fault-tolerant:
• Every node acts as both a client and a server.
• Considerable number of nodes communicating to keep system functional, even if some may be unresponsive.
• Collaborative and participatory:
• All nodes should participate in the overall process to enable constant communication.
• Egalitarian:
• Every node should have equal weightage (as expected in a peer-to-peer network).
• Incentivization:
• Rules built to incentivize the miners to work for the system, as they spend huge amount of computational
resources, including electricity to solve complex mathematical problems.
• Prevent double-spend
• Protocol rules embedded in Blockchain to avoid falsification or duplication of cryptocurrencies.

Dr. Maumita Chakraborty, UEM Kolkata 26


Consensus Algorithms
• Different consensus algorithms work on different principles.
• Proof-of-Work (PoW) and Proof-of-Stake (PoS) are commonly used in
public Blockchains.
• Proof-of-Authority (PoA) and Proof-of-Elapsed Time (PoET) are
applied in private Blockchains.

Dr. Maumita Chakraborty, UEM Kolkata 27


Proof of Work
• Founded by Satoshi Nakamoto.
• Most well-known consensus mechanism used by first Blockchain Bitcoin in 2009.
• Solution to a complex mathematical problem based on a cryptographic hash algorithm (solved by miners):
Proof-of-work (PoW).
• Without PoW, adding blocks to a Blockchain would make it vulnerable to hackers.
• Mining node releases PoW to other nodes, for verification to reach consensus.
• Finding solution to the problem is difficult, but verification by network is easy.
• Process of mining: extremely computation-intensive. Hence, first miner is rewarded in the form of either
bitcoins or digital currency.
• Bitcoin, Litecoin, Ethereum use PoW as their consensus mechanism.

Disadvantages:
• Time consuming: Miners need to iterate over many nonces before finding the right solution.
• High energy consumption: Significant work needs to be conducted by the miners to find the nonce for
creating the winning hash. For all miners, other than the winner, it is wasted energy.
• 51% risk: Miners often group together to combine their mining resources for more efficiency and savings.
Mining pool is against basic principle of distributed ledgers. Person/group gaining control of over 50% of the
network’s computing power can control the validation process. Referred to as a 51% attack.
Dr. Maumita Chakraborty, UEM Kolkata 28
Proof of Stake
• Requires validators to hold some of the Blockchain’s token or cryptocurrency (stake).
• More stake one has in the validating node, less tempted to corrupt the validating process.
• Users with highest stake in a cryptocurrency is most interested in maintaining and securing network (as any
attack would diminish reputation and price of the cryptocurrency that they hold).
• Mining nodes termed as validators/forgers/delegates.
• Validating nodes can forge or create new blocks proportional to the amount they have staked, i.e. a node
with a 10% stake in the network can validate 10% of transactions.
• Time and energy consumption less than PoW.
• Forgers are paid a transaction fee.
• Peercoin, NXT use PoS mechanism in Blockchain. Ethereum uses PoS over an existing PoW Blockchain,
resulting in a hybrid PoW/PoS system.
Disadvantages:
• Cheaper to attack: Perpetrator need to spend some money and not invest in the combined set of money,
time, hardware, electricity, and other resources.
• Centralization risk: Richest forger can control the consensus mechanism and get even richer.

Dr. Maumita Chakraborty, UEM Kolkata 29


Proof of Authority
• Proposed in 2017.
• Used in private Blockchains. • VChainThor Blockchain
• Only a group of pre-selected validators secure Blockchain and can produce new blocks. use PoA Consensus.
• Hyperledger, Ripple use
• Instead of staking coins/tokens, validators stake their identity.
optimized versions of
• Identities of validators are public and verifiable by a reliable third party. PoA.
• If validators do not act in the best interest of the network, their reputation is ruined.
• Validators are limited to 25 or less.
• Low energy consumption, zero node-to-node data transfer requirements.
Conditions to be met to identify validators:
• Validators must have a valid identity in the public domain.
• Authority needs to be uniform and unbiased for all validators.
• Eligibility criteria to stake identity should be stringent to ensure trustworthiness of the validator.
• Disadvantages:
• Semi-centralized: PoA leans towards a more centralized system, as authority nodes are predetermined as validators.
Works well with private or consortium Blockchain, enabling better scalability. Eg.: A network of banks where each bank
acts as a validator for the others.
• Reputational indifference: Validators may sacrifice theirChakraborty,
Dr. Maumita reputation UEMifKolkata
the payoff is strong enough. 30
Proof of Elapsed Time
• Proposed in 2016.
• Commonly used in permissioned Blockchain networks to decide on mining rights or block winners.
• Every node is equally likely to be a winner.
• Each miner is provided with a randomized wait time.
• Miner who completes the designated waiting time commits a new block to the Blockchain and broadcasts
the relevant information.
• Process repeated for the discovery of the next block.
• It allows a miner to sleep and switch to other tasks for the specified time, thereby increasing its efficiency
and reducing power consumption.
• Identity of miners is known, unlike PoW.
Disadvantages:
• Vulnerability: Relies heavily on the use of a Trusted Execution Environment (TEEs) i.e., Intel SGX-enabled
CPUs. Vulnerable to various security attacks which attacks the secure enclave of SGX (Security Guard
Extensions).

Dr. Maumita Chakraborty, UEM Kolkata 31


Other Consensus Algorithms
• Delegated Proof of Stake (DPoS):
• Variation of PoS
• Network participants or nodes use their cyptocurrencies or tokens to vote for delegates.
• More the crypto-coins, more the voting power.
• Elected delegates are called witnesses.
• Enables better security and distribution of wealth.
• All users have a chance to be elected as a delegate and earn rewards.
• More decentralized than PoS or PoW.
• Proof of Stake Anonymous (PoSA):
• PoS variation for Cloakcoin.
• No master nodes, hence truly decentralized.
• Identity of receiver and sender kept anonymous.
• Leased Proof of Stake:
• PoS variation
• Users with low balances can also forge a block of transaction in the Blockchain.
• Enables users to sublet their balances to staking nodes.
• Reward is shared proportionally.

Dr. Maumita Chakraborty, UEM Kolkata 32


Other Consensus Algorithms
• Practical Byzantine Fault Tolerance (pBFT):
• A node client sends a transaction request to the leader node, who then broadcasts it to all the backup nodes.
• A leader node selected at random in a round-robin fashion.
• Leader and backup nodes run computation and transmit decision results (based on agreement of majority) to all client
nodes.
• If f = maximum number of faulty nodes, pBFT relies on minimum (f+1) number of backup nodes to confirm trust.
• Works for small-group networks for better response times (due to amount of communication required between nodes).
• Single node can assume different identities and manipulate the network.
• PAXOS: If majority of the nodes agree on a value, consensus is reached.
• RAFT:
• Built on PAXOS consensus.
• Similar to pBFT, except that only leader node can communicate with other nodes and decide on the state of transactions.
• Uses randomized timers to elect leaders for each term.
• Leader’s log must be more up-to-date than the follower logs.
• Leader receives a request-> Appends new entry to its log -> Sends to all follower nodes -> Receives confirmation from
majority of followers -> Commits message -> Sends confirmation to clients and followers
• Proof of Importance:
• Used with NEM cryptocurrency
• User with highest balance is also the user who provides maximum value to the network and should be incentivized.
• Forging a block depends on many factors like coin balance and authority.
Dr. Maumita Chakraborty, UEM Kolkata 33
Other Consensus Algorithms
• Proof of Storage: User can only see the transactions that are of particular importance to him.
• Proof of Burn: More the coins one burns (destroys), more chance one gets to mine blocks. Used in Slimcoin.
• Proof of Activity:
• Hybrid of PoW and PoS.
• Blocks being mined are not transactions, but templates with header information and mining reward address.
• Once template block is mined, random group of validators selected by PoS to sign the block.
• All validators sign the block, it becomes a part of the Blockchain.
• Block, if unsigned by a few, is discarded and next winning block template is used.
• Reduces risk of 51% attack but energy consumption issue not addressed.
• Proof of Capacity:
• Used only in Burstcoin.
• Mining nodes use available hard-drive space to mine cryptocoins, instead of using computing power.
• Miners create a list of all possible nonce values, will compute the solutions and store them in their hard-drives.
• Miner with fastest solution wins the block.
• 30 times more energy-efficient and more decentralized (anyone can own a basic hard-drive).
• Directed Acyclic Graph (DAG):
• Transactions can run on different chains simultaneously, unlike PoW.
• ITC (IoT Chain) built on DAG consensus protocol. Can process over 10,000 transactions per second.

Dr. Maumita Chakraborty, UEM Kolkata 34


Thank You

Dr. Maumita Chakraborty, UEM Kolkata 35

You might also like