Introduction to Blockchain
Technology
Tanzila Nargis
Assitant Professor
NMAMIT-Nitte
Overview of Blockchain
•What is blockchain?
•A decentralized computation and information
sharing platform that enables multiple
authoritative domains, who do not trust each
other, to cooperate, coordinate and collaborate
in a rational decision making process.
Microsoft word to Google Doc-
Sharing Information
•Traditional way of sharing documents
Microsoft word to Google Doc-
Sharing Information
•Shared Google Doc- both users can use
simultaneously
Problems with Centralized System
Centralized Vs Decentralized Vs
Distributed
Block chain introduction to the world and how we can utilise it
A Plausibly Ideal Solution
Blockchain-The Internet database to
Support Decentralization
A Very Simplified Look of
Blockchain
A Very Simplified Look of
Blockchain
An example of Public Ledger from
Banking Sector
An example of Public Ledger from
Banking Sector
An example of Public Ledger from
Banking Sector
An example of Public Ledger from
Banking Sector
An example of Public Ledger from
Banking Sector
An example of Public Ledger from
Banking Sector
An example of Public Ledger from
Banking Sector
Blockchains and Public Ledgers
Formal definition of Blockchain
Bitcoin and Blockchain
What is Bitcoin?
The Technology behind Bitcoin-The
Blockchain
The Bitcoin Transaction Life Cycle-
The Sender
The Bitcoin Transaction Life Cycle-
The Network
The Bitcoin Transaction Life Cycle-
The Miners
The Bitcoin Transaction Life Cycle-
The Receiver
Smart Contracts
Contracts in a Centralized Platform-
Crowdfunding
The Crowdfunding Platform
Crowdfunding Platform using
Smart Contracts
Crowdfunding Platform using
Smart Contracts
Crowdfunding Platform using
Smart Contracts
Smart Contracts- The Advantages
Smart Contract Platforms
The Block in a Blockchain- Securing
data Cryptographically
Structure of a Block
Structure of a Block (Reference: Bitcoin)
Block Header(Reference: Bitcoin)
Block Header(Reference: Bitcoin)
Block Header(Reference: Bitcoin)
Block Header(Reference: Bitcoin)
The Hashes in Block header (Reference:Bitcoin)
Transactions in a Block (Reference:
Bitcoin)
Transactions in a Block (Reference:
Bitcoin)
The Block in a Blockchain- The
Summary
The Blockchain Replicas
Distributed Consensus
Distributed Consensus
Distributed Consensus
Challenge-Response to Permission-
less Consensus
•The challenge-response protocol: The nodes in the network tries to
solve the challenge posed by the network
– The nodes or the participants do not need to reveal their identity
•The node that is able to solve the challenge first, would get to dictate
what the next set of data or state elements to be added should be
•This will continue iteratively at different rounds
Challenge-Response to Permission-
less Consensus
•Design of a good challenge – ensures that
different nodes will win the challenge at
different runs.
•This ensures that no node would be able to
control the network
•The Bitcoin Proof of Work (PoW) algorithm –
ensures consensus over a permission-less
setting based on challenge-response
The Economics Behind Blockchain
Consensus
• The challenge response requires that every node
spend large amount of computational power to
solve a mathematical challenge in eacg iteration of
consensus
• What is the incentive for nodes? Only one or
sometimes very few will win in each round
The Economics Behind Blockchain
Consensus
•The Digital Money
–Ensures operational efficiency
–More levels of controlling monetary policy
•1998: Wei Dai published ‘b-money’ – an
anonymous distributed cash system
•Cryptocurrency – a currency beyond the
control of banks and governments
The Economics Behind Blockchain
Consensus
•The mining ensures that no node has the power
to sabotage the network and gain control
–No one can hold the control of the cryptocurrency
•The computational effort expended by the
nodes in achieving consensus would be paid for
by cryptocurrency generated and managed by
the network
•Blockchain ensures that the currency is secure
and tamper-proof
In Summary
•The Technology behind Blockchain
–The Data Structure – Distributed Ledger
–Cryptography and Digital Signatures – Ensure
security and tamper-proof architecture
–The Consensus over a Permission-less Environment
–The Economy of the Revenue Model – Encourages
participants to join in the mining procedure
Public vs Private Blockchain
The Permission-less Model (Public)
•Works in an open environment and over a large
network of participants
•The users do not need to know the identity of
the peers, and hence the users do not need to
reveal their identity to others
•Good for financial applications like banking
using cryptocurrency
Privacy and Security
•The system is tamper-proof – it is “extremely
hard” to make a change in the blockchain
–Tampering the system becomes harder as the chain
grows
•For Bitcoin, the transactions are pseudo-
anonymous
–Transactions are sent to public key addresses,-
cryptographically generated addresses, computed by
the wallet applications
Peer Adresses
•“Address” in bitcoin is synonymous to an
“Account” in a bank.
•The wallet listens for transactions addressed to
an account,
–Encrypts the transactions by the public key of the
target address
–Only the target node can decrypt the transaction
and accept it
•However, the actual transaction amount is open
to all for validation
Blockchain (at Permission-less
Model) as a Tree
Accepting the Longest Chain
Accepting the Longest Chain
Accepting the Longest Chain
Accepting the Longest Chain
Orphaned Blocks
The Cryptocurrency Applications
using Blockchain
The Cryptocurrency Applications
using Blockchain
The Permissioed (Private) Model –
Blockchain 2.0
•Blockchain can be applied just beyond
cryptocurrency
•The underlying notions of consensus, security
and distributed replicated ledgers can be applied
to even closed or permissioned network
settings
•Most enterprise use cases only involve a few
ten to a few hundred known participants
Permissioned Blockchain
•Can leverage the 30+ years of technical
literature to realize various benefits like
–Strict notion of security and privacy
–Greater transactional throughput based on the
traditional notions of distributed consensus
• Raft Consensus
• Paxos Consensus
• Byzantine Fault Tolerance (BFT) algorithms
Permissioned Blockchain
Applications
Permissioned Blockchain
Applications
•Provenance tracking - tracking the origin and
movement of high-value items across a supply
chain, such as luxury goods, pharmaceuticals,
cosmetics and electronics.
–When the high-value item is created, a
corresponding digital token is issued by a trusted
entity, which acts to authenticate its point of origin.
Every time the physical item changes hands, the digital token
is moved in parallel -> the real-world chain of custody is
precisely mirrored by a chain of transactions on the
blockchain.
The token is acting as a virtual “certificate of authenticity”,
which is far harder to steal or forge than a piece of paper.
The Blockchain Based Distributed
Web
Interplanetary file is a web architecture, combines small storage
available to users as large storage. The idea is whatever data was there
in the storage is available to all the users, who are connected to the
system.
The original data is with the user and you just give the pointer to the
other users or the replica of the data to the other users. So in this way
IPFS provides high availability of the services and avoids duplication of
the files
How IPFS Works
•Each file and all of the blocks within it are given
a unique fingerprint based on a cryptographic
hash
•IPFS removes duplications across the network
and track version history for every file
•Each network node stores only the content it is
interested in and some indexing information
that helps to figure out who is storing what
How IPFS Works
•When looking up files, you ask the network to
find nodes storing the content behind a unique
hash
•Every file can be found by human readable
names using a decentralized naming system
called IPNS
Hyperledger Fabric
•A permissioned blockchain framework that
provides an enterprise-grade foundation for
transactional applications
•A shared ledger that supports smart contracts –
ensures security and integrity of recorded
transactions
•Unlike Bitcoin and Ethereum, Hyperledger
Fabric supports privacy and confidential
transactions
Hyperledger Fabric
•Fabric supports the notion of channels, a
“subnet” of peers within the network that wants
to share information confidentially
–Gives restricted visibility - important for business
applications
•Fabric has no notion of mining, use the notion
of distributed consensus under a closed
environment
The Fabric Network
Summary
•Two models of Blockchain network –
Permission-less (an open environment) and
Permissioned (a close environment)
•Permission-less model is suitable for open
control-free financial applications like
cryptocurrency
•Permissioned model is suitable for business
applications like smart contract
Bitcoin – The Beginning
•“A decentralized digital currency enables
instant payments to anyone, anywhere in the
world” – en.bitcoin.it
•No central authority, uses peer-to-peer
technology
•Two broad operations Transaction
Management – transfer of bitcoins from one
user to another
•Money Issuance – regulate the monetary base
The Creation of Coins
•Controlled Supply: Must be limited for the
currency to have value – any maliciously
generated currency needs to be rejected by the
network
•Bitcoins are generated during the mining –
each time a user discovers a new block
•The rate of block creation is adjusted every
2016 blocks to aim for a constant two week
adjustment period
Creation of Blocks
•The number of bitcoins generated per block is
set to decrease geometrically, with a 50%
reduction for every 210,000 blocks, or
approximately 4 years
•This reduces, with time, the amount of bitcoins
generated per block
•Theoretical limit for total bitcoins: Slightly less
than 21 million
•Miners will get less reward as time progresses
•How to pay the mining fee – increase the
Block chain introduction to the world and how we can utilise it
Payments
•Need to ensure that Eve cannot spend Alice’s
bitcoins by creating transactions in her name.
•Bitcoin uses public key cryptography to make
and verify digital signatures.
•Each person has one or more addresses each
with an associated pair of public and private
keys (may hold in the bitcoin wallet)
Sending Payments
•Alice wish to transfer some bitcoin to Bob. Alice
can sign a transaction with her private key
•Anyone can validate the transaction with Alice’s
public key
Sending Payments
•Alice wants to send bitcoin to Bob Bob sends
his address to Alice
•Alice adds Bob’s address and the amount of
bitcoins to transfer in a “transaction” message
•Alice signs the transaction with her private key,
and announces her public key for signature
verification
•Alice broadcasts the transaction on the Bitcoin
network for all to see
Double Spending
•Same bitcoin is used for
more than one
transactions
•In a centralized system,
the bank prevents double
spending
•How can we prevent
double spending in a
decentralized network?
Handle Double Spending using
Blockchain
•Details about the transaction are sent and
forwarded to all or as many other computers as
possible
•Use Blockchain – a constantly growing chain of
blocks that contain a record of all transactions
•The blockchain is maintained by all peers in the
Bitcoin network – everyone has a copy of the
blockchain
Handle Double Spending using
Blockchain
•To be accepted in the chain, transaction blocks
must be valid and must include proof of work –
a computationally difficult hash generated by
the mining procedure
•Blockchain ensures that, if any of the block is
modified, all following blocks will have to be
recomputed
Handle Double Spending using
Blockchain
•When multiple valid continuation to this chain
appear, only the longest such branch is accepted
and it is then extended further (longest chain)
•Once a transaction is committed in the
blockchain, everyone in the network can
validate all the transactions by using Alice’s
public address
•The validation prevents double spending in
bitcoin
Bitcoin Anonymity
•Bitcoin is permission-less, you do not need to
setup any “account”, or required any e-mail
address, user name or password to login to the
wallet
•The public and the private keys do not need to
be registered, the wallet can generate them for
the users
•The bitcoin address is used for transaction, not
the user name or identity
Bitcoin Anonymity
•A bitcoin address mathematically corresponds
to a public key based on ECDSA – the digital
signature algorithm used in bitcoin
•A sample bitcoin address:
1PHYrmdJ22MKbJevpb3MBNpVckjZHt89hz
•Each person can have many such addresses,
each with its own balance Difficult to know
which person owns what amount
Bitcoin Scripts
•Alice makes a transaction of BTC 20 to Bob.
How Bob will claim those transactions?
•A transaction is characterized by two
parameters Alice sends some bitcoins: the
output (out) of the transaction
•Bob receives some bitcoins: the input (in) of
the transaction
•We need to determine that a transaction input
correctly claims a transaction output
Bitcoin Scripts
•A programming language to validate bitcoin
transactions A list of instructions recorded with
each transaction
•Describes how the next person can gain access
to the bitcoins, if that person wants to spend
them
•FORTH-like language, stack based and
processed left to write
How FORTH Works?
•A stacked based computer programming
language originally designed by Charles Moore A
procedural programming language without type
checking
•Use a stack for recursive subroutine execution
•Uses reverse Polish notation (RPN) or postfix
notation
FORTH – Sample Execution using
RPN
FORTH – Sample Execution using
RPN
FORTH – Sample Execution using
RPN
FORTH – Sample Execution using
RPN
FORTH – Sample Execution using
RPN
FORTH – Sample Execution using
RPN
FORTH Sample code
Bitcoin Transactions and Input and
Output
Bitcoin Scripts – A Simple Example
Bitcoin Scripts – A Simple Example
Bitcoin Scripts – A Simple Example
Bitcoin Scripts – A Simple Example
Bitcoin Scripts – A Simple Example
Bitcoin Scripts
Bitcoin Scripts
•With every transaction Alice must provide
–A public key that, when hashed, yields the
address of Alice embedded in the script
–A signature to provide ownership of the private
key corresponding to the public key of Alice
Bitcoin Scripts
Bitcoin Scripts
Bitcoin Scripts
Bitcoin Scripts
Bitcoin Scripts
Bitcoin Scripts
Bitcoin Scripts
Bitcoin Scripts
Bitcoin Script Instructions
•Total 256 opcodes (15 disabled, 75 reserved)
•Arithmetic operations
•if-then conditions
•Logical operators
•Data handling (like OP_DUP)
•Cryptographic operations
Hash functions
Signature verification
Multi-signature verification
Interesting Bitcoin Scripts
Bitcoin P2P Network
•An ad-hoc network with random topology,
Bitcoin protocol runs on TCP port 8333
•All nodes (users) in the bitcoin network are
treated equally
•New nodes can join any time, non-responding
nodes are removed after 3 hours
Joining in a Bitcoin P2P Network
Joining in a Bitcoin P2P Network
Joining in a Bitcoin P2P Network
Joining in a Bitcoin P2P Network
Joining in a Bitcoin P2P Network
• It is a overly network with virtual links or peer to
peer links between neighbors
• The newly joining node asks for the address list.
• There are certain nodes in the network which act
as seed nodes
• The seed nodes provides the information or
address list to the newly joining node
• Once you get the address list establish the
connection with the peers
• The new node then receives the currently updated
blockchain from the neighboring peers to maintain
it as a local copy
• Apply 50% rule to accept the longest chain. i.e the
same blockchain received from the majority of the
peers
Transaction in a Bitcoin Network
•Alice joins the Bitcoin network by opening her
applet
•Alice makes a transaction to Bob: A->B: BTC 10
•Alice includes the scripts with the transactions
•Alice broadcasts this transaction in the Bitcoin
network
Transaction Flooding in a Bitcoin
Network
Transaction Flooding in a Bitcoin
Network
Transaction Flooding in a Bitcoin
Network
Transaction Flooding in a Bitcoin
Network
Transaction Flooding in a Bitcoin
Network
Which Transactions Should You
Relay?
•The transaction is valid with current blockchain
No conflict
No double spending
•The script matches with a pre-given set of
whitelist scripts – avoid unusual scripts, avoid
infinite loops
•Does not conflict with other transactions that I
have relayed after getting the blockchain
updated – avoid double spending
Mining in a Bitcoin Network
Block Generation Puzzle
Block Generation
Block Flooding
Block Propagation
Block Propagation – Accept the
Longest Chain
Block Propagation – Accept One of
the Longest Chain
Which Block to Relay
•Block contains the correct hash based on the
existing blockchain
•All the transactions inside the block are valid
Check the scripts
•Validate with the existing blockchain
•The block is included in the current longest
chain Do not relay the forks
Working with consensus in
Bitcoin
Consensus
•A procedure to reach in a
common agreement in a
distributed or
decentralized multi-agent
platform
•Important for a message
passing system
Why Consensus
•Reliability and fault tolerance in a distributed
system
- Ensure correct operations in the presence of
faulty individuals
Example:
•Commit a transaction in a database
•State machine replication
•Clock synchronization
Why Consensus Can be Difficult in
Certain Scenarios
•Consider a message passing system, and a
general behaves maliciously
Distributed Consensus
Distributed Consensus
•There can be various types of faults in a
distributed system.
•Crash Fault: A node suddenly crashes or
becomes unavailable in the middle of a
communication
•Network or Partitioned Faults: A network fault
occurs (say the link failure) and the network gets
partitioned
•Byzantine Faults: A node starts behaving
maliciously
Distributed Consensus - Properties
•Termination: Every correct individual decides
some value at the end of the consensus protocol
•Validity: If all the individuals proposes the same
value, then all correct individuals decide on that
value
•Integrity: Every correct individual decides at
most one value, and the decided value must be
proposed by some individuals
•Agreement: Every correct individual must agree
on the same value
Synchronous vs Asynchronous
Systems
•Synchronous Message Passing System: The
message must be received within a predefined
time interval
- Strong guarantee on message transmission
delay
•Asynchronous Message Passing System: There
is no upper bound on the message transmission
delay or the message reception time
-No timing constraint, message can be delayed
for arbitrary period of times
Asynchronous Consensus
Synchronous Consensus
Correctness of a Distributed
Consensus Protocol
Consensus in an Open System
Why Do We Require Consensus in
Bitcoin Network
Why Do We Require Consensus in
Bitcoin Network
Consensus in a Bitcoin Network
•Every node has block of transactions that has
already reached into the consensus (block of
committed transactions)
•The nodes also has a list of outstanding
transactions that need to be validated against
the block of committed transactions
Consensus in a Bitcoin Network
Consensus in Bitcoin
Consensus in Bitcoin
Consensus in Bitcoin
Consensus in Bitcoin
Consensus in Bitcoin
Consensus in Bitcoin
Consensus in Bitcoin
Consensus in Bitcoin
Consensus in Bitcoin
Consensus in Bitcoin
Consensus in Bitcoin
Proof of Work (Pow)
Proof of Work (PoW) Features
Cryptographic Hash as the PoW
•Use the puzzle friendliness property of
cryptographic hash function as the work
- Given and , find out , such that
𝑋 𝑌 𝑘
=H( || )
𝑌 𝑋 𝑘
- It is difficult (but not infeasible) to find such 𝑘
- However, once you have a , you can easily
𝑘
verify the challenge
•Used in Hashcash, a proof of work that can be
added with an email as a “good-will” token
Hashcash PoW
Hashcash PoW
Hashcash PoW – Sender Side
Hashcash PoW – Recipient Side
Hashcash PoW
Bitcoin Proof of Work System
Bitcoin Proof of Work System
Block chain introduction to the world and how we can utilise it
Block chain introduction to the world and how we can utilise it
Attacks on PoW
•The blockchain together contain a large amount
of work
- The attacker needs to perform more work to
tamper the blockchain
-This is difficult with the current hardware
Double Spending Problem
The attack: Successful use of the same fund
twice
- A transaction is generated with BTC10 to both
Bob and Carol at the same time
•The solution: The transactions are irreversible
(computationally impractical to modify)
•Every transaction can be validated against the
existing blockchain
Sybil Attacks
•Attacker attempts to fill the network with the
clients under its control Refuse to relay valid
blocks
•Relay only attacked blocks – can lead to double
spending
•Solution: Diversify the connections – Bitcoin
allows outbound connection to one IP per /16
(a.b.0.0) IP address
Denial of Service (DoS) Attacks
•Send lot of data to a node – they will not be
able to process normal Bitcoin transactions
Solutions: No forwarding of orphaned blocks
•No forwarding of double-spend transactions
•No forwarding of same block or transactions
•Disconnect a peer that sends too many
messages
•Restrict the block size to 1 MB
•Limit the size of each script up to 10000 bytes
Breaking Bitcoin PoW
•Bitcoin PoW is computationally difficult to
break, but not impossible
•Attackers can deploy high power servers to do
more work than the total work of the blockchain
The Monopoly Problem
-Miners having more resources have more
probability to complete the work
•Monopoly can increase over time (Tragedy of
the Commons)
- Miners will get less reward over time
- Users will get discouraged to join as the miner
- Few miners with large computing resources
may get control over the network
•PoW depends on the computing resources
available to a miner
Handling Monopoly and Power
Consumption - Proof of Stake
(PoS)
Proof of Stake (PoS)
•Provides increased protection
- Executing an attack is expensive, you need
more Bitcoins
- Reduced incentive for attack – the attacker
needs to own a majority of bitcoins – an attack
will have more affect on the attacker
•Variants of “stake”
- Randomization in combination of the stake (used in Nxt and
BlackCoin)
- Coin-age: Number of coins multiplied by the number of
days the coins have been held (used in Peercoin)
Proof of Burn (PoB)
•Miners should show proof that they have
burned some coins
- Sent them to a verifiably un-spendable address
-Expensive just like PoW, but no external
resources are used other than the burned coins
•PoW vs PoB – Real resource vs virtual/digital
resource
•PoB works by burning PoW mined
cryptocurrencies
PoW vs PoS vs PoB
PoW
•Do some work to mine a new block
•Consumes physical resources, like CPU power
and time
•Power hungry
•PoS
•Acquire sufficient stake to mine a new block
•Consumes no external resource, but participate
in transactions
•Power efficient
PoW vs PoS vs PoB
PoB
•Burn some wealth to mine a new block
•Consumes virtual or digital resources, like the
coins
•Power efficient
Proof of Elapsed Time (PoET)
•Proposed by Intel, as a part of Hyperledger
Sawtooth – a blockchain platform for building
distributed ledger applications
•Basic idea:
• Each participant in the blockchain network
waits a random amount of time
•The first participant to finish becomes the
leader for the new block
PoET over Trusted Environments
•How will one verify that the proposer has really
waited for a random amount of time?
-Utilize special CPU instruction set – Intel
Software Guard Extension (SGX) – a trusted
execution platform
- The trusted code is private to the rest of the
application
- The specialized hardware provides an
attestation that the trusted code has been set up
correctly
The Life of a Miner
•Validate transactions and construct a block
•Use hash power to vote on consensus and
commit transactions with a new block
•Store and broadcast the blockchain to the peers
Mining Bitcoins
•Join the network and listen for transactions –
validate the proposed transactions
•Listen for new blocks – validate and re-
broadcast a new block when it is proposed
•Collect transactions for a predefined time and
construct a new block
•Find a nonce to make the new block valid
•Broadcast the new block – everybody accepts it
if it is a part of the main chain
•Earn the reward for participating in the mining
Mining Difficulty
•A measure of how difficult it is to find a hash
below a given target
- Bitcoin network has a global block difficulty
- Mining pools also have a pool-specific share
difficulty
•The difficulty changes for every 2016 blocks
-Desired rate – one block each 10 minutes
-Two weeks to generate 2016 blocks
- The change in difficulty is in proportion to the
amount of time over or under two weeks the
Setting the Difficulty
•Compute the following for every two weeks
current_difficulty = previous_difficulty *
(2 weeks in milliseconds)/(milliseconds to
mine last 2016 blocks)
Hash-rate versus Difficulty
•The hash is a random number between 0 and
2256-1
-To find a block, the hash must be less than a
given target
•The offset for difficulty 1 is 0xffff * 2208
•The offset for difficulty D is 0xffff * 2208
/D
•The expected number of hashes we need to
calculate to find a block with difficulty D is (D *
2256
) / (0xffff * 2208
)
Mining Hardware
Specialized hardware
- GPU
- FPGA
•ASIC
- Released in 2013
- Fast computation of
SHA256
TerraMiner IV
•ASIC based bitcoin mining
rig
•2 Terahash per second
•Cost: USD 3500 approx
Mining Pool
•Pooling of resources by
the miners
•–Share the processing
power over a network to
mine a new block
•–Split the reward
proportionally to the
amount of work they
contributed
Hash-rate Distribution:
blockchain.info
Mining Pool Methods
•Contains hundreds or thousands of miners
through special protocols
•𝐵: Block reward minus pool fee
•𝑝: Probability of finding a block in a share
attempt ( =1/ ), is the block difficulty
𝑝 𝐷 𝐷
Mining Pool Methods
•Pay per Share (PPS)
-Instant guaranteed payout to a miner
- Miners are paid from pool’s existing balance,
share of a miner is = ×
𝑅 𝐵 𝑝
- Miners get almost equal payment, risk is at the
pool operator
Mining Pool Methods
•Proportional Miners earn share until the pool
finds a block (end of mining round)
•𝑅= × / , where is amount of his own
𝐵 𝑛 𝑁 𝑛
share, and is amount of all shares in the
𝑁
round
•Payments are made once a pool finds out a
block
Mining Pool Methods
Pay per Last N Share (PPLNS)
•Similar to proportional
•Miner’s reward is calculated on the basis of N
last shares
•Miners get more profit for a short round
Mining Pools – Pros and Cons
Pros
•Small miners can participate
•Predictable mining
Cons
• Leads to centralization
•Discourages miners for running complete
mining procedure
Summary – Permissionless
Blockchain and Bitcoin
•The permissionless or open model of
blockchain – any user can join the network and
participate in transactions
-Bitcoin is developed on this principle
•The blockchain provides the backbone of the
permissionless digital currency
- Provides a decentralized architecture
- Tamper-proof through hash-chain
•Miners ensures the consensus in the system

