0% found this document useful (0 votes)
30 views58 pages

TOPIC J - Blockchain

Uploaded by

Saahil Karnik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views58 pages

TOPIC J - Blockchain

Uploaded by

Saahil Karnik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 58

TOPIC J - Blockchain

The March to Distributed Sovereignty

Materials from:
- Dan Boneh and David Mazières (Stanford University)
- Satoshi Nakamoto’s white paper (2008).
- Gloria Zhao, Gillian Chu, and Brian Ho (Berkely)
- MIT Open Couseware (15.014 Applied Macro- and International Economics II)
Outline
• Introduce Blockchain concepts
• The story of the never-ending book
• Compare Blockchains to Traditional Databases
• Demonstrate Fundamental Benefits of Blockchain
• Simple chess game example
• Introduction to Blockchain Fundamentals
• Trust without Trustees
• Collisions, proof of work, Hash chains
• Permissioned chains
The never-ending book
A “book” of transactions
A lice
s
x to B ends
ob

Alice

- Each new page requires some effort to produce.


- Anyone can be a scribe and produce a page.
- New pages are produced indefinitely as long as
scribes are interested in doing so.
Importance of
Consensus
• If multiple conflicting books exist, which is the “right one”?
Choosing the correct
book

• The current book to work on & refer to


is the book with the most pages.
• If multiple exist, just pick one at random.
Assembling the current
book • Each page refers only to the previous page
• Current Book is assembled by stringing together
the longest sequence of pages.

Orphan pages
Orphan pages
4’ 7’

1 2 3 4 5 6 7 8

6’

Orphan pages
Rules of extending the
book The first scribe that discovers
a page announces it to everyone else
Effort is needed to produce a
page
Equivalent to : each page needs a special
combination from a set of dice to be rolled.

The probabilistic nature of the process


is paramount to its security
The benefits of
randomness
Imagine two scribes
working together

Unlikely
to continuously
be lucky
together

eventually
one book
will be longer
and be adopted
by both of them
Being a scribe
• Anyone can be a scribe for the book.
• As long as one has a set of dice.
• The more dice one has, the higher the likelihood to produce the
winning combination to make a page.
Using the book -
Money 3.0
verify purchase details
Seller
Buyer address for payment


ed
paym

rm
ent

nfi
B pay

“co
sS
x

t is
en
ym
put

pa
fy
item

ri
ve
for
delivery
Parable & Reality
book
the “blockchain”

“Miners” / Computer systems


that organize
scribes
transactions in blocks

Solving a cryptographic
producing puzzle that is moderately
a page hard to solve

rolling Using a computer to test for a solution


a set of from a large space of candidate
solutions
dice
What is Blockchain
• Simple Answer: A Database
• But it is Unique because
• Blockchain runs on a Peer to Peer Network
• A Blockchain Serial File
• An Agreed set of protocols
• A Blockchain Parser
• Runs over the blockchain file to retrieve useful
information.
The problem with traditional
Databases
• Records can be altered or changed with out trace
• Experienced DB Administrator could alter data and hide traces
• Incorrect configurations
• Traditional DBs are centralized by design
• Client server architecture
• Problems and limitations related to
• Concurrent data editing
• Synchronization
• Point of failure. Can be minimized with Backups
• Requires a central authority (setting up, maintenance, ..)
• ..
What is a Blockchain?
• A method to store data in a sequential chain of blocks
• Each block is a package of data created within a short consecutive
period of time
• A block has its own hash:
• Based on the data the block contains
• Functions as a unique finger print for the block
• Each Block points to the Block before it.
What is a Blockchain?

