Professional Documents
Culture Documents
Blockchain
Blockchain
Contents
Module A - Blockchain
Module B - Cryptocurrency
CODE EATER
Contents – Module A
Distributed P2P
What is Blockchain?
Networks
Trust
Communication
Story of internet
Internet Transaction
TRUST issues with internet
Internet Transaction
Blockchain - Trust
Disruptive Technology
Instagram - @codeeater21
Internet Communication
Blockchain Trust
Why should I study Blockchain?
Why should I study Blockchain?
Stuart Haber W. Scott Stornetta
What is Blockchain?
Entry
Ledger Book
What is Blockchain?
Entry
What is Blockchain?
Entry
Ledger Book
What is
Blockchain?
Inventors Of Blockchain
Entry
Ledger Book
What is Blockchain?
Blockchain is a distributed immutable ledger which is
completely transparent.
What is Blockchain?
C
A B
C
A B
C
A B
C
A B
C
Applications of
Blockchain
Applications of Blockchain
Coffee
Product Tracking
Scan Barcode
Product Tracking
Product Tracking
Applications of
Blockchain
Smart Contract
A B
Smart Contract
A B
Smart Contract
Smart Contract
If IOT
detected a Yes Cancel delivery
temperature> and do not pay
30 degree to A.
Celsius
No
Note-Assuming
optimum Do delivery and
temperature <30 transfer money to
degree Celsius. A.
International Wire Transfer
Slow Bank
Data
Prev Hash:000000000
Hash:0000D8C42
Block
Hashing Algorithm
Hashing Algorithm
Block No.-1
Data
Prev Hash:000000000
Hash:0000D8C42 Fingerprint
Block
Hashing Algorithm
5819E961F19967B4ECB242
Document, Audio , Video
SHA256 9085E17909CFFD4DCB626
etc.
7D0067F6CAEC22150A7B1
Data
SHA 256
Prev Hash:
Hash:
Hashing Algorithm
Block No.-1
Data
Prev Hash:000000000
Hash:0000D8C42
Block
Hashing Algorithm
The five requirements of Hash Algorithm-
Avalanche
Deterministic ABC 845
Effect
Fast
Computation
Blockchain Formation
Hashing Algorithm
Block No.-1
Data
Prev Hash:000000000
Hash:0000D8C42
Hashing Algorithm
Block No.-1 Block No.-2
Data Data
Data Data
Genesis Block
Immutable Ledger
Immutable Ledger
Maintain Register
A B C D E F
A B
C
A B
C
Instagram - @codeeater21
Server
What is a centralized network?
Client Client
Server
Client Client
What is a centralized network?
Client Client
Server
Client Client
What is a centralized network?
Client Client
Server
Client Client
What is a centralized network?
Client Client
Server
Client Client
Distributed P2P network
B
A
Peer Peer
E
F
Peer
C
Peer
Peer
Distributed P2P network
B
A
Peer Peer
E
F
Peer
C
Peer
Peer
Instagram - @codeeater21
C
Distributed P2P network
A B
C
Distributed P2P network
A B
C
Distributed P2P network
A B
C
Distributed P2P network
A B
C
Distributed P2P network
A B
C
Distributed P2P network
Q)Why we need Distributed P2P network in Blockchain?
Distributed P2P network
A B C D E F
Concept of Immutability
Distributed P2P network
A B
C
Distributed P2P network
A B
C
Distributed P2P network
A B
C
Distributed P2P network
A B
C
Distributed P2P network
A B
C
Instagram - @codeeater21
Transaction Solve Mathematical Miner Solved Miners Verify the Block is added
Problem Problem First Validity
Instagram - @codeeater21
Trust, secure,
How Mining
works: The
Nonce
Blockchain Mining
Transaction Solve Mathematical Miner Solved Miners Verify the Block is added
Problem Problem First Validity
The Nonce
Block No.-
xxx
Prev Hash:
Hash:
The Nonce
Block No.-
xxx
Prev Hash:
Hash:
Hash:
The Nonce
Block No.-
Nonce:
Data:
Prev Hash:
Hash:
The Nonce
Block No.-
Nonce:
Prev Hash:
Hash:
Hash:
The Nonce
Block No.- 6
Nonce:
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23
Hash:
The Nonce
Block No.- 6
Nonce: 23
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23
Hash: 00001ba1
The Nonce
Block No.- 6
Nonce: 50
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23
Hash: 0000fb12
The Nonce
Block No.- 6
Nonce: 3
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23
Hash: 0000acc12
The Nonce
Block No.- 6
Nonce: 1001
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23
Hash: 0000ef23
How Mining
works: The
Nonce
How Mining Works ?
Nonce
Target
How Mining Works ?
Nonce:
➢ The nonce is a number that blockchain miners are solving for.
How Mining Works ?
Target:
➢Target is a number used in mining.
➢It is a number that a block hash must be below for the block to be added on to
the blockchain.
➢The target adjusts every 2016 blocks (roughly two weeks) to try and ensure
that blocks are mined once every 10 minutes on average.
Hashing Algorithm
5819E961F19967B4ECB242
Document, Audio, Video, SHA256 9085E17909CFFD4DCB626
etc. 7D0067F6CAEC22150A7B1
• 0000005432d9f64f6e05c019f9302162100163b6cdba06bd72eee35cd19aebf
Block No.-6
Nonce:
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23
Hash:
How Mining Works ?
All Possible Hashes
Nonce:
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23
Hash:
Smallest
How Mining Works ?
All Possible Hashes
Nonce:
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash:
Smallest
How Mining Works ?
All Possible Hashes
Nonce:100
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: cd19aebf
Smallest
How Mining Works ?
All Possible Hashes
Nonce:76
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: 1da81a0e
Smallest
How Mining Works ?
All Possible Hashes
Nonce: 201
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: b474e220
Smallest
How Mining Works ?
All Possible Hashes
Nonce:512
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: 0000b6aa
Smallest
Blockchain Demo
Is Mining
that easy?
Challenges faced by Miners
Time Electricity
Taking Bills
Start All
Mathematical Over Again
problem solving Attitude
skill
Fast
Computers
What is Mining?
What is mining? Why mining is required? Nonce basics ? None advanced
Why Mining is required?
Byzantine
Generals
Problem
Byzantine Generals Problem
Byzantine Generals Problem
Byzantine Generals Problem
Yellow: Fight
Byzantine Generals Problem
Byzantine Generals Problem
Byzantine Generals Problem
Byzantine Generals Problem
Traitor
Byzantine Generals Problem
Traitor
Byzantine Generals Problem
Traitor
Byzantine Generals Problem
Q) How this Byzantine Fault Tolerance works in
Blockchain?
Instagram - @codeeater21
• Immutable Ledger
• Mining
• Others
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
Q)Is this verification and validation a time taking process ?
Consensus Protocol
Instagram - @codeeater21
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
E
Orphan Block
Orphan Block
Consensus Protocol
A B
C
Consensus Protocol
Note-
• The Consensus Protocol of Blockchain is much better than the
Byzantine Fault Tolerance as Consensus Protocol only needs a 51%
majority while Byzantine Fault Tolerance needs approximately 66%.
•All the transaction in the Orphan Block will be dropped and the
miner that had mined the block will not get any reward.
•So that's why wait for the 6 confirmations before assuming payment
to be successful.
Instagram - @codeeater21
US Economy
History Of Bitcoin
History Of Bitcoin
HISTORY OF
BITCOIN
History Of Bitcoin
TRUST ???
Foolishness of Banks US Government
History Of Bitcoin
Miner
Node
Large Mines Mining Pool
Instagram - @codeeater21
Current Target:
0000000000000000000b3ce90000000000000000000000000000000000000000
19 leading 0's
Understanding Mining Difficulty
Total Possible 64-digits hexadecimal numbers = 16^64 ≃ 10^77
Data
SHA 256
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
=> That there are not enough nonce to generate the valid hash.
Nonce Range
Nonce Range
A modest mines does 10^8 hashes/sec.
4 x 10^9 nonce will be covered in = (4 x 10^9)/(10^8)= 40 seconds.
Q) So what the miners do when all the nonce get exhausted and miners
have not hit the target ?
Timestamp
Recap of Nonce Range
A modest mines does 10^8 hashes/sec.
4 x 10^9 nonce will be covered in = (4 x 10^9)/(10^8)= 40 seconds.
Q) So what the miners do when all the nonce get exhausted and miners
have not hit the target ?
Timestamp
Block No.-1
Nonce:
Data
Prev Hash:000000000
Hash:
Timestamp
Block No.-1
Nonce:
Timestamp: 1622186555
SHA 256
Data
Prev Hash:000000000
Hash:
Timestamp
Block No.-1
Nonce:
Prev Hash:000000000
Hash:
Timestamp
Block No.-1
Nonce:
Timestamp: 1622186556
Data
Prev Hash:000000000
Hash:
Timestamp
Block No.-1
Nonce:
Timestamp: 1622186557
Data
Prev Hash:000000000
Hash:
Timestamp
Block No.-1
Nonce:
Timestamp: 1622186558
Data
Prev Hash:000000000
Hash:
Timestamp
Current hashing rate is equal to 234 million trillion hashes/sec.
Q)What should the miners do in idle time? Should they wait for
timestamp to change?
Instagram - @codeeater21
Q)What should the miners do in idle time? Should they wait for
timestamp to change?
Mempool
Block No.-1
Nonce:
Timestamp:
Transactions:
Prev Hash:000000000
Hash:
Mempool
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
A21ADC Fees:0.002
Timestamp:
B24ABE Fees:0.006
Transactions:
43AFBC Fees:0.007
E23AB2 Fees:0.004
Prev Hash:000000000
F23A6C Fees:0.005 Hash:
Mempool
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
A21ADC Fees:0.002
Timestamp:
B24ABE Fees:0.006
Transactions:
43AFBC Fees:0.007
E23AB2 Fees:0.004
Prev Hash:000000000
F23A6C Fees:0.005 Hash:
Mempool
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
A21ADC Fees:0.002
Timestamp:
B24ABE Fees:0.006
Transactions:
43AFBC Fees:0.007
E23AB2 Fees:0.004
Prev Hash:000000000
F23A6C Fees:0.005 Hash:
Mempool
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
A21ADC Fees:0.002
Timestamp:
B24ABE Fees:0.006
Transactions:
43AFBC Fees:0.007
E23AB2 Fees:0.004
Prev Hash:000000000
F23A6C Fees:0.005 Hash:
Mempool
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
A21ADC Fees:0.002
Timestamp:
B24ABE Fees:0.006
Transactions:
43AFBC Fees:0.007
E23AB2 Fees:0.004
Prev Hash:000000000
F23A6C Fees:0.005 Hash:
Mempool
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
<1s Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 A21ADC Fees:0.002
Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
<1s Transactions:
B24ABE Fees:0.006 43AFBC Fees:0.007
B24ABE Fees:0.006
F23A6C Fees:0.007
F23A6C Fees:0.005
E23AB2 Fees:0.004 D23ABC Fees:0.001
Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.001
Nonce:
Mempool Hash:
How actually mining of transaction
takes place?
FF3ABC Fees:0.0008
Block No.-1
D23ABC Fees:0.0001
Nonce:
Mempool Hash:
CPUs Vs
GPUs Vs
ASCIs
How Mining Works ?
All Possible Hashes
Nonce:
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: cd19aebf
Smallest
How Mining Works ?
All Possible Hashes
Nonce:100
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: cd19aebf
Smallest
How Mining Works ?
All Possible Hashes
Nonce:76
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: 1da81a0e
Smallest
How Mining Works ?
All Possible Hashes
Nonce: 201
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: b474e220
Smallest
How Mining Works ?
All Possible Hashes
Nonce:512
Data:
Kshitij->Rakesh 500 coins
Raj->Bella 200 coins
Prev Hash: 0000AB23 Target('0000')
Hash: 0000b6aa
Smallest
CPUs Vs GPUs Vs ASCIs
GPU< 1 GH/s
DF123
How do Mempool works?(Behind the
scenes)
DF123
How do Mempool works?(Behind the
scenes)
DF123
DF123
DF123 DF123
How do Mempool works?(Behind the
scenes)
DF123
DF123
DF123 DF123
How do Mempool works?(Behind the
scenes)
DF123 DF123
DF123
DF123 DF123
DF123
DF123 DF123
How do Mempool works?(Behind the
scenes)
DF123 DF123
DF123
DF123 DF123
DF123
DF123 DF123
How do Mempool works?(Behind the
scenes)
DF123 DF123 DF123 DF123
DF123
DF123 DF123
DF123
DF123 DF123
How do Mempool works?(Behind the
scenes)
DF123 DF123 DF123 DF123
DF123
DF123 DF123 ABC56
DF123
DF123 DF123
How do Mempool works?(Behind the
scenes)
DF123 DF123 DF123 DF123
DF123
DF123 DF123 ABC56
DF123
DF123 DF123
How do Mempool works?(Behind the
scenes)
DF123 DF123 DF123 DF123
ABC56
DF123
DF123 DF123 ABC56
ABC56
DF123
DF123 DF123
ABC56
How do Mempool works?(Behind the
scenes)
DF123 DF123 DF123 DF123
ABC56
DF123
DF123 DF123 ABC56
ABC56
DF123
DF123 DF123
ABC56
How do Mempool works?(Behind the
scenes)
DF123 DF123 DF123 DF123
ABC56 ABC56
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
DF123 DF123
ABC56 ABC56
How do Mempool works?(Behind the
scenes)
DF123 DF123 DF123 DF123
ABC56 ABC56
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
DF123 DF123
ABC56 ABC56
How do Mempool works?(Behind the
scenes)
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
ABC56 DF123 DF123
ABC56 ABC56
How do Mempool works?(Behind the
scenes)
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
ABC56 DF123 DF123
ABC56 ABC56
How do Mempool works?(Behind the
scenes)
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123 EF123
BBC66 BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123 EF123
BBC66 BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123 EF123
BBC66 BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123 EF123
BBC66 BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123 EF123
BBC66 BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
EF123 EF123 BBC66
BBC66 BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66 EF123
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123 EF123 EF123
BBC66 BBC66 BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
EF123
BBC66
DF123
ABC56 DF123 DF123
EF123 ABC56 ABC56
BBC66
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123
BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123
BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
EF123 EF123
BBC66 BBC66
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
ABC56 DF123 DF123
ABC56 ABC56
DF123 DF123 DF123 DF123
ABC56 ABC56 ABC56 ABC56
DF123
DF123 DF123 ABC56
ABC56 ABC56
DF123
ABC56 DF123 DF123
ABC56 ABC56
Orphaned Blocks
• It does not matter who minded the block first. The only thing that
matters is who has the longest chain.
• Ideally wait for 6 confirmations before considering the
transaction to be successful.
6 confirmations
The 51% Attack
• The 51% attack is not about 51% of the network conspiracy against a single node
as it is practically impossible.
• The 51% attack is about having the control over the hashing power.
The 51% Attack
The 51% Attack
The 51% Attack
The 51% Attack
The 51% Attack
Broadcast
The 51% Attack
Broadcast
The 51% Attack
Broadcast
The 51% Attack
Broadcast
The 51% Attack
Broadcast
Transaction
and UTXOs
Transaction and UTXOs
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC
UTXOs Let say I buy coffee for 0.5 BTC.
Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
Transaction :
Input: Output:
0.5 BTC to the coffee shop.
0.7 BTC from Alice
0.2 BTC back to me.
Transaction and UTXOs
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC
UTXOs Let say I buy coffee for 0.5 BTC.
Alice -> Me 0.7 BTC
Bob -> Me 0.1 BTC
UTXO for the coffee
Transaction : shop.
Input: Output:
0.5 BTC to the coffee shop.
0.7 BTC from Alice
0.2 BTC back to me.
Transaction and UTXOs
Input: Output:
Arjun-> Me 0.4 BTC
Raj -> Me 0.3 BTC 1.4 BTC to the noodles shop.
Alice -> Me 0.7 BTC
Transaction and UTXOs
Transaction :
Input: Output:
0.5 BTC to the coffee shop.
Transaction :
Input: Output:
0.5 BTC to the coffee shop.
Transaction :
Input: Output:
0.5 BTC to the coffee shop.
Block 3
Block 2
Block 1
Cryptocurrency Wallets
Block 4
Block 3
Block 3
1.1 BTC
Me->coffee shop 0.5 BTC
Block 2
Me->Me 0.2 BTC
Message
Verification
Function
Signature
Yes/No
Public Key vs
Bitcoin Address
Private and Public Key
Private Key Public Key
Message
Verification
Function
Signature
Yes/No
Private and Public Key
Bitcoin
Private Key Public Key
Address
Message
Verification
Function
Signature
Yes/No
Segregated
Witness
Segregated Witness
Block No.-1
xxx
Transactions: 6f1d6254d28efe436a89e74d51556
6f1d6254d28efe436a89e74d51556 From: X
1 MB
25adbeb1bfcd5c0256ae11cecf9f9c To: Y
043a718774c572bd8a25adbeae11
Amount: 0.3 BTC
Message
Verification
Function
Signature
Yes/No
Hierarchically Deterministic (HD) Wallets
Master Private
Private Key 1 Public Key 1 Address 1
Key
Hierarchically Deterministic (HD) Wallets
Master Private
Private Key 1 Public Key 1 Address 1
Key
+1
Private Key 2 Public Key 2 Address 2
Hierarchically Deterministic (HD) Wallets
Master Private
Private Key 1 Public Key 1 Address 1
Key
+1
Private Key 2 Public Key 2 Address 2
+2
Private Key 3 Public Key 3 Address 3
Hierarchically Deterministic (HD) Wallets
Master Private
Private Key 1 Public Key 1 Address 1
Key
+1
Private Key 2 Public Key 2 Address 2
+2
Private Key 3 Public Key 3 Address 3
+3
Private Key 4 Public Key 4 Address 4
Hierarchically Deterministic (HD) Wallets
Master Private
Private Key 1 Public Key 1 Address 1
Key
+1
Private Key 2 Public Key 2 Address 2
+2
Private Key 3 Public Key 3 Address 3
+3
Private Key 4 Public Key 4 Address 4
Ethereum
Contents – Module C
What is Ethereum? EVM and Gas DAO Attack
Ethereum
What is Ethereum?
Blockchain
Technology
C
Types of Nodes
Full Node
Light Node
Archive Node
Full Node
• Stores full blockchain data (although this is periodically pruned
so a full node does not store all state data back to genesis)
• All states can be derived from a full node (although very old states are reconstructed
from requests made to archive nodes)
Light Node
• Stores only the block header and depends on full node.
Externally Owned
Account(EOA)
Contract Account(CA)
Externally Owned Account(EOA)
Send
Transaction
Receive
Transaction
Balance:
1 Ether
Smart
Contract
Private Key Wallet
Contract Account (CA)
• Controlled by contract code.
EOA VS CA
EOA CA
Private Key is needed No private or public key is needed.
Nonce:
Timestamp:
Transactions:
D67F232
Prev Hash:000000000
Hash:
Smart Contract
Smart Contract
Each node has the following-:
Client
Client E
F
Server
C
Client
Client
Decentralized Apps(Dapps)
A B
C
A B
C
Decentralized Apps(Dapps)
Decentralized Network
Social Media
Video Platform
Decentralized Apps(Dapps)
Centralized Apps Decentralized Apps
Censorship No censorship
C
A B
C
Ethereum Virtual Machine
EVM
Ethereum Gas
Ethereum Gas
A B
Ethereum Gas
A B
Ethereum Gas
Ethereum
Gas
Ethereum Gas
10 * 3 – 6 = ?
• The user that generated the transaction pays for the gas.
Ethereum Gas
Price
Gas Price
Petrol – 10 liters
A B
Gas Price
Petrol – 10 liters
Total price= ?
1 liter – Rs.5
Total price= 10x5=
Rs. 50
A B
Gas Price
10 * 3 – 6 = ?
Total fee will be: Gas units(limit) * Gas price per unit
Total fee will be: 21,000 * 100 = 210,0000 gwei or 0.0021 ETH
Gas Limit
Let say A wants to send B 2 ETH. So what will be the total fees
A that has to pay ?
Case 2: When gas transaction limit < 21000 units.
Transaction Fail
Gas Limit
Let say A wants to send B 2 ETH. So what will be the total fees
A that has to pay ?
Case 3: When gas transaction limit > 21000 units.
Transaction gas limit = 22,000 units.
POW
POS
Proof of Stake
Validator
+ Transaction Fee
Proof of Stake
A B
C
Proof of Stake
A B
C
Proof of Stake
A B
C
Proof of Stake
• The more ether you pay the more chances of getting randomly selected you
have.
POW vs POS
Proof Of Work(PoW) Proof Of Stake(PoS)
Miners Validators
The more hashing power you have the more The more ETH you stake the more blocks you
blocks you can validate. can validate.
Attack to happen 51% hashing power is
Attack to happen 51% of stake is required.
required.
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Consensus Protocol
A B
C
Sharding
Sharding
Manager
Employee
Decentralized Autonomous Organization
(DAOs)
DAO vs Organization
DAO A traditional organization
Fully democratized. Usually hierarchical.
Voting required . Voting may or may not require.
Outcome of voting must be handled
No trusted intermediary to count vote.
manually.
Requires human handling, or centrally
Services offered are handled automatically.
controlled automation.
Activity is typically private, and limited to
All activity is transparent and fully public.
the public.
Decentralized Autonomous Organization
(DAOs)
Decentralized Autonomous Organization
(DAOs)
The DAO
attack
The DAO Attack
Give Ether
The DAO
DAO tokens
Investment
Proposal
The DAO Attack
First proposal
16.06.2016 to counter the
30.04.2016 15.05.2016 20.07.2016
attack.
1919999
Hard Fork
Hard Fork
20.07.2016
1919999
Hard Fork
• During a hard fork, software implementing a protocol and its mining
procedures is upgraded.
• Once a user upgrades their software, that version rejects all transactions
from older software, effectively creating a new branch of the blockchain.
• However, those users who retain the old software continue to process
transactions.
Hard Fork
July 2016
476768
Hard Fork
August 2017
July 2016
476768 478558
Hard Fork
Upgrade Max Block Size to 8MB
Haven't
1 MB 0.7 MB 0.5 MB
Upgraded
Have 7 MB
Upgraded
11 AM 12 PM 1 PM 2 PM 3 PM 4 PM
Hard Fork
Upgrade Max Block Size to 8MB
Haven't
1 MB 0.7 MB 0.5 MB 1 MB
Upgraded
Have 7 MB 8 MB
Upgraded
11 AM 12 PM 1 PM 2 PM 3 PM 4 PM
Hard Fork
Upgrade Max Block Size to 8MB
Haven't
1 MB 0.7 MB 0.5 MB 1 MB 0.8 MB
Upgraded
Have 7 MB 8 MB 8 MB
Upgraded
11 AM 12 PM 1 PM 2 PM 3 PM 4 PM
Hard Fork
Upgrade Max Block Size to 8MB
Haven't
1 MB 0.7 MB 0.5 MB 1 MB 0.8 MB 1 MB
Upgraded
Have 7 MB 8 MB 8 MB 6.5 MB
Upgraded
11 AM 12 PM 1 PM 2 PM 3 PM 4 PM
Soft Fork
Soft Fork
• Soft forks are a change to the protocol, but the end product remains unchanged.
Hard Fork
20.07.2016
1919999
Soft Fork
• Soft forks are a change to the protocol, but the end product remains unchanged.
• Old nodes(not upgraded nodes) could still validate blocks and transactions (the
formatting didn’t break the rules), but they just wouldn’t understand them.
Soft Fork
Soft Fork
Soft Fork
Soft Fork
Soft Fork
Decrease block size to 0.5 MB
Haven't 1 MB
Upgraded 0.4 MB 0.5 MB 0.8 MB 0.5 MB
Yet
Bitcoin
Shares Profit
Initial Coin Offering (ICO)
Tokens Profit
Alt Coins
Alt Coins
• Altcoins are generally defined as all cryptocurrencies other than Bitcoin (BTC).
Alt Coins
What is the need of Alt Coins ?
Protocol
Technology
Click to add text
Mode of Contact
Prerequisite for Implementation of
Blockchain(Coding Part)
Decenteralization Banks
Smart Contracts
Properties of Blockchain
Decentralization
Immutability
Transperancy