Module-1
Chapter-1(T1)
Blockchain 101
Aparna N,[Link].,Dept. of CSE,CiTech.
Introduction
• Blockchain is an evolving technology.
• It is a technology that has an impact on current technologies too
and possesses the ability to change them at a fundamental level.
• According to Gartner's technology hype cycle graph shown
below, the blockchain technology is currently at the peak of
inflated expectations (as of July 2016) and is expected to be
ready for mainstream adoption in 5 to 10 years
Aparna N,[Link].,Dept. of CSE,CiTech.
Gartner's hype cycle for emerging technologies
Aparna N,[Link].,Dept. of CSE,CiTech.
• Benefits : decentralized trust, cost savings, transparency, and
efficiency.
• challenges: scalability and privacy.
History
• In 2008 a groundbreaking paper Bitcoin: A Peer-to-Peer
Electronic Cash System was written on the topic of peer-to-peer
electronic cash under the pseudonym Satoshi Nakamoto and
introduced the term chain of blocks.
• This term over the years has now evolved into the word
blockchain.
Aparna N,[Link].,Dept. of CSE,CiTech.
Distributed systems
• Blockchain is a decentralized distributed system.
• Distributed systems are a computing paradigm whereby two or
more nodes work with each other in a coordinated fashion in
order to achieve a common outcome and it's modeled in such a
way that end users see it as a single logical platform.
• A node can be defined as an individual player in a distributed
system.
• All nodes are capable of sending and receiving messages to and
from each other.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Nodes can be honest,faulty, or malicious and have their own
memory and processor.
• A node that can exhibit arbitrary behavior is also known as a
Byzantine node.
• This arbitrary behavior can be intentionally malicious, which is
detrimental to the operation of the network.
• Generally, any unexpected behavior of a node on the network
can be categorized as Byzantine.
Aparna N,[Link].,Dept. of CSE,CiTech.
Aparna N,[Link].,Dept. of CSE,CiTech.
• The main challenge in distributed system design is coordination
between nodes and fault tolerance.
• Even if some of the nodes become faulty or network links
break, the distributed system should tolerate this and should
continue to work flawlessly in order to achieve the desired
result.
Aparna N,[Link].,Dept. of CSE,CiTech.
CAP theorem
• This is also known as Brewer's theorem, introduced originally by
Eric Brewer as a conjecture in 1998; in 2002 it was proved as a
theorem by Seth Gilbert and Nancy Lynch.
• The theorem states that any distributed system cannot have
Consistency, Availability, and Partition tolerance simultaneously:
• Consistency is a property that ensures that all nodes in a
distributed system have a single latest copy of data
Aparna N,[Link].,Dept. of CSE,CiTech.
• Availability means that the system is up, accessible for use, and
is accepting incoming requests and responding with data
without any failures as and when required
• Partition tolerance ensures that if a group of nodes fails the
distributed system still continues to operate correctly
Aparna N,[Link].,Dept. of CSE,CiTech.
• Replication is a widely used method to achieve fault tolerance.
• Consensus algorithms ensure consistency by keeping all nodes
synchronized with the same data, a process known as state
machine replication.
• Blockchain is essentially a form of state machine replication.
• Nodes can experience two types of faults:
• a simple crash or arbitrary, malicious behavior.
• The latter is harder to handle as it can spread misleading information
and cause confusion.
Aparna N,[Link].,Dept. of CSE,CiTech.
Consensus
• Consensus is a process of agreement between distrusting nodes
on a final state of data.
• Consensus can be achieved using various algorithms.
• While it's simple for two nodes, like in client-server systems,
reaching agreement among multiple nodes in a distributed
system is much more challenging. This is known as distributed
consensus.
Aparna N,[Link].,Dept. of CSE,CiTech.
Consensus mechanisms
• A consensus mechanism is a set of steps that are taken by all, or
most, nodes in order toagree on a proposed state or value.
Aparna N,[Link].,Dept. of CSE,CiTech.
• The following are the requirements to meet which improve desired results in a
consensus mechanism with brief descriptions:
• Agreement: All honest nodes decide on the same value.
• Termination: All honest nodes terminate execution of the consensus
process and eventually reach a decision.
• Validity: The value agreed upon by all honest nodes must be the same as
the initial value proposed by at least one honest node.
• Fault tolerant: The consensus algorithm should be able to run in the
presence of faulty or malicious nodes (Byzantine nodes).
• Integrity: This is a requirement where by no node makes the decision
more than once. The nodes make decisions only once in a single
consensus cycle.
Aparna N,[Link].,Dept. of CSE,CiTech.
Types of consensus mechanism
• Byzantine fault tolerance-based: With no compute intensive
operations such as partial hash inversion, this method relies on
a simple scheme of nodes that are publishing signed messages.
• Eventually, when a certain number of messages are received,
then an agreement is reached.
• Leader-based consensus mechanisms: This type of mechanism
requires nodes to compete for the leader-election lottery and the
node that wins it proposes a final value.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Practical consensus protocols include Paxos, introduced by
Leslie Lamport in 1989, where nodes take on roles such as
Proposer, Acceptor, and Learner.
• Consensus is achieved by a majority agreement among replicas,
even with faulty nodes. Another popular protocol is RAFT,
which assigns nodes one of three states: Follower, Candidate,
or Leader.
• A Leader is elected through votes, and all changes are
processed by the Leader once replicated across a majority of
followers.
Aparna N,[Link].,Dept. of CSE,CiTech.
The history of blockchain
• Blockchain was introduced with the invention of bitcoin in
2008 and then with its practical implementation in 2009.
• Electronic cash
• The concept of electronic cash is key to understanding the first
successful blockchain application: Bitcoin, and cryptocurrencies in
general.
Aparna N,[Link].,Dept. of CSE,CiTech.
The concept of electronic cash
• Fundamental issues that need to be addressed in e-cash
systems are accountability and anonymity.
• David Chaum addressed both of these issues in his seminal
paper in 1984 by introducing two cryptographic operations,
namely blind signatures and secret sharing.
• At the moment, it is sufficient to say that blind
• signatures allow signing a document without actually seeing it
and secret sharing is a
• concept that allows the detection of using the same e-cash
token twice (double spending).
Aparna N,[Link].,Dept. of CSE,CiTech.
• Hashcash was introduced by Adam Back in 1997 as a PoW
system to control e-mail spam.
• If legitimate users want to send e-mails then they are required to
compute a hash as a proof that they have spent a reasonable
amount of computing resources before sending the e-mail.
• If a spammer wants to send e-mails, usually thousands in
number, then it becomes infeasible to compute hashcash for all e-
mails, thus making the spamming effort expensive;
Aparna N,[Link].,Dept. of CSE,CiTech.
• In 1998 b-money was introduced by Wei Dai and proposed the
idea of creating money via solving computational puzzles such as
hashcash.
• It's based on a peer-to-peer network where each node maintains
its own list of transactions.
• Another similar idea by Nick Szabo called BitGold was
introduced in 2005 and also proposed solving computational
puzzles to mint digital currency.
• In 2005 Hal Finney introduced the concept of cryptographic
currency by combining ideas from b-money and hashcash puzzles
but it still relied on a centralized trusted authority.
Aparna N,[Link].,Dept. of CSE,CiTech.
• In 2009, Bitcoin was introduced as the first practical
cryptocurrency, solving the issue of distributed consensus in a
trustless network.
• It uses public key cryptography and Proof of Work (PoW) for
secure, decentralized minting of digital currency.
• The key innovation is a cryptographically secured, ordered list
of transaction blocks, known as the blockchain.
Aparna N,[Link].,Dept. of CSE,CiTech.
The various ideas that helped with the invention of bitcoin and blockchain
Aparna N,[Link].,Dept. of CSE,CiTech.
Introduction to blockchain
• 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:
Aparna N,[Link].,Dept. of CSE,CiTech.
The network view of a blockchain
Aparna N,[Link].,Dept. of CSE,CiTech.
• From a business point of view a blockchain can be defined as a
platform whereby peers can exchange values using
transactions without the need for a central trusted arbitrator.
• This allows blockchain to be a decentralized consensus
mechanism where no single authority is in charge of the
database.
• A block is a collection of transactions organized logically. Its
size varies based on the blockchain's design.
• Each block references the previous one, except the first block,
called the genesis block, which is hardcoded.
Aparna N,[Link].,Dept. of CSE,CiTech.
• While block structures differ by blockchain, essential
components typically include a block header, pointers to
previous blocks, timestamp, nonce, transaction counter, and
the transactions themselves.
The structure of a block
Aparna N,[Link].,Dept. of CSE,CiTech.
Technical definitions of blockchains
• Blockchain is a decentralized consensus mechanism. In a
blockchain, all peers eventually come to an agreement
regarding the state of a transaction.
• Blockchain is a distributed ledger of transactions grouped into
ordered blocks. Unlike private databases maintained by
individual organizations, blockchain serves as a shared, single
source of truth. This allows all member organizations to access
and verify the same data.
Aparna N,[Link].,Dept. of CSE,CiTech.
• 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.
Generic structure of a blockchain
Aparna N,[Link].,Dept. of CSE,CiTech.
Generic elements of a blockchain
• Addresses
⮚ Blockchain addresses are unique identifiers for senders and
recipients in transactions, often derived from public keys.
⮚ While addresses can be reused, it's recommended to generate a
new one for each transaction to enhance privacy.
⮚ Bitcoin is pseudonymous, meaning users aren't directly
identifiable, but research shows they can be de-anonymized.
⮚ Generating new addresses helps prevent linking transactions to
a common owner and reduces the risk of identification.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Transaction
⮚ A transaction is the fundamental unit of a blockchain.
⮚ A transaction represents a transfer of value from one address to
another.
• Block
⮚ A block is composed of multiple transactions and some other
elements such as the previous block hash (hash pointer),
timestamp, and nonce.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Peer-to-peer network
⮚ This is a network topology whereby all peers can communicate
with each other and send and receive messages.
• Scripting or programming language
⮚ 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;
Aparna N,[Link].,Dept. of CSE,CiTech.
• 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.
• State machine
⮚ A blockchain can be viewed as a state transition mechanism
whereby 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.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Nodes
• A blockchain node's functions depend on its role. It can propose and
validate transactions, perform mining, and ensure consensus using
protocols like Proof of Work (PoW). Nodes may also serve as
lightweight nodes for payment verification, validators, or other roles
depending on the blockchain type.
• 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.
Aparna N,[Link].,Dept. of CSE,CiTech.
Features of a blockchain
✔ Distributed consensus
• Distributed consensus is the major underpinning of a blockchain.
• This enables a blockchain to present a single version of truth that is agreed
upon by all parties without the requirement of a central authority.
✔ Transaction verification
• Any transactions posted from nodes on the blockchain are verified based on
a predetermined set of rules and only valid transactions are selected for
inclusion in a block.
Aparna N,[Link].,Dept. of CSE,CiTech.
✔Platforms for smart contracts
• A blockchain is a platform where programs can run that
execute business logic on behalf of the users.
• As explained earlier, not all blockchains have a mechanism to
execute smart contracts; however, this is now a very desirable
feature.
✔Transferring value between peers
• Blockchain enables the transfer of value between its users via
tokens.
• Tokens can be thought of as a carrier of value.
Aparna N,[Link].,Dept. of CSE,CiTech.
✔ Generating cryptocurrency
• A blockchain can generate cryptocurrency as an incentive to its miners who
validate the transactions and spend resources in order to secure the
blockchain.
✔ Smart property
• For the first time, digital or physical assets can be linked to the blockchain
irrevocably, ensuring full control and preventing double ownership or double
spending.
Aparna N,[Link].,Dept. of CSE,CiTech.
✔ Provider of security
• Blockchain is based on proven cryptographic technology that ensures
the integrity and availability of data.
• Other security services such as nonrepudiation and authentication are
also provided by blockchain as all actions are secured by using private
keys and digital signatures.
✔ Immutability
• Records once added onto the blockchain are immutable.
• There is the possibility of rolling back the changes but this is considered
almost impossible to do as it will require an unaffordable amount of
computing resources.
Aparna N,[Link].,Dept. of CSE,CiTech.
✔ Uniqueness
• This feature of blockchain ensures that every transaction is unique and
has not been spent already.
• This is especially relevant in cryptocurrencies where much desirable
detection and avoidance of double spending are a key requirement.
✔ Smart contracts
• Blockchain provides a platform to run smart contracts.
• These are automated autonomous programs that reside on the
blockchain and encapsulate business logic and code in order to execute
a required function when certain conditions are met.
Aparna N,[Link].,Dept. of CSE,CiTech.
How blockchains accumulate blocks
1. A node starts a transaction by signing it with its private
key.
2. The transaction is propagated (flooded) by using much
desirable Gossip protocol to peers, which validates the
transaction based on pre-set criteria. Usually, more
than one node is required to validate the transactions.
3. Once the transaction is validated, it is included in a block,
which is then propagated on to the network. At this point,
the transaction is considered confirmed.
Aparna N,[Link].,Dept. of CSE,CiTech.
• 4. The newly created block now becomes part of the ledger and the next
block links itself cryptographically back to this block. This link is a
hash pointer. At this stage, the transaction gets its second confirmation
and the block gets its first.
• 5. Transactions are then reconfirmed every time a new block is created.
• Usually, six confirmations in the bitcoin network are required to
consider the transaction final.
• Steps 4 and 5 can be considered non-compulsory as the transaction itself
is finalized in step 3; however, block confirmation and further
transaction reconfirmations, if required, are then carried out in steps 4
and 5.
Aparna N,[Link].,Dept. of CSE,CiTech.
Tiers of blockchain technology
• Blockchain 1.0
• This was introduced with the invention of bitcoin and is basically used
for cryptocurrencies.
• All alternative coins and bitcoin fall into this category. This includes
core applications such as payments and applications.
• Blockchain 2.0
• Generation 2.0 blockchains are used by financial services and contracts
are introduced in this generation. This includes various financial assets,
for example derivatives, options,swaps, and bonds. Applications that are
beyond currency, finance, and markets are included at this tier.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Blockchain 3.0
• Generation 3 blockchains are used to implement applications that are
used in more general-purpose industries such as government, health,
media, the arts, and justice.
• Generation X (Blockchain X)
• This is a vision of blockchain singularity where one day we will have a
public blockchain service available that anyone can use just like the
Google search engine.
• It will provide services in all realms of society.
• This is a public open distributed ledger with general purpose rational
agents (Machina Economicus) running on blockchain, making decisions
and interacting with other intelligent autonomous agents on behalf of
humans and regulated by code instead of law or paper contracts.
Aparna N,[Link].,Dept. of CSE,CiTech.
Types of blockchain
• Public blockchains
• As the name suggests, these blockchains are open to the public and
anyone can participate as a node in the decision-making process.
• Users may or may not be rewarded for their participation.
• These ledgers are not owned by anyone and are publicly open for anyone
to participate in.
• All users of the permission-less ledger maintain a copy of the ledger on
their local nodes and use a distributed consensus mechanism in order to
reach a decision about the eventual state of the ledger. These blockchains
are also known as permission-less ledgers.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Private blockchains
• Private blockchains as the name implies are private and are
open only to a consortium or group of individuals or
organizations that has decided to share the ledger among
themselves.
• Semi-private blockchains
• Part of the blockchain is private and part of it is public.
• The private part is controlled by a group of individuals whereas
the public part is open for participation by anyone.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Sidechains
• More precisely known as pegged sidechains, this is a concept
whereby coins can be moved from one blockchain to another
and moved back.
• Common uses include the creation of new altcoins (alternative
cryptocurrencies) whereby coins are burnt as a proof of
adequate stake.
• Two types of sidechain:-
• one-way pegged sidechain.
• Two-way pegged sidechain: which allows the movement of
coins from the main chain to the sidechain and back to the
main chain when required.
Aparna N,[Link].,Dept. of CSE,CiTech.
Permissioned ledger
• A permissioned ledger is a blockchain whereby the
participants of the network are known and already
trusted.
• Permissioned ledgers do not need to use a distributed
consensus mechanism, instead an agreement protocol
can be used to maintain a shared version of truth about
the state of the records on the blockchain.
• There is also no requirement for a permissioned
blockchain to be private as it can be a public blockchain
but with regulated access control.
Aparna N,[Link].,Dept. of CSE,CiTech.
Distributed ledger
• This ledger is distributed among its participants and
spread across multiple sites or organizations.
• This type can either be private or public.
• The key idea is that, unlike many other blockchains, the
records are stored contiguously instead of sorted into
blocks. This concept is used in Ripple.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Shared ledger
• This is generic term that is used to describe any
application or database that is shared by the
• public or a consortium.
• Fully private and proprietary blockchains
• These blockchains perhaps have no mainstream
application as they deviate from the core idea of
decentralization in blockchain technology. For example,
for collaboration and sharing data between various
government departments.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Tokenized blockchains
• These blockchains are standard blockchains that generate
cryptocurrency as a result of a
• consensus process via mining or via initial distribution.
• Tokenless blockchains
• These are probably not real blockchains because they lack
the basic unit of transfer of value but are still valuable in
situations where there is no need to transfer value
between nodes and only sharing some data among
various already trusted parties is required.
Aparna N,[Link].,Dept. of CSE,CiTech.
Consensus in blockchain
• Consensus is basically a distributed computing concept
that has been used in blockchain in order to provide a
means of agreeing to a single version of truth by all peers
on the blockchain network.
• two categories of consensus mechanism
• 1. Proof-based, leader-based, or the Nakamoto
consensus whereby a leader is elected and proposes a
final value
• 2. Byzantine fault tolerance-based, which is a more
traditional approach based on rounds of votes
Aparna N,[Link].,Dept. of CSE,CiTech.
Proof of Work
• This type of consensus mechanism relies on proof that
enough computational resources have been spent before
proposing a value for acceptance by the network. This is
used in bitcoin and other cryptocurrencies. Currently, this
is the only algorithm that has proven astonishingly
successful against Sybil attacks.
• Solving Puzzles to Earn Rewards
• Eg: solving a difficult problem/program
Aparna N,[Link].,Dept. of CSE,CiTech.
Proof of Stake
• This algorithm works on the idea that a node or user has
enough stake in the system;
• Used in Peercoin and is going to be used in the Ethereum
blockchain.
• Another important concept in Proof of Stake (PoS) is coin age,
which is a derived from the amount of time and the number of
coins that have not been spent.
• In this model, the chances of proposing and signing the next
block increase with the coin age.
• Eg: The more cryptocurrency you "stake" (lock up), the higher
the chance you get to validate transactions and earn rewards.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Delegated Proof of Stake
• Delegated Proof of Stake (DPOS) is an innovation over standard
PoS whereby each node that has stake in the system can
delegate the validation of a transaction to other nodes by voting.
This is used in the bitshares blockchain.
• Eg: Voting for Leaders
• Proof of Elapsed Time
• By Intel, it uses Trusted Execution Environment (TEE) to provide
randomness and safety in the leader election process via a
guaranteed wait time.
• It requires the Intel SGX (Software Guard Extensions) processor
in order to provide the security guarantee and for it to be secure.
• Eg: Random Wait TimeAparna N,[Link].,Dept. of CSE,CiTech.
• Deposit-based consensus
• Nodes that wish to participate on the network have to put
in a security deposit before they can propose a block.
• Proof of importance
• This idea is important and different from Proof of Stake.
• Proof of importance not only relies on how much stake a
user has in the system but it also monitors the usage and
movement of tokens by the user to establish a level of
trust and importance. This is used in Nemcoin.
Aparna N,[Link].,Dept. of CSE,CiTech.
CAP theorem and blockchain
• CAP theorem is violated in blockchain, and especially in
the most successful implementation: bitcoin, but this is
not the case.
• In blockchains consistency is sacrificed in favor of
availability and partition tolerance.
• In this scenario, Consistency (C) on the blockchain is not
achieved simultaneously with Partition tolerance (P) and
• Availability (A), but it is achieved over time. This is called
eventual consistency.
Aparna N,[Link].,Dept. of CSE,CiTech.
• consistency is achieved as a result of validation from
multiple nodes over time.
• For this purpose, the concept of mining was introduced in
bitcoin;
• this is a process that facilitates the achievement of
consensus by using a consensus algorithm called PoW.
• At a higher level,mining can be defined as a process that
is used to add more blocks to the blockchain.
Aparna N,[Link].,Dept. of CSE,CiTech.
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.
Aparna N,[Link].,Dept. of CSE,CiTech.
• 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.
• 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.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Highly secure
• All transactions on a blockchain are cryptographically
secured and provide integrity.
• Simplification of current paradigms
• 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.
Aparna N,[Link].,Dept. of CSE,CiTech.
• Faster dealings
• Blockchain can allow 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 these parties.
Aparna N,[Link].,Dept. of CSE,CiTech.
Challenges and limitations of blockchain
Technology
• Scalability-Handling More Traffic
• Adaptability-Keeping Up with Change
• Regulation-Legal Uncertainty
• Relatively immature technology-Still Evolving
• Privacy-Balancing Transparency & Security
Aparna N,[Link].,Dept. of CSE,CiTech.