• Each Block (Except the first Genesis Block) contains a reference to the
block before it using the previous block’s hash.
• This forms a chain than can grow.
• Blocks content cannot change. If content changes, this will change the
hash, which will break the chain of references.
How to Add Blocks to the chain
• Some peers in the network can transmit data that they wish to be
included in the next Block
• Other peers receive and package data into their own proposed Block,
and then wait to see if they are lucky enough to create the next Block
on the chain.
• These peers do this because there is usually a reward for creating the new
Block.
How are blocks added to the chain?
• Blocks are usually accepted at a regular time interval (say 10 minutes)
• But Which peer gets to create the next Block?
• There are many variations:
• Proof-of-Work (Used by Blockchain)
• Proof-of-Stake (Ethereum)
• Practical Byzantine Fault Tolerance (Hyperledger Fabric)
• Proof-of-Elapsed-time (Hyperledger Sawtooth Lake)
• ..
• These are schemes to decide whose block gets to be added next
Types of Blockchain
Type Description Example Use
Public • Blockchain is available freely on • Bitcoin
the internet. • Support Global Trade
• The code is often opensource • Passport System
• Protocols are also published • Review and Reputation systems
• Blockchain is accessed on the • Asset tracking by shipping
internet, but the software is companies
Permissioned usually proprietary. • Smart meters run by power
• Accessed requires keys that are companies
issued by an authority
Private • The blockchain is available only • HR Permanent records
on the intranet/VPN. • Legal compliance records
• Access controlled by keys issued (ensuring authenticity)
by an authority
Blockchain or a Traditional DB
Blockchain Data Base
• Extremely difficult to alter data • Data can be changed. If the log is also changed
Data Integrity without impossibly large then the original data manipulation cannot be
computational power. traced.
• Only system admin can view certain data and
Audit Trail • All actions and transactions are the actions taken. There is no guarantee that
available on the chain
the logs have not been altered.
• Stored in a central high-powered server(s).
Location • Distributed on the peer network Backups typically achieved through secondary
dedicated servers.
Speed • Records typically take minutes to be
added to the chain • Records can be added in milliseconds.
Participants • A network of Peers • Central Authority granting access
• Trust arises naturally through the • Subjective, dependent on the level of trust of
Trust actions required to add records and the supporting technology and the company
the rewards gained for doing so. hosting the data.
Blockchain or a Traditional DB
Blockchain Data Base
• First emerged in 2009.
• Emerged in the 1970s.
History • New technology that is still evolving
• DBs have been developed extensively since
• Requires improvements to ease of use then.
and integration.
Cost • Requires custom development and • Free high-quality databases are available.
integration • Commercial niche DBs can be very expensive.
• Initial network can be launched with
inexpensive hardware. • Inexpensive for small applications.
Hardware • Easily scalable by adding new peers to • But can be very expensive for larger
the network applications with unique requirements.

• Requires extensive access rights and


Collaboration • Emerges naturally from the intrinsic configurations.
design
• Vulnerable to hacking
Demonstration of Blockchain Use
Case
• Alice and Bob want to play chess by mail
• Alice sends Bob “move 1 e4”
• Bob sends back “move 1 ... e5”
• Alice sends Bob “ move 2 Nf3”
• ...
• Each of these messages is one move in the game.
• What’s necessary for them to be able to play the game?
They have to agree on the state of
the board!
• If they don’t agree on the state of the board, they can’t play a game!
• Both know the starting positions of the board.
• Both know the sequence of messages so far.
• Those messages make up a transcript of the game.
• Thus, they can reconstruct the state of the board.

• If we agree on history, we agree on the present state of the world!


What’s that got to do with
blockchain?
• We have some distributed system
• We need to all agree on the state of some system
• We all agree on the initial state of the system
• A blockchain contains a history of individual transactions
• Thus: We can all agree on the current state of the system

• A blockchain lets mutually-distrusting entities agree on


history... ...which lets them agree on the state of the system now.
Why is this important?
• Example: Bitcoin
• Suppose I want to transfer 100 BTC to you.
• You need to know whether my account has 100 BTC in it.
• For that, you need to know the current state of the system.

• Note: You need to know the current state.