More Related Content

PPTX
Block chain introduction to the world and how we can utilise it
PPTX
BLOCKCHAIN
PDF
Blockchain and BPM - Reflections on Four Years of Research and Applications
PPTX
Understanding Blockchain
PPTX
Blockchain and Bitcoin
PPTX
Blockchain Security and Demonstration
PPTX
Blockchain
PPTX
UNITy8 human computer interac5ion-1.pptx
Block chain introduction to the world and how we can utilise it
BLOCKCHAIN
Blockchain and BPM - Reflections on Four Years of Research and Applications
Understanding Blockchain
Blockchain and Bitcoin
Blockchain Security and Demonstration
Blockchain
UNITy8 human computer interac5ion-1.pptx

Similar to Block chain introduction to the world and how we can utilise it (20)

PPTX
Blockchain Basics
PDF
The presentation on the Blockchain_Introduction_KR.pdf
PDF
Introduction to Blockchain and Smart Contracts
PDF
Blockchain As An Enabler_16 July 2016_David Lee_Final
PPTX
Blockchain English
PPTX
Blockchain (1).pptx
PPTX
Introduction to Blockchain ..................
PPTX
module-1.pptx
PPTX
BlockChain-1.pptx
PPTX
Block chain fundamentals and hyperledger
PPTX
Blockchain.pptx
PDF
Blockchain and Decentralization
PPTX
BLOCK CHAIN technology for the students.
PPTX
BlockChain (1).pptxbhbhbhhbhjbhbhgghbhjbhhg
PDF
Blockchain Fundamental_KIPMI_2022.02.26.pdf
PPTX
BlockChain-1.pptx
PDF
Blockchain technology.pptx
PDF
Block chains and crypto currencies - introduction
PPT
new Class-Module 1.ppt
PPT
block chain Class-Module 1 (1).ppt
Blockchain Basics
The presentation on the Blockchain_Introduction_KR.pdf
Introduction to Blockchain and Smart Contracts
Blockchain As An Enabler_16 July 2016_David Lee_Final
Blockchain English
Blockchain (1).pptx
Introduction to Blockchain ..................
module-1.pptx
BlockChain-1.pptx
Block chain fundamentals and hyperledger
Blockchain.pptx
Blockchain and Decentralization
BLOCK CHAIN technology for the students.
BlockChain (1).pptxbhbhbhhbhjbhbhgghbhjbhhg
Blockchain Fundamental_KIPMI_2022.02.26.pdf
BlockChain-1.pptx
Blockchain technology.pptx
Block chains and crypto currencies - introduction
new Class-Module 1.ppt
block chain Class-Module 1 (1).ppt
Ad

