2. Step 1
New transactions are
broadcast to all nodes
Transactions generation
Nodes
Step 2 Step 3
Step 4
Step 5
Step 6
Transaction Pool
Miners
New Block
Blockchain
Each miner adds
transactions to block and
work on puzzle of PoW
The miner who
solves puzzle
first, broadcast his
block
Nodes accept the block only if
transactions in it are valid and not
already spent
New block is added to
the blockchain
How does a Blockchain work?
4. Transaction and UTXOs
Sumedh 🡪 Me 0.1 BTC
Pallavi 🡪 Me 0.3 BTC
Sharvil 🡪 Me 0.6 BTC
Aarvi 🡪 Me 0.7 BTC
UTXOs
I want to buy a bicycle for 0.5 BTC
Input :
0.6 BTC from Sharvil
Output : 0.5 BTC to Shop Owner
0.1 BTC back to myself
UTXO for Shop
Owner
UTXO for Me
5. Transaction and UTXOs
Sumedh 🡪 Me0.1 BTC
Pallavi 🡪 Me 0.3 BTC
Sharvil 🡪 Me 0.6 BTC
Aarvi 🡪 Me 0.7 BTC
Me 🡪 Me 0.1 BTC
UTXOs
I want to buy a bicycle for 0.5 BTC
Input :
0.6 BTC from Sharvil
Output : 0.5 BTC to Shop Owner
0.1 BTC back to myself
UTXO for Shop
Owner
UTXO for Me
6. Transaction and UTXOs
Sumedh 🡪 Me 0.1 BTC
Pallavi 🡪 Me 0.3 BTC
Aarvi 🡪 Me 0.7 BTC
Me 🡪 Me 0.1 BTC
UTXOs
I want to buy one more bicycle for 1.1 BTC
Input :
0.3 BTC from Pallavi
0.7 BTC from Aarvi
0.1 BTC from Me
Output : 1.1 BTC to Shop Owner
Transactions
UTXO for Shop
Owner
8. Cryptography
● It is the science of keeping things confidential using
encryption techniques.
● It has been around for more than two thousand
years
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
9. Uses of Cryptography
● Confidentiality.
Only the intended or authorized recipient can understand the message.
referred to as privacy or secrecy
● Data Integrity
data can not be forged or modified by an adversary intentionally or by
unintended/accidental errors
Though data integrity cannot prevent the alteration of data, it can provide a means
of detecting whether the data was modified
● Authentication
The authenticity of the sender is assured and verifiable by the receiver
● Non-repudiation
The sender, after sending a message, cannot deny later that they sent the message.
This means that an entity (a person or a system) cannot refuse the ownership of a
previous commitment or an action.
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
12. Stream ciphers
• Convert one symbol of plaintext into one symbol of ciphertext.
• This means that the encryption is carried out one bit or byte of plaintext at a time.
Block cipher
• The plaintext is divided into relatively larger blocks of fixed-length groups of bits
• Encoding each of the blocks separately using the same key
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
13. Transmit cipher
text on network
C= E(k,m) m= D(k,c)
SENDER RECEIVER
Cryptography
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
14. Types of Cryptography
Cryptography
Symmetric
Cryptography
Asymmetric
Cryptography
Private key Cryptography
Public key Cryptography
Nobody should know the key other than
sender and receiver Public key is known to everyone
Private key is secret
DES 3DES AES
DES : Data Encryption Standard
56 bits 192 bits 128,192,
256 bits
AES : Advanced Encryption Standard
RSA DSA Elliptic
Curve
Hash Function
RSA : Ron Rivest, Adi Shamir, and Leonard Adleman
DSA : Digital Signature Algorithm
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
15. 3DES (Data Encryption Standard)
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
16. Transmit cipher
text on network
C= E(k,m) m= D(k,c)
SENDER RECEIVER
Symmetric Cryptography
Same value
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
17. Alice—the Sender:
• Encrypt the plaintext message m using encryption
algorithm E and key k to prepare the ciphertext c
• c = E(k, m)
• Send the ciphertext c to Bob
Bob—the Receiver:
• Decrypt the ciphertext c using decryption algorithm D
and the same key k to get the plaintext m
• m = D( k, c )
Symmetric cryptography
If the same key is used for both encryption and decryption, it is called symmetric key cryptography
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
18. Transmit cipher
text on network
C= E(k,m) m= D(k,c)
SENDER RECEIVER
Asymmetric Cryptography
Different
value
Public
key
Private
key
Public
key
Private
key
20. Properties of Good Encryption Algorithms
Unconditionally secure
Computationally secure
If attacker is not able to convert the cipher text to plain-text
Cost : Cost spent on converting cipher-text to plain-text is more than plain-text
Time : Time spent is more then the life of the plain-text
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
22. Features of Hashing
Nonreversible
Fixed length Output
From hash value can not get back the plain-text
For any length of plain-text, fixed-length hash value is generated
Common hash value should not be generated for two different messages, though
the change is very small.
No collision
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
23. Qualities of Hash Function
Unique Hash Value
Fast Computation
Avalanche Effect
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
24. Hashes
Represents data as a short string of text
One-way trip
A message digest
Impossible to recover the original message from the digest
Verify the downloaded document
- Hashes may be provided on the site
- Compare the downloaded file hash with the posted hash value
Integrity
Used for the purpose of confidentiality- storing password
-instead of password store the hash
-compare hashes during authentication process
Authentication, non-repudiation and integrity
Digital Signature
Confidentiality
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
26. (Secured Hash Algorithm) SHA 256
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
27. (Secured Hash Algorithm) SHA 256
•1990, Ron Rivest invented the hash function MD4
•1992,improved MD4 to MD5.
•1993, the National Security Agency published a hash function very
similar to MD5, called SHA (Secure Hash Algorithm)
In SHA 256,
256 bits = 64 hexadecimal characters
4 bits = 1 hex char 24= 16 4 * 64= 256
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
44. How mining works?
Consensus
Protocol
Hash and
Cryptography
Immutable
Ledger
Distributed
P2P N/w
Mining
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
45. How mining works?
Consensus
Protocol
Hash and
Cryptography
Immutable
Ledger
Distributed
P2P N/w
Mining
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
46. How mining works?
Consensus
Protocol
Hash and
Cryptography
Immutable
Ledger
Distributed
P2P N/w
Mining
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
47. How mining works?
Consensus
Protocol
Hash and
Cryptography
Immutable
Ledger
Distributed
P2P N/w
Mining
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
48. How mining works?
Consensus
Protocol
Hash and
Cryptography
Immutable
Ledger
Distributed
P2P N/w
Mining
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
49. Block # 14
Data:
Sharvil Sumedh 10 BTC
Nikhil Priya 7 BTC
Meera Pranil 6.35 BTC
Prev Hash 00003a269f1ac9d78
Hash 810a5b3cd380ec16
Nonce
Nonce : Number used Once
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
50. Block # 14
Data:
Sharvil Sumedh 10 BTC
Nikhil Priya 7 BTC
Meera Pranil 6.35 BTC
Prev Hash 00003a269f1ac9d78
Hash 3872ba6900cd24ef
Nonce 18
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
51. Block # 14
Data:
Sharvil Sumedh 10 BTC
Nikhil Priya 7 BTC
Meera Pranil 6.35 BTC
Prev Hash 00003a269f1ac9d78
Hash 5f3411b0396e76ac
Nonce 19
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
52. Block # 14
Data:
Sharvil Sumedh 10 BTC
Nikhil Priya 7 BTC
Meera Pranil 6.35 BTC
Prev Hash 00003a269f1ac9d78
Hash a42b7fa254e01356
Avalanche Effect
Nonce 20
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
53. Block # 14
Data:
Sharvil Sumedh 10 BTC
Nikhil Priya 7 BTC
Meera Pranil 6.35 BTC
Prev Hash 00003a269f1ac9d78
Hash 02491cb4f56ad773
Nonce 203
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
54. Block # 14
Data:
Sharvil Sumedh 10 BTC
Nikhil Priya 7 BTC
Meera Pranil 6.35 BTC
Prev Hash 00003a269f1ac9d78
Hash 60ce3401ae8fb11e
Nonce 5041
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
55. Block # 14
Data:
Sharvil Sumedh 10 BTC
Nikhil Priya 7 BTC
Meera Pranil 6.35 BTC
Prev Hash 00003a269f1ac9d78
Hash 000096ae4cb320f1
Nonce 17037
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
56. A Hash is a hexadecimal number of length 64
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
= 102987336249554097029535212322581322789799900648198034993379397001
0000000000001c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
= 45123607475580366783032544195595415913018526238690539071518805
00000000000000000000f4c89f42012427ae41e4649b934ca495991b785fe987
= 91584447803184859755650041578548187721957014927042951
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
57. A Hash is a hexadecimal number of length 64
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934c
a495991b7852b855
=
1029873362495540970295352123225813227897999006
48198034993379397001
0000000000001c149afbf4c8996fb92427ae41e4649b934c
a495991b7852b855
=4512360747558036678303254419559541591301852623
8690539071518805
00000000000000000000f4c89f42012427ae41e4649b934c
a495991b785fe987
=915844478031848597556500415785481877219570149
27042951
All Hashes
LARGEST
SMALLEST
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
58. A Hash is a hexadecimal number of length 64
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934c
a495991b7852b855
0000000000001c149afbf4c8996fb92427ae41e4649b934c
a495991b7852b855
00000000000000000000f4c89f42012427ae41e4649b934c
a495991b785fe987
All Hashes
LARGEST
SMALLEST
TARGET(0000)
Nonce = 203
Nonce = 18
Nonce = 19
Nonce = 5041
Nonce = 20
Nonce = 17037
Brute force method
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
70. Consensus Protocol
Consensus Algorithm
Proof of Work Proof of Stake Other
PoA PoET PoC
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
71. Proof of Work
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
72. Proof of Work
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
73. Proof of Work
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
74. Proof of Work
Competing chains
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
75. Proof of Work
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
76. Longest Chain
Proof of Work
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
78. Proof of Stake
Brief History
Proof of work was not the first consensus algorithm proposed
Many researchers had proposed variations of consensus algorithms
based on financial stake, now called proof of stake (PoS).
Proof of work was invented as an alternative to proof of stake
After success of Bitcoin, many blockchains have emulated proof of work.
Ethereum’s planned PoS algorithm is called Casper
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
79. Why to use Proof of Stake
According to the University of Cambridge's Bitcoin Electricity Consumption
Index, Bitcoin consumers about 119.87 terawatt-hours per year
It is more than countries like the United Arab Emirates and the
Netherlands consume annually.
To pay the electricity bill, miners would usually sell their bitcoin reward
for fiat money
This reduces the price of the cryptocurrency.
80. Proof of Stake
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
82. Proof of Stake
Stake
Miners can mine or validate block transactions based on the amount of coins a
miner holds.
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
83. Proof of Stake
Stake
Miners can mine or validate block transactions based on the amount of coins a
miner holds.
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune
84. Proof of Stake
Stake
A validator risks losing their deposit if the block they staked on is rejected by majority
of validators.
Assistant Professor Ranjana Shevkar, Modern College of Arts, science & Commerce, Ganeshkhind, Pune