• If you’re looking at an old state of the system, I might be paying you with
money I’ve already spent!
What problem does a blockchain
solve?
• A blockchain lets us agree on the state of the system, even if we don’t
all trust each other!
• Ultimate goal: We all need to agree on the state of some system.
• How much BTC in each account?
• Who owns which property?
• What’s the current state of my program?
• We can all agree on that if we agree on history.
• Starting state + history -> current state
• We don’t want a single trusted arbiter of the state of the world.
• We want some level of decentralization—not a single point of failure or
compromise.
Trusted Arbiter (Judge)
• If we had a completely trusted arbiter, we wouldn’t need a
blockchain!
• We could just define reality as whatever the TA said it was.
• For a payment system, imagine TA as the bank.
• Bank provides the official sequence of transactions and account balances
• When you want to spend your money, you send a message to bank
• Bank permits transaction if you have money, and updates account balances
Why not just have a trusted arbiter,
then?
1. Single point of failure
• If the TA goes down for a week, the system stops working!
2. Concentration of power.
• “He who controls the past, controls the future”.
• TA can censor transactions, impose new conditions to get transactions
included in history, etc.
3. Maybe there’s nobody we all trust
So what does a blockchain buy us,
again?
• Distributed system
• We don’t all trust each other or any single entity
• We want to agree on history
• ... so we can agree on the state of our system...
• ... so we can do something.

• We get the functionality of a trusted arbiter... ...without needing a


trusted arbiter
Adding new Blocks to the Chain
• Any blockchain system has to determine who can add new blocks to
the chain, and how it’s done.
• Two main ideas we will discuss:
• Proof of work.
• Permissioned blockchain
Building Blocks: proof of Work
• Want you to do a big computation.
• I want you to prove you did it.
• I don't want to do much work checking the proof.
• Why is this useful?
• Limits the rate of new blocks.
• Makes attempts to add invalid blocks to the chain expensive.
• Provides a clear way to decide between competing chains when there is a
disagreement—the one with the most work wins.

• Note: Not all blockchains use proof of work


Proof of Work versus Proof of Stake
Proof of Work versus Proof of Stake
Practical Byzantine Fault Tolerance
(Hyperledger Fabric)
Byzantine Fault Tolerance Problem
• group of generals, each commanding a portion of the Byzantine army,
encircle a city. These generals wish to formulate a plan for attacking the city.
In its simplest form, the generals must decide only whether to attack or
retreat. Some generals may prefer to attack, while others prefer to retreat.
The important thing is that every general agree on a common decision, for a
halfhearted attack by a few generals would become a rout, and would be
worse than either a coordinated attack or a coordinated retreat.
• If nine generals are voting, four of whom support attacking while four others
are in favor of retreat, the ninth general may send a vote of retreat to those
generals in favor of retreat, and a vote of attack to the rest. Those who
received a retreat vote from the ninth general will retreat, while the rest will
attack.
• The problem is complicated further by the generals being physically
separated and having to send their votes via messengers who may fail to
deliver votes or may forge false votes
Practical Byzantine Fault Tolerance
(Hyperledger Fabric)
1) A client sends a request to the leader node to invoke a service operation.
2) The leader node multicasts the request to the backup nodes.
3) The nodes execute the request and then send a reply to the client.
4) The client awaits f + 1 (f represents the maximum number of nodes that
may be faulty) replies from different nodes with the same result.
5) This result is the result of the operation.
Proof-of-Elapsed-Time
(Hyperledger Sawtooth Lake)
• Each participating node in the network is required to wait for a
randomly chosen time period.
• The first one to complete the designated waiting time wins the new
block.
• Each node in the blockchain network generates a random wait time
and goes to sleep for that specified duration.
• The one to wake up first – that is, the one with the shortest wait time
– wakes up and commits a new block to the blockchain, broadcasting
the necessary information to the whole peer network.
• The same process then repeats for the discovery of the next block.
Proof-of-Elapsed-time
• Two important factors must be enforced and ensured:

1) The participating nodes genuinely select a time that is indeed


random and not a shorter duration chosen purposely by the
participants in order to win;

2) The winner has indeed completed the waiting time.


Why Proof-of-Work?
• Proofs of work solve some problems...
• We can resolve disagreements.
• When chain forks, take fork with most work.
• When there’s a tie, keep working till one of the chains has the most work.
• Discourage people trying to add invalid blocks to chain.
• You spend money (or computations) adding a block to chain...
• ...but if it’s not valid, nobody accepts it.
Proof-of-Work Introduces problems
• Expensive—lots of energy used do generate proofs
• Done by “miners” in Bitcoin
• Use special-purpose mining rigs optimized for doing proofs of work.
• Environmental impact—uses lots of power, accomplishing no useful goal
except keeping blockchain working
• Slow—proof of work seems to put a limit on transaction speed.
• Even more when you consider need to resolve potential disagreements.
• Bitcoin rule of thumb is wait 6 blocks (about an hour) to be sure of
transaction
Permissioned blockchains
• An alternative to proof-of-work.
• We have set of somewhat-trusted entities who can work together to
add records to the blockchain.
• For example, we could have five trustees, and if any 3/5 vote in favor
of accepting a block on the chain, then the block is added.
• Validity condition for adding a block = 3/5 signatures
• Resolution for conflicting chains = look for longest chain (aka most
votes)
• With 3/5 there shouldn’t be any forked chains—someone would have to vote
for two competing blocks!
Incentive Design
• The real genius in Bitcoin’s design is the way incentives are aligned.
• Untrusted, self-interested miners keep the system working
• They have a big incentive to follow the protocol
• They have substantial capital invested in Bitcoin, so they also have an
incentive to avoid any attack that would undermine their investment
• This all works because Bitcoin is all about moving money around, so it’s easy
to build payoffs into the protocol.
• Other blockchains (especially permissioned ones) have to find
alternatives to incentives
• Not so obvious how to build a payoff into a protocol to store medical records
Smart Contracts
• Smart contracts, in simplest terms, are self-executing contracts stored
on a blockchain that automatically execute predefined rules.

• Let's take an insurance company that uses smart contracts to manage


claims. When an insured event occurs, let's say a flight delay, data
from reliable external sources triggers the contract. The smart
contract then automatically validates the claim and triggers a
payment, all without any human intervention!
Components of Smart Contracts
• Every smart contract consists of three key components.
• First, the parties involved in the agreement.
• Secondly, predefined rules and conditions that must be satisfied.
• And thirdly, digital signatures to ensure authenticity and security.
Vending Machine Example
• A smart contract for a vending machine may look something as follows.
• Event: 1 dollar inserted into the machine.
• A smart contract defines one or more events that trigger the contract.
• Condition: A selection is made for a drink that costs 1 dollar or less.
• A smart contract defines one or more conditions that must be met for the actions
to occur. The second condition can be that the selected drink is available in the
machine.
• Action: Dispense the selected drink.
• A smart contract defines one or more actions that are automatically executed once
the conditions are met. These actions cannot be delayed or prevented from
execution. In simple terms, this ensures that you get the drink you paid for without
delay.
Key benefits of Smart Contracts
1. Speed, efficiency and accuracy
Smart contracts are digital and automated. Once conditions are met, the contract is
autonomously executed. You don’t have to waste time on manual tasks.
2. Trust and transparency
Smart contracts don’t require third parties. Everything's out in the open. You can see
and check all transactions.
3. Security
All transactions are encrypted, and can’t be changed.
4. Saving money
Smart contracts don’t require any middlemen or extra fees. This brilliant blend of
autonomy, efficiency, and trust makes smart contracts a revolution in various fields. But
they are not without their challenges.
Smart Contracts Challenges
• Interpretation of smart contracts
Smart contracts are written in code. Everyone involved needs to understand and
agree on what the code means. Sometimes, a tech expert helps explain the code.
But if they get it wrong or if there's a hidden error in the code, the contract might
not work as planned.
• Dependency on outside data
Smart contracts use data from outside the blockchain. This data might be wrong,
missing, or unreliable. If the data's off, the contract might make a wrong move.
• Legal Framework
Not all places treat smart contracts like regular contracts. So, if there's a problem,
you might not be able to take it to court.
Anonymity
• Anonymity is a key feature in Blockchains
• While all your digital footprint is permanently stored, your unique identity is never
disclosed.
• Blockchain uses unique Wallets, or Wallet Addresses. But these unique addresses are
not linked to an individual.