Recently uploaded (20)

PDF
Comprehensive Lecture on the Appendix.pdf
PDF
The TKT Course. Modules 1, 2, 3.for self study
PPTX
Macbeth play - analysis .pptx english lit
PDF
Nurlina - Urban Planner Portfolio (english ver)
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
Laparoscopic Colorectal Surgery at WLH Hospital
PDF
International_Financial_Reporting_Standa.pdf
PPTX
UNIT_2-__LIPIDS[1].pptx.................
PDF
Everyday Spelling and Grammar by Kathi Wyldeck
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
Climate and Adaptation MCQs class 7 from chatgpt
PDF
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
PPTX
Thinking Routines and Learning Engagements.pptx
PDF
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2015).pdf
PDF
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI Syllabus.pdf
PDF
Farming Based Livelihood Systems English Notes
PPTX
Climate Change and Its Global Impact.pptx
PPTX
Education and Perspectives of Education.pptx
Comprehensive Lecture on the Appendix.pdf
The TKT Course. Modules 1, 2, 3.for self study
Macbeth play - analysis .pptx english lit
Nurlina - Urban Planner Portfolio (english ver)
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
Laparoscopic Colorectal Surgery at WLH Hospital
International_Financial_Reporting_Standa.pdf
UNIT_2-__LIPIDS[1].pptx.................
Everyday Spelling and Grammar by Kathi Wyldeck
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
Climate and Adaptation MCQs class 7 from chatgpt
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
Thinking Routines and Learning Engagements.pptx
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2015).pdf
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI Syllabus.pdf
Farming Based Livelihood Systems English Notes
Climate Change and Its Global Impact.pptx
Education and Perspectives of Education.pptx
Ad

Block chain introduction to the world and how we can utilise it

  • 1. Introduction to Blockchain Technology Tanzila Nargis Assitant Professor NMAMIT-Nitte
  • 2. Overview of Blockchain •What is blockchain? •A decentralized computation and information sharing platform that enables multiple authoritative domains, who do not trust each other, to cooperate, coordinate and collaborate in a rational decision making process.
  • 3. Microsoft word to Google Doc- Sharing Information •Traditional way of sharing documents
  • 4. Microsoft word to Google Doc- Sharing Information •Shared Google Doc- both users can use simultaneously
  • 8. A Plausibly Ideal Solution
  • 9. Blockchain-The Internet database to Support Decentralization
  • 10. A Very Simplified Look of Blockchain
  • 11. A Very Simplified Look of Blockchain
  • 12. An example of Public Ledger from Banking Sector
  • 13. An example of Public Ledger from Banking Sector
  • 14. An example of Public Ledger from Banking Sector
  • 15. An example of Public Ledger from Banking Sector
  • 16. An example of Public Ledger from Banking Sector
  • 17. An example of Public Ledger from Banking Sector
  • 18. An example of Public Ledger from Banking Sector
  • 20. Formal definition of Blockchain
  • 22. The Technology behind Bitcoin-The Blockchain
  • 23. The Bitcoin Transaction Life Cycle- The Sender
  • 24. The Bitcoin Transaction Life Cycle- The Network
  • 25. The Bitcoin Transaction Life Cycle- The Miners
  • 26. The Bitcoin Transaction Life Cycle- The Receiver
  • 28. Contracts in a Centralized Platform- Crowdfunding
  • 33. Smart Contracts- The Advantages
  • 35. The Block in a Blockchain- Securing data Cryptographically
  • 36. Structure of a Block
  • 37. Structure of a Block (Reference: Bitcoin)
  • 42. The Hashes in Block header (Reference:Bitcoin)
  • 43. Transactions in a Block (Reference: Bitcoin)
  • 44. Transactions in a Block (Reference: Bitcoin)
  • 45. The Block in a Blockchain- The Summary
  • 50. Challenge-Response to Permission- less Consensus •The challenge-response protocol: The nodes in the network tries to solve the challenge posed by the network – The nodes or the participants do not need to reveal their identity •The node that is able to solve the challenge first, would get to dictate what the next set of data or state elements to be added should be •This will continue iteratively at different rounds
  • 51. Challenge-Response to Permission- less Consensus •Design of a good challenge – ensures that different nodes will win the challenge at different runs. •This ensures that no node would be able to control the network •The Bitcoin Proof of Work (PoW) algorithm – ensures consensus over a permission-less setting based on challenge-response
  • 52. The Economics Behind Blockchain Consensus • The challenge response requires that every node spend large amount of computational power to solve a mathematical challenge in eacg iteration of consensus • What is the incentive for nodes? Only one or sometimes very few will win in each round
  • 53. The Economics Behind Blockchain Consensus •The Digital Money –Ensures operational efficiency –More levels of controlling monetary policy •1998: Wei Dai published ‘b-money’ – an anonymous distributed cash system •Cryptocurrency – a currency beyond the control of banks and governments
  • 54. The Economics Behind Blockchain Consensus •The mining ensures that no node has the power to sabotage the network and gain control –No one can hold the control of the cryptocurrency •The computational effort expended by the nodes in achieving consensus would be paid for by cryptocurrency generated and managed by the network •Blockchain ensures that the currency is secure and tamper-proof
  • 55. In Summary •The Technology behind Blockchain –The Data Structure – Distributed Ledger –Cryptography and Digital Signatures – Ensure security and tamper-proof architecture –The Consensus over a Permission-less Environment –The Economy of the Revenue Model – Encourages participants to join in the mining procedure
  • 56. Public vs Private Blockchain The Permission-less Model (Public) •Works in an open environment and over a large network of participants •The users do not need to know the identity of the peers, and hence the users do not need to reveal their identity to others •Good for financial applications like banking using cryptocurrency
  • 57. Privacy and Security •The system is tamper-proof – it is “extremely hard” to make a change in the blockchain –Tampering the system becomes harder as the chain grows •For Bitcoin, the transactions are pseudo- anonymous –Transactions are sent to public key addresses,- cryptographically generated addresses, computed by the wallet applications
  • 58. Peer Adresses •“Address” in bitcoin is synonymous to an “Account” in a bank. •The wallet listens for transactions addressed to an account, –Encrypts the transactions by the public key of the target address –Only the target node can decrypt the transaction and accept it •However, the actual transaction amount is open to all for validation
  • 67. The Permissioed (Private) Model – Blockchain 2.0 •Blockchain can be applied just beyond cryptocurrency •The underlying notions of consensus, security and distributed replicated ledgers can be applied to even closed or permissioned network settings •Most enterprise use cases only involve a few ten to a few hundred known participants
  • 68. Permissioned Blockchain •Can leverage the 30+ years of technical literature to realize various benefits like –Strict notion of security and privacy –Greater transactional throughput based on the traditional notions of distributed consensus • Raft Consensus • Paxos Consensus • Byzantine Fault Tolerance (BFT) algorithms
  • 70. Permissioned Blockchain Applications •Provenance tracking - tracking the origin and movement of high-value items across a supply chain, such as luxury goods, pharmaceuticals, cosmetics and electronics. –When the high-value item is created, a corresponding digital token is issued by a trusted entity, which acts to authenticate its point of origin.
  • 71. Every time the physical item changes hands, the digital token is moved in parallel -> the real-world chain of custody is precisely mirrored by a chain of transactions on the blockchain. The token is acting as a virtual “certificate of authenticity”, which is far harder to steal or forge than a piece of paper.
  • 72. The Blockchain Based Distributed Web
  • 73. Interplanetary file is a web architecture, combines small storage available to users as large storage. The idea is whatever data was there in the storage is available to all the users, who are connected to the system. The original data is with the user and you just give the pointer to the other users or the replica of the data to the other users. So in this way IPFS provides high availability of the services and avoids duplication of the files
  • 74. How IPFS Works •Each file and all of the blocks within it are given a unique fingerprint based on a cryptographic hash •IPFS removes duplications across the network and track version history for every file •Each network node stores only the content it is interested in and some indexing information that helps to figure out who is storing what
  • 75. How IPFS Works •When looking up files, you ask the network to find nodes storing the content behind a unique hash •Every file can be found by human readable names using a decentralized naming system called IPNS
  • 76. Hyperledger Fabric •A permissioned blockchain framework that provides an enterprise-grade foundation for transactional applications •A shared ledger that supports smart contracts – ensures security and integrity of recorded transactions •Unlike Bitcoin and Ethereum, Hyperledger Fabric supports privacy and confidential transactions
  • 77. Hyperledger Fabric •Fabric supports the notion of channels, a “subnet” of peers within the network that wants to share information confidentially –Gives restricted visibility - important for business applications •Fabric has no notion of mining, use the notion of distributed consensus under a closed environment
  • 79. Summary •Two models of Blockchain network – Permission-less (an open environment) and Permissioned (a close environment) •Permission-less model is suitable for open control-free financial applications like cryptocurrency •Permissioned model is suitable for business applications like smart contract
  • 80. Bitcoin – The Beginning •“A decentralized digital currency enables instant payments to anyone, anywhere in the world” – en.bitcoin.it •No central authority, uses peer-to-peer technology •Two broad operations Transaction Management – transfer of bitcoins from one user to another •Money Issuance – regulate the monetary base
  • 81. The Creation of Coins •Controlled Supply: Must be limited for the currency to have value – any maliciously generated currency needs to be rejected by the network •Bitcoins are generated during the mining – each time a user discovers a new block •The rate of block creation is adjusted every 2016 blocks to aim for a constant two week adjustment period
  • 82. Creation of Blocks •The number of bitcoins generated per block is set to decrease geometrically, with a 50% reduction for every 210,000 blocks, or approximately 4 years •This reduces, with time, the amount of bitcoins generated per block •Theoretical limit for total bitcoins: Slightly less than 21 million •Miners will get less reward as time progresses •How to pay the mining fee – increase the
  • 84. Payments •Need to ensure that Eve cannot spend Alice’s bitcoins by creating transactions in her name. •Bitcoin uses public key cryptography to make and verify digital signatures. •Each person has one or more addresses each with an associated pair of public and private keys (may hold in the bitcoin wallet)
  • 85. Sending Payments •Alice wish to transfer some bitcoin to Bob. Alice can sign a transaction with her private key •Anyone can validate the transaction with Alice’s public key
  • 86. Sending Payments •Alice wants to send bitcoin to Bob Bob sends his address to Alice •Alice adds Bob’s address and the amount of bitcoins to transfer in a “transaction” message •Alice signs the transaction with her private key, and announces her public key for signature verification •Alice broadcasts the transaction on the Bitcoin network for all to see
  • 87. Double Spending •Same bitcoin is used for more than one transactions •In a centralized system, the bank prevents double spending •How can we prevent double spending in a decentralized network?
  • 88. Handle Double Spending using Blockchain •Details about the transaction are sent and forwarded to all or as many other computers as possible •Use Blockchain – a constantly growing chain of blocks that contain a record of all transactions •The blockchain is maintained by all peers in the Bitcoin network – everyone has a copy of the blockchain
  • 89. Handle Double Spending using Blockchain •To be accepted in the chain, transaction blocks must be valid and must include proof of work – a computationally difficult hash generated by the mining procedure •Blockchain ensures that, if any of the block is modified, all following blocks will have to be recomputed
  • 90. Handle Double Spending using Blockchain •When multiple valid continuation to this chain appear, only the longest such branch is accepted and it is then extended further (longest chain) •Once a transaction is committed in the blockchain, everyone in the network can validate all the transactions by using Alice’s public address •The validation prevents double spending in bitcoin
  • 91. Bitcoin Anonymity •Bitcoin is permission-less, you do not need to setup any “account”, or required any e-mail address, user name or password to login to the wallet •The public and the private keys do not need to be registered, the wallet can generate them for the users •The bitcoin address is used for transaction, not the user name or identity
  • 92. Bitcoin Anonymity •A bitcoin address mathematically corresponds to a public key based on ECDSA – the digital signature algorithm used in bitcoin •A sample bitcoin address: 1PHYrmdJ22MKbJevpb3MBNpVckjZHt89hz •Each person can have many such addresses, each with its own balance Difficult to know which person owns what amount
  • 93. Bitcoin Scripts •Alice makes a transaction of BTC 20 to Bob. How Bob will claim those transactions? •A transaction is characterized by two parameters Alice sends some bitcoins: the output (out) of the transaction •Bob receives some bitcoins: the input (in) of the transaction •We need to determine that a transaction input correctly claims a transaction output
  • 94. Bitcoin Scripts •A programming language to validate bitcoin transactions A list of instructions recorded with each transaction •Describes how the next person can gain access to the bitcoins, if that person wants to spend them •FORTH-like language, stack based and processed left to write
  • 95. How FORTH Works? •A stacked based computer programming language originally designed by Charles Moore A procedural programming language without type checking •Use a stack for recursive subroutine execution •Uses reverse Polish notation (RPN) or postfix notation
  • 96. FORTH – Sample Execution using RPN
  • 97. FORTH – Sample Execution using RPN
  • 98. FORTH – Sample Execution using RPN
  • 99. FORTH – Sample Execution using RPN
  • 100. FORTH – Sample Execution using RPN
  • 101. FORTH – Sample Execution using RPN
  • 103. Bitcoin Transactions and Input and Output
  • 104. Bitcoin Scripts – A Simple Example
  • 105. Bitcoin Scripts – A Simple Example
  • 106. Bitcoin Scripts – A Simple Example
  • 107. Bitcoin Scripts – A Simple Example
  • 108. Bitcoin Scripts – A Simple Example
  • 110. Bitcoin Scripts •With every transaction Alice must provide –A public key that, when hashed, yields the address of Alice embedded in the script –A signature to provide ownership of the private key corresponding to the public key of Alice
  • 119. Bitcoin Script Instructions •Total 256 opcodes (15 disabled, 75 reserved) •Arithmetic operations •if-then conditions •Logical operators •Data handling (like OP_DUP) •Cryptographic operations Hash functions Signature verification Multi-signature verification
  • 121. Bitcoin P2P Network •An ad-hoc network with random topology, Bitcoin protocol runs on TCP port 8333 •All nodes (users) in the bitcoin network are treated equally •New nodes can join any time, non-responding nodes are removed after 3 hours
  • 122. Joining in a Bitcoin P2P Network
  • 123. Joining in a Bitcoin P2P Network
  • 124. Joining in a Bitcoin P2P Network
  • 125. Joining in a Bitcoin P2P Network
  • 126. Joining in a Bitcoin P2P Network • It is a overly network with virtual links or peer to peer links between neighbors • The newly joining node asks for the address list. • There are certain nodes in the network which act as seed nodes • The seed nodes provides the information or address list to the newly joining node • Once you get the address list establish the connection with the peers
  • 127. • The new node then receives the currently updated blockchain from the neighboring peers to maintain it as a local copy • Apply 50% rule to accept the longest chain. i.e the same blockchain received from the majority of the peers
  • 128. Transaction in a Bitcoin Network •Alice joins the Bitcoin network by opening her applet •Alice makes a transaction to Bob: A->B: BTC 10 •Alice includes the scripts with the transactions •Alice broadcasts this transaction in the Bitcoin network
  • 129. Transaction Flooding in a Bitcoin Network
  • 130. Transaction Flooding in a Bitcoin Network
  • 131. Transaction Flooding in a Bitcoin Network
  • 132. Transaction Flooding in a Bitcoin Network
  • 133. Transaction Flooding in a Bitcoin Network
  • 134. Which Transactions Should You Relay? •The transaction is valid with current blockchain No conflict No double spending •The script matches with a pre-given set of whitelist scripts – avoid unusual scripts, avoid infinite loops •Does not conflict with other transactions that I have relayed after getting the blockchain updated – avoid double spending
  • 135. Mining in a Bitcoin Network
  • 140. Block Propagation – Accept the Longest Chain
  • 141. Block Propagation – Accept One of the Longest Chain
  • 142. Which Block to Relay •Block contains the correct hash based on the existing blockchain •All the transactions inside the block are valid Check the scripts •Validate with the existing blockchain •The block is included in the current longest chain Do not relay the forks
  • 143. Working with consensus in Bitcoin
  • 144. Consensus •A procedure to reach in a common agreement in a distributed or decentralized multi-agent platform •Important for a message passing system
  • 145. Why Consensus •Reliability and fault tolerance in a distributed system - Ensure correct operations in the presence of faulty individuals Example: •Commit a transaction in a database •State machine replication •Clock synchronization
  • 146. Why Consensus Can be Difficult in Certain Scenarios •Consider a message passing system, and a general behaves maliciously
  • 148. Distributed Consensus •There can be various types of faults in a distributed system. •Crash Fault: A node suddenly crashes or becomes unavailable in the middle of a communication •Network or Partitioned Faults: A network fault occurs (say the link failure) and the network gets partitioned •Byzantine Faults: A node starts behaving maliciously
  • 149. Distributed Consensus - Properties •Termination: Every correct individual decides some value at the end of the consensus protocol •Validity: If all the individuals proposes the same value, then all correct individuals decide on that value •Integrity: Every correct individual decides at most one value, and the decided value must be proposed by some individuals •Agreement: Every correct individual must agree on the same value
  • 150. Synchronous vs Asynchronous Systems •Synchronous Message Passing System: The message must be received within a predefined time interval - Strong guarantee on message transmission delay •Asynchronous Message Passing System: There is no upper bound on the message transmission delay or the message reception time -No timing constraint, message can be delayed for arbitrary period of times
  • 153. Correctness of a Distributed Consensus Protocol
  • 154. Consensus in an Open System
  • 155. Why Do We Require Consensus in Bitcoin Network
  • 156. Why Do We Require Consensus in Bitcoin Network
  • 157. Consensus in a Bitcoin Network •Every node has block of transactions that has already reached into the consensus (block of committed transactions) •The nodes also has a list of outstanding transactions that need to be validated against the block of committed transactions
  • 158. Consensus in a Bitcoin Network
  • 170. Proof of Work (Pow)
  • 171. Proof of Work (PoW) Features
  • 172. Cryptographic Hash as the PoW •Use the puzzle friendliness property of cryptographic hash function as the work - Given and , find out , such that 𝑋 𝑌 𝑘 =H( || ) 𝑌 𝑋 𝑘 - It is difficult (but not infeasible) to find such 𝑘 - However, once you have a , you can easily 𝑘 verify the challenge •Used in Hashcash, a proof of work that can be added with an email as a “good-will” token
  • 175. Hashcash PoW – Sender Side
  • 176. Hashcash PoW – Recipient Side
  • 178. Bitcoin Proof of Work System
  • 179. Bitcoin Proof of Work System
  • 182. Attacks on PoW •The blockchain together contain a large amount of work - The attacker needs to perform more work to tamper the blockchain -This is difficult with the current hardware Double Spending Problem The attack: Successful use of the same fund twice - A transaction is generated with BTC10 to both Bob and Carol at the same time
  • 183. •The solution: The transactions are irreversible (computationally impractical to modify) •Every transaction can be validated against the existing blockchain Sybil Attacks •Attacker attempts to fill the network with the clients under its control Refuse to relay valid blocks •Relay only attacked blocks – can lead to double spending
  • 184. •Solution: Diversify the connections – Bitcoin allows outbound connection to one IP per /16 (a.b.0.0) IP address
  • 185. Denial of Service (DoS) Attacks •Send lot of data to a node – they will not be able to process normal Bitcoin transactions Solutions: No forwarding of orphaned blocks •No forwarding of double-spend transactions •No forwarding of same block or transactions •Disconnect a peer that sends too many messages •Restrict the block size to 1 MB •Limit the size of each script up to 10000 bytes
  • 186. Breaking Bitcoin PoW •Bitcoin PoW is computationally difficult to break, but not impossible •Attackers can deploy high power servers to do more work than the total work of the blockchain
  • 187. The Monopoly Problem -Miners having more resources have more probability to complete the work •Monopoly can increase over time (Tragedy of the Commons) - Miners will get less reward over time - Users will get discouraged to join as the miner - Few miners with large computing resources may get control over the network •PoW depends on the computing resources available to a miner
  • 188. Handling Monopoly and Power Consumption - Proof of Stake (PoS)
  • 189. Proof of Stake (PoS) •Provides increased protection - Executing an attack is expensive, you need more Bitcoins - Reduced incentive for attack – the attacker needs to own a majority of bitcoins – an attack will have more affect on the attacker
  • 190. •Variants of “stake” - Randomization in combination of the stake (used in Nxt and BlackCoin) - Coin-age: Number of coins multiplied by the number of days the coins have been held (used in Peercoin)
  • 191. Proof of Burn (PoB) •Miners should show proof that they have burned some coins - Sent them to a verifiably un-spendable address -Expensive just like PoW, but no external resources are used other than the burned coins •PoW vs PoB – Real resource vs virtual/digital resource •PoB works by burning PoW mined cryptocurrencies
  • 192. PoW vs PoS vs PoB PoW •Do some work to mine a new block •Consumes physical resources, like CPU power and time •Power hungry •PoS •Acquire sufficient stake to mine a new block •Consumes no external resource, but participate in transactions •Power efficient
  • 193. PoW vs PoS vs PoB PoB •Burn some wealth to mine a new block •Consumes virtual or digital resources, like the coins •Power efficient
  • 194. Proof of Elapsed Time (PoET) •Proposed by Intel, as a part of Hyperledger Sawtooth – a blockchain platform for building distributed ledger applications •Basic idea: • Each participant in the blockchain network waits a random amount of time •The first participant to finish becomes the leader for the new block
  • 195. PoET over Trusted Environments •How will one verify that the proposer has really waited for a random amount of time? -Utilize special CPU instruction set – Intel Software Guard Extension (SGX) – a trusted execution platform - The trusted code is private to the rest of the application - The specialized hardware provides an attestation that the trusted code has been set up correctly
  • 196. The Life of a Miner •Validate transactions and construct a block •Use hash power to vote on consensus and commit transactions with a new block •Store and broadcast the blockchain to the peers
  • 197. Mining Bitcoins •Join the network and listen for transactions – validate the proposed transactions •Listen for new blocks – validate and re- broadcast a new block when it is proposed •Collect transactions for a predefined time and construct a new block •Find a nonce to make the new block valid •Broadcast the new block – everybody accepts it if it is a part of the main chain •Earn the reward for participating in the mining
  • 198. Mining Difficulty •A measure of how difficult it is to find a hash below a given target - Bitcoin network has a global block difficulty - Mining pools also have a pool-specific share difficulty •The difficulty changes for every 2016 blocks -Desired rate – one block each 10 minutes -Two weeks to generate 2016 blocks - The change in difficulty is in proportion to the amount of time over or under two weeks the
  • 199. Setting the Difficulty •Compute the following for every two weeks current_difficulty = previous_difficulty * (2 weeks in milliseconds)/(milliseconds to mine last 2016 blocks)
  • 200. Hash-rate versus Difficulty •The hash is a random number between 0 and 2256-1 -To find a block, the hash must be less than a given target •The offset for difficulty 1 is 0xffff * 2208 •The offset for difficulty D is 0xffff * 2208 /D •The expected number of hashes we need to calculate to find a block with difficulty D is (D * 2256 ) / (0xffff * 2208 )
  • 201. Mining Hardware Specialized hardware - GPU - FPGA •ASIC - Released in 2013 - Fast computation of SHA256
  • 202. TerraMiner IV •ASIC based bitcoin mining rig •2 Terahash per second •Cost: USD 3500 approx
  • 203. Mining Pool •Pooling of resources by the miners •–Share the processing power over a network to mine a new block •–Split the reward proportionally to the amount of work they contributed Hash-rate Distribution: blockchain.info
  • 204. Mining Pool Methods •Contains hundreds or thousands of miners through special protocols •𝐵: Block reward minus pool fee •𝑝: Probability of finding a block in a share attempt ( =1/ ), is the block difficulty 𝑝 𝐷 𝐷
  • 205. Mining Pool Methods •Pay per Share (PPS) -Instant guaranteed payout to a miner - Miners are paid from pool’s existing balance, share of a miner is = × 𝑅 𝐵 𝑝 - Miners get almost equal payment, risk is at the pool operator
  • 206. Mining Pool Methods •Proportional Miners earn share until the pool finds a block (end of mining round) •𝑅= × / , where is amount of his own 𝐵 𝑛 𝑁 𝑛 share, and is amount of all shares in the 𝑁 round •Payments are made once a pool finds out a block
  • 207. Mining Pool Methods Pay per Last N Share (PPLNS) •Similar to proportional •Miner’s reward is calculated on the basis of N last shares •Miners get more profit for a short round
  • 208. Mining Pools – Pros and Cons Pros •Small miners can participate •Predictable mining Cons • Leads to centralization •Discourages miners for running complete mining procedure
  • 209. Summary – Permissionless Blockchain and Bitcoin •The permissionless or open model of blockchain – any user can join the network and participate in transactions -Bitcoin is developed on this principle •The blockchain provides the backbone of the permissionless digital currency - Provides a decentralized architecture - Tamper-proof through hash-chain •Miners ensures the consensus in the system