• You are not anonymous when you make a purchase from a grocery store.
Your identity is disclosed when:
• If you use a credit card
• From cameras in and outside the store
Solebound Tokens
• How can we maintain anonymity with things like:
• Education records
• Work experiences
• Professional accomplishments
• Medical records
• Such information are linked to a specific individual
• These represents personal characteristics, and are permanently linked
to a specific individual
• There is typically no monetary value for these characteristics, and
people are not expected to exchange them for other assets.
What are Solebound Tokens
• Solebound represents tokens that are Bound to certain individuals,
hence the name Sole Bound.
• Once assigned to a Wallet address, these tokens can never be
transferred to another wallet. They are permanently bound to that
specific wallet.
• Owners of these tokens cannot sell them, as their ownership cannot
be exchanged
Applications of Solebound Tokens
• Education records
• Your institution can issue a Solebound token to represent your degrees or certification.
• Work experiences
• Work Experience wallet can store tokens from each employer. Collectively, the wallet
can represent your full career records.
• Professional accomplishments
• Completion of a certificate or a program.
• Medical records
• Tokens can store all your test results, doctor visits, and medical history.
• Scores and accomplishments in sports
• Match scores, details of performance in a certain game, etc.
Fiat Currencies
• Fiat currencies are currencies not backed by a commodity
• They are based on trust.
• There is usually unlimited supply of Fiat Currencies
• Fiat currencies exist because it is easier to control money supply

• Crypto can also have unlimited supply, but some have limited supply.
• Crypto is also not backed by a commodity.
• Crypto supply in managed by distributed protocols.
Satoshi Nakamoto
• Satoshi Nakamoto wrote the original white paper in 2008.
• No one knows who he is, and he never came forward to identify
himself.
• Some theories emerged but none is particularly plausible.
• The paper Satoshi Nakamoto wrote “Bitcoin: A Peer-to-Peer Electronic
Cash System” is the assigned reading for this topic.
Where to go from here
• Blockchain is revolutionary
• Trust without trustees
• Decentralization of currency, trade, supply chain, governance, voting, and
more
• Some find Blockchain’s future impact to be similar to the impact DNA
had on life.
• Human's ancestors formed hierarchical societies (Sovereignty is
concentrated).
• Civilizations has consistently evolved through distribution of
sovereignty (typically through democratic institutions).
Summary – 1: Blockchains let us agree
on history
• We don’t have to trust each other
• We don’t have to have a trusted third party
• System is distributed
• Agreeing on history -> agreeing on state of system
Summary – 2: Blockchains and hash
chains
• The Nth record in the hash chain commits to all previous records.
• Can’t change any previous record without making hash chain invalid.
• A blockchain is a hash chain with some other stuff added
Summary – 3: Blockchain protocols
• Many blockchains in use now use proof-of-work
• Many new proposals use permissioned blockchains
• Some set of somewhat-trusted entities
• There are other ways to do it
• Proof of work (Bitcoin)
• Proof of stake (Ethereum)
• Practical Byzantine Fault Tolerance (Hyperledger Fabric)
• Proof of elapsed time (Hyperledger Sawtooth Lake)
• Proof of storage, proof of space, proof of capacity (Burstcoin)
• .. And more..

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy