1. 1
The Blockchain
Technology
Please discontinue use of cell
phone and turn off ringer
Innovation & IT Management
Never before has humanity been so interested in a
database (Richard Cook, 2018).
2. 2Nones, P. (March 18, 2018). Blockchain Technology: Hype … or Hope? https://nonesnotes.com/2018/03/18/blockchain-technology-
hype-or-hope/, last accessed July 25, 2018.
Introduction
2018
3. 3
Most if not all the technologies that made the creation of the
blockchain possible existed at least 10 years earlier.
This includes
The Hashing algorithm (invented in 1953 Hans Peter Luhn)
The Internet (invented in 1969)
Asymmetric encryption (invented in 1976)1
Digital time stamping (invented in 1991)2
The proof of work (Back 2002)3
1. Diffie, W. and Hellman, M.E. (1976). New Directions in Cryptography, IEEE TRANSACTIONS ON INFORMATION THEORY, IT-22
(6). https://ee.stanford.edu/~hellman/publications/24.pdf, last accessed Mar 9, 2019.
2. Haber, S. and Stornetta, W.S. (1991). How to Time-Stamp a Digital Document, Journal of Cryptology, Vol. 3, No. 2, pp. 99–111.
3. Back, A. (2002). Hashcash - A Denial of Service Counter-Measure, http://www.hashcash.org/papers/hashcash.pdf , last accessed
Mar 9, 2019.
Cited by Pisa, M. and Juden, M. (2017). Blockchain and Economic Development: Hype vs. Reality. CGD Policy Paper. Washington,
DC: Center for Global Development. https://www.cgdev.org/publication/blockchain-and-economic-development-hype-vs-reality, last
accessed Feb 24, 2018.
Introduction
10. 10
In March 1989 Tim Berners-Lee from the CERN created
what was to become known as the World Wide Web.
March 1989
Introduction
11. 11
1993: The Internet went global connecting networks from several
countries, and continued expanding thereafter.
1993
Introduction
12. 12
0:2
3
Coin Republic (Aug 30, 2013). Milton Friedman predicts the rise of Bitcoin in 1999!
https://www.youtube.com/watch?v=6MnQJFEVY7s, last accessed Mar 10, 2018.
Introduction
13. 13
Being built around the Internet, while the fundamental principles
of the Internet are:
Introduction
Being built around the Internet, while the fundamental principles
of the Internet are:
Redundancy
Distribution (stronger than decentralization)
Being built around the Internet, while the fundamental principles
of the Internet are:
Redundancy
Distribution (stronger than decentralization)
There are no:
Being built around the Internet, while the fundamental principles
of the Internet are:
Redundancy
Distribution (stronger than decentralization)
There are no:
Third party
Being built around the Internet, while the fundamental principles
of the Internet are:
Redundancy
Distribution (stronger than decentralization)
There are no:
Third party
Centralization
14. 14Nakamoto, S. (2008). Bitcoin: A Peer-to-Peer Electronic Cash System, https://bitcoin.org/bitcoin.pdf, last accessed Mar 5, 2019.
Introduction - Bitcoin
15. 15
It was in November 2008 that a paper
was published by Satoshi Nakamoto
describing blockchain and Bitcoin to
digitally send payments between any
two entities without the need for a
third-party.
Introduction
It was in November 2008 that a paper
was published by Satoshi Nakamoto
describing blockchain and Bitcoin to
digitally send payments between any
two entities without the need for a
third-party.
It is believed that Satoshi Nakamoto
was the name adopted by the person
or group of people who created
bitcoin and the concept of the
blockchain.
16. 16
They also devised the first blockchain
database, and validated the first block
ever on January 3, 2009.
CuriousInventor (Jul 14, 2013). How Bitcoin Works Under the Hood, https://www.youtube.com/watch?v=Lx9zgZCMqXE, last
accessed Aug 21, 2017.
This block has come to be known as
the genesis block.
Introduction
29. 29
Introduction
The number of bitcoin transactions per day:
Source: https://www.blockchain.com/fr/charts/n-transactions, July 22, 2018.
490,544
229,480
32. 32
Blockchain defined
A blockchain is a data structure that makes it possible to create a
digital ledger of transactions and share it among a distributed
network of computers.
Nash, K.S. (2016-07-14). IBM Pushes Blockchain into the Supply Chain, Wall Street Journal, https://www.wsj.com/articles/ibm-
pushes-blockchain-into-the-supply-chain-1468528824, last accessed Aug 24, 2017.
Ledgers have been used in
double-entry bookkeeping since
the 13th century.
Thanks to IT, 21st century ledgers
are shared and distributed.
As such, they become an
immutable record of all trans-
actions on the network, a record
that all network participants can
access.
34. 34
Blockchain defined
A blockchain is a data structure that makes it possible to create a
digital ledger of transactions and share it among a distributed
network of computers.
Nash, K.S. (2016-07-14). IBM Pushes Blockchain into the Supply Chain, Wall Street Journal, https://www.wsj.com/articles/ibm-
pushes-blockchain-into-the-supply-chain-1468528824, last accessed Aug 24, 2017.
Ledgers have been used in
double-entry bookkeeping since
the 13th century.
Thanks to IT, 21st century ledgers
are shared and distributed.
As such, they become an
immutable record of all trans-
actions on the network, a record
that all network participants can
access.
35. 35
Blockchain defined
A blockchain is a data structure that makes it possible to create a
digital ledger of transactions and share it among a distributed
network of computers.
Nash, K.S. (2016-07-14). IBM Pushes Blockchain into the Supply Chain, Wall Street Journal, https://www.wsj.com/articles/ibm-
pushes-blockchain-into-the-supply-chain-1468528824, last accessed Aug 24, 2017.
The difference between decentralized and distributed :
Centralized Decentralized Distributed
36. 36
At a very high level, the blockchain is a decentralized ledger, or
list, of all transactions across a peer-to-peer network. This is the
technology underlying Bitcoin and other cryptocurrencies, and it
has the potential to disrupt a wide variety of business processes.
PwC (January 2016). Q&A: What is blockchain? http://www.pwc.com/us/en/financial-services/publications/viewpoints/assets/qa-
what-is-blockchain.pdf,last accessed Aug 24, 2017.
Blockchain defined
IBM (May 9, 2016). IBM Blockchain on Bluemix is now Beta! https://www.ibm.com/blogs/internet-
https://www.ibm.com/blogs/bluemix/2016/05/blockchain-on-bluemix-now-beta/, last accessed Aug 24, 2017.
40. 40
Question:
How do we know that the message between A and B is valid?
i.e., that it is A that initiated the transaction?
The role of cryptography
Question:
How do we know that the message between A and B is valid?
i.e., that it is A that initiated the transaction?
Answer:
Through cryptography. Namely asymmetric encryption.
41. 41
Most if not all the technologies that made the creation of the
blockchain possible existed at least 10 years earlier.
This includes
The Hashing algorithm (invented in 1953 Hans Peter Luhn)
The Internet (invented in 1969)
Asymmetric encryption (invented in 1976)1
Digital time stamping (invented in 1991)2
The proof of work (Back 2002)3
1. Diffie, W. and Hellman, M.E. (1976). New Directions in Cryptography, IEEE TRANSACTIONS ON INFORMATION THEORY, IT-22
(6). https://ee.stanford.edu/~hellman/publications/24.pdf, last accessed Mar 9, 2019.
2. Haber, S. and Stornetta, W.S. (1991). How to Time-Stamp a Digital Document, Journal of Cryptology, Vol. 3, No. 2, pp. 99–111.
3. Back, A. (2002). Hashcash - A Denial of Service Counter-Measure, http://www.hashcash.org/papers/hashcash.pdf , last accessed
Mar 9, 2019.
Cited by Pisa, M. and Juden, M. (2017). Blockchain and Economic Development: Hype vs. Reality. CGD Policy Paper. Washington,
DC: Center for Global Development. https://www.cgdev.org/publication/blockchain-and-economic-development-hype-vs-reality, last
accessed Feb 24, 2018.
Introduction
42. 42
A key is a string of bits.
DI Management (not dated). An Introduction to Using Keys in Cryptography, http://www.di-mgt.com.au/cryptokeys.html, last
accessed July 25, 2013.
1111 1110 1101 1100 1011 1010 1001 1000 0111 0110 …. 0101
The role of cryptography
A key is a string of bits.
A 256-bit key will have exactly 256 bits in it, i.e. 32 bytes
To make it less cumbersome, keys can also be written in
hexadecimal format where each character represents 4 bits,
e.g.:
FE1CBA98765432100123456789ABCDEF
which represents 16 bytes or 128 bits.
Expressed in bits, the above example yields this string:
11111110 00011100 10111010 10011000 01110110 01010100
00110010 00010000 00000001 00100011 01000101 01100111
10001001 10101011 11001101 11101111
A key is a string of bits.
A 256-bit key will have exactly 256 bits in it, i.e. 32 bytes (32x8).
43. 43
A key is a string of bits.
DI Management (not dated). An Introduction to Using Keys in Cryptography, http://www.di-mgt.com.au/cryptokeys.html, last
accessed July 25, 2013.
1111 1110 1101 1100 1011 1010 1001 1000 0111 0110 …. 0101
The role of cryptography
A key is a string of bits.
A 256-bit key will have exactly 256 bits in it, i.e. 32 bytes
To make it less cumbersome, keys can also be written in
hexadecimal format where each character represents 4 bits,
e.g.:
FE1CBA98765432100123456789ABCDEF
which represents 16 bytes or 128 bits.
Expressed in bits, the above example yields this string:
11111110 00011100 10111010 10011000 01110110 01010100
00110010 00010000 00000001 00100011 01000101 01100111
10001001 10101011 11001101 11101111
A key is a string of bits.
A 256-bit key will have exactly 256 bits in it, i.e. 32 bytes (32x8).
1111
44. 44
A key is a string of bits.
DI Management (not dated). An Introduction to Using Keys in Cryptography, http://www.di-mgt.com.au/cryptokeys.html, last
accessed July 25, 2013.
1111 1110 1101 1100 1011 1010 1001 1000 0111 0110 …. 0101
The role of cryptography
To make it less cumbersome, keys can also be written in
hexadecimal format where each character represents 4 bits,
e.g.:
FE1CBA98765432100123456789ABCDEF
which represents 16 bytes or 128 bits.
Expressed in bits, the above example yields this string:
11111110 00011100 10111010 10011000 01110110 01010100
00110010 00010000 00000001 00100011 01000101 01100111
10001001 10101011 11001101 11101111
1111 0001
A key is a string of bits.
A 256-bit key will have exactly 256 bits in it, i.e. 32 bytes (32x8).
45. 45
A key is a string of bits.
DI Management (not dated). An Introduction to Using Keys in Cryptography, http://www.di-mgt.com.au/cryptokeys.html, last
accessed July 25, 2013.
1111 1110 1101 1100 1011 1010 1001 1000 0111 0110 …. 0101
The role of cryptography
To make it less cumbersome, keys can also be written in
hexadecimal format where each character represents 4 bits,
e.g.:
FE1CBA98765432100123456789ABCDEF
which represents 16 bytes or 128 bits.
Expressed in bits, the above example yields this string:
11111110 00011100 10111010 10011000 01110110 01010100
00110010 00010000 00000001 00100011 01000101 01100111
10001001 10101011 11001101 11101111
A key is a string of bits.
A 256-bit key will have exactly 256 bits in it, i.e. 32 bytes (32x8).
1111 0001 1111
49. 49
Asymmetric Encryption
The private key
For every user, a pair of private
and public keys are created, which
go hand in hand but are totally
independent one from the other
The public key
51. 51
B’s public key
751A696
C24D970
10121261
Transaction
B’s private key
751A696
C24D970
10121261
Encrypted
message
Encrypted
message
A encrypts his message using
B’s public key.
Upon reception, B decrypts the
message with his private key.
A
B
A pair of keys are used: a public key, which encrypts data,A pair of keys are used: a public key, which encrypts data,
and a corresponding private, or secret key for, decryption.
A pair of keys are used: a public key, which encrypts data,
and a corresponding private, or secret key for, decryption.
The public key is published to the world while the private
key is kept secret.
Asymmetric Encryption
52. 52
A to John
A to Leila
A to Abdu
A to Haykel
A to Shakti
5 BTC
12 BTC
2000 BTC
143 BTC
10 BTC
04344244233344454778877..999
12443444543344454773344..877
44450434447733244234541..123
12443444543344454773344..877
75444788332443443344774..181
Even though all these transactions have been signed by A, the
digital signature is different every time because the recipient is
different every time.
Asymmetric Encryption
53. 53
From the movie Eyes Wide Shut (Stanley Kubrick, 1999) @1:07:28.
0:2
7
Asymmetric Encryption – An Example
55. 55
The public keys are stored in
public servers accessible to
everyone.
The public keys are stored in
public servers accessible to
everyone.
Since there is only one key (the
private key) which goes hand in
hand with the public key, the risk
to decipher an encrypted
message is reduced
The public keys are stored in
public servers accessible to
everyone.
Since there is only one key (the
private key) which goes hand in
hand with the public key, the risk
to decipher an encrypted
message is reduced because it
is almost impossible to generate
a private key from the public
key.
Asymmetric Encryption – An Example
59. 59
The transaction, along many others, when
confirmed, is collected in a block.
The block is broadcast to all nodes in the P2P
network.
A
B
Blockchain defined
61. 61
A
B
Parties validate the block in which the transaction was inserted
through a process called mining.
Blockchain defined
Parties validate the block in which the transaction was inserted
through a process called mining.
It is therefore once the transactions are approved, that the new
block is added to the blockchain, which is a ledger of all past
transactions.
62. 62
Existing blockchain
Once the block has been added, it is linked to the one before it,
and the one after it (hence the word chain).
The ledger balances are updated to reflect the new balances
for all parties.
Blockchain defined
63. 63
Existing blockchain
Once the block has been added, it is linked to the one before it,
and the one after it (hence the word chain).
The ledger balances are updated to reflect the new balances
for all parties.
The process goes on and a new block is formed every 10mn,
with a new set of transactions, all having occurred at about the
same time.
Blockchain defined
65. 65
Existing blockchain
Once the block has been added, it is linked to the one before it,
and the one after it (hence the word chain).
The ledger balances are updated to reflect the new balances
for all parties.
The process goes on and a new block is formed every 10mn,
with a new set of transactions, all having occurred at about the
same time.
A blockchain is thus a linked list of blocks, each block
containing transactions.
Each block is limited to 2,400 transactions (~ 1Mb).
3Blue1Brown (Jul 7, 2017). Ever wonder how Bitcoin (and other cryptocurrencies) actually work?,
https://www.youtube.com/watch?v=bBC-nXj3Ng4, last accessed Aug 23, 2017.
Blockchain defined
67. 67
A
B
Remember that everyone has a copy of the blockchain.
If anyone tries to alter it to claim ownership of currency that is
not really theirs, the discrepancy is immediately obvious to
everyone.
Hinchcliffe, D. (July 31, 2015). How blockchain is likely to transform IT and business, ZDNet,
http://www.zdnet.com/article/how-blockchain-is-likely-to-change-it-and-business-forever/, last accessed Aug 20, 2017.
Blockchain defined
68. 68
Remember that everyone has a copy of the blockchain.
If anyone tries to alter it to claim ownership of currency that is
not really theirs, the discrepancy is immediately obvious to
everyone.
Hinchcliffe, D. (July 31, 2015). How blockchain is likely to transform IT and business, ZDNet,
http://www.zdnet.com/article/how-blockchain-is-likely-to-change-it-and-business-forever/, last accessed Aug 20, 2017.
Blockchain defined
Parties validate the block in which the transaction was inserted
through a process called mining performed by the miners.
70. 70
Question:
Who are the miners?
Question:
Who are the miners and what do they do?
Question:
Who are the miners and what do they do?
Answer:
A
B
Mining and the miners
71. 71
Question:
Who are the miners and what do they do?
Answer:
Miners are individuals who provide the computing power for
Bitcoin’s validation process.
They use this computing power by solving a cryptographic
problem, called a hash function.
By using their computing power for this work, miners are
rewarded with bitcoins.
Wan, T. and Hoblitzell, M. (June 26, 2014). Bitcoin - Fact. Fiction. Future, https://dupress.deloitte.com/dup-us-en/topics/emerging-
technologies/bitcoin-fact-fiction-future.html, last accessed Aug 20, 2017.
Mining and the miners
Question:
Who are the miners and what do they do?
Answer:
Miners are individuals who provide the computing power for
Bitcoin’s validation process.
They use this computing power by solving a cryptographic
problem, called a hash function.
By using their computing power for this work, miners are
rewarded with bitcoins.
In fact, that is how new bitcoins enter the money supply
(more about this later).
72. 72
Question:
Who are the miners and what do they do?
Answer:
Miners are individuals who provide the computing power for
Bitcoin’s validation process.
They use this computing power by solving a cryptographic
problem, called a hash function.
By using their computing power for this work, miners are
rewarded with bitcoins.
Stanley, J. (February 5, 2018).Blockchain Explained: How It Works, Who Cares and What Its Future May Hold,
https://www.techspot.com/article/1567-blockchain-explained/, last accessed Feb 5, 2018.
Mining and the miners
Question:
Who are the miners and what do they do?
Answer:
Miners are individuals who provide the computing power for
Bitcoin’s validation process.
They use this computing power by solving a cryptographic
problem, called a hash function.
By using their computing power for this work, miners are
rewarded with bitcoins.
In fact, that is how new bitcoins enter the money supply
(more about this later).
An essential feature of blockchain is its ability to encrypt each
“block” of data for a unique hash output that is also stamped onto
the succeeding block, creating a chain of sequential information
which is then verified through a consensus of activity across a
network of participants.
73. 73
Most if not all the technologies that made the creation of the
blockchain possible existed at least 10 years earlier.
This includes
The Hashing algorithm (invented in 1953 Hans Peter Luhn)
The Internet (invented in 1969)
Asymmetric encryption (invented in 1976)1
Digital time stamping (invented in 1991)2
The proof of work (Back 2002)3
1. Diffie, W. and Hellman, M.E. (1976). New Directions in Cryptography, IEEE TRANSACTIONS ON INFORMATION THEORY, IT-22
(6). https://ee.stanford.edu/~hellman/publications/24.pdf, last accessed Mar 9, 2019.
2. Haber, S. and Stornetta, W.S. (1991). How to Time-Stamp a Digital Document, Journal of Cryptology, Vol. 3, No. 2, pp. 99–111.
3. Back, A. (2002). Hashcash - A Denial of Service Counter-Measure, http://www.hashcash.org/papers/hashcash.pdf , last accessed
Mar 9, 2019.
Cited by Pisa, M. and Juden, M. (2017). Blockchain and Economic Development: Hype vs. Reality. CGD Policy Paper. Washington,
DC: Center for Global Development. https://www.cgdev.org/publication/blockchain-and-economic-development-hype-vs-reality, last
accessed Feb 24, 2018.
Introduction
82. 82
Imagine that you’d want to look up a telephone number
in a database. Hans Peter Luhn
Given the 8-digit number 23 15 26 52, an algorithm could
simply sequentially search through the database until it found it.
In a database of millions though, this could be time consuming.
Paolini-Subramanya, M. (Feb 6, 2018). The Invention of the Hashing Algorithm, https://medium.com/@dieswaytoofast/the-invention-
of-the-hashing-algorithm-600933d7f845, last accessed Apr 9, 2019.
Hash function - SHA256
Given the 8-digit number 23 15 26 52, an algorithm could
simply sequentially search through the database until it found it.
In a database of millions though, this could be time consuming.
Luhn’s had a better: The phone number’s digits were grouped
into pairs (in this case, 23, 15, 26, 52). The paired digits were
then added together (5, 6, 8, 7), from which a new number was
generated, consisting of each single-digit result. The original
phone number and the name or address corresponding to it
would then be put into a bucket labeled 5687.
83. 83
Given the 8-digit number 23 15 26 52
Imagine that you’d want to look up a telephone number
in a database. Hans Peter Luhn
Given the 8-digit number 23 15 26 52, an algorithm could
simply sequentially search through the database until it found it.
In a database of millions though, this could be time consuming.
Luhn’s had a better: The phone number’s digits were grouped
into pairs (in this case, 23, 15, 26, 52). The paired digits were
then added together (5, 6, 8, 7), from which a new number was
generated, consisting of each single-digit result. The original
phone number and the name or address corresponding to it
would then be put into a bucket labeled 5687.
5, 6, 8, 7
Hash function - SHA256
Paolini-Subramanya, M. (Feb 6, 2018). The Invention of the Hashing Algorithm, https://medium.com/@dieswaytoofast/the-invention-
of-the-hashing-algorithm-600933d7f845, last accessed Apr 9, 2019.
84. 84
Given the 8-digit number 23 15 26 52
Imagine that you’d want to look up a telephone number
in a database. Hans Peter Luhn
5, 6, 8, 75, 6, 8, 7
11
5, 6, 8, 7
11 15
5, 6, 8, 7
11 15
2
5, 6, 8, 7
11 15
2 6
5, 6, 8, 7
11 15
2 6
8
Hash function - SHA256
86. 86
Imagine that you’d want to look up a telephone number
in a database. Hans Peter Luhn
Paolini-Subramanya, M. (Feb 6, 2018). The Invention of the Hashing Algorithm, https://medium.com/@dieswaytoofast/the-invention-
of-the-hashing-algorithm-600933d7f845, last accessed Apr 9, 2019.
Given the 8-digit number 23 15 26 52, an algorithm could
simply sequentially search through the database until it found it.
In a database of millions though, this could be time consuming.
Luhn’s had a better: The phone number’s digits were grouped
into pairs (in this case, 23, 15, 26, 52). The paired digits were
then added together (5, 6, 8, 7), from which a new number was
generated, consisting of each single-digit result. The original
phone number and the name or address corresponding to it
would then be put into a bucket labeled 5687.
Hash function - SHA256
Given the 8-digit number 23 15 26 52, an algorithm could
simply sequentially search through the database until it found it.
In a database of millions though, this could be time consuming.
Luhn’s had a better: The phone number’s digits were grouped
into pairs (in this case, 23, 15, 26, 52). The paired digits were
then added together (5, 6, 8, 7), from which a new number was
generated, consisting of each single-digit result. The original
phone number and the name or address corresponding to it
would then be put into a bucket labeled 5687.
Looking up an entry from a phone number involved quickly
calculating the bucket number using Luhn’s method and then
retrieving the information from that bucket.
87. 87
Infinite number
of values 2256 values
It is “impractical” to revert thanks to the concept of “information
destruction”. Of the result of the calculation, we only take the
rightmost digits (256 of them).
Hash function - SHA256
88. 88
So,
Hash of “1235566” is (for example): 0100010001…0001
So,
Hash of “1235566” is (for example): 0100010001…0001
So,
Hash of “1235566” is (for example): 0100010001…0001
We strike out the first 4 digits : 0100010001…0001
So,
Hash of “1235566” is (for example): 0100010001…0001
We strike out the first 4 digits : 0100010001…0001
and we obtain: 010001…0001
So,
Hash of “1235566” is (for example): 0100010001…0001
We strike out the first 4 digits : 0100010001…0001
and we obtain: 010001…0001
Hash of the file “Syllabus ITM 301”: 1111010001…0001
We strike out the first 4 digits : 1111010001…0001
and we obtain: 010001…0001
Hash function - SHA256
89. 89
Inspired from The Economist (Oct 31st 2015).The great chain of being sure about things,
https://www.economist.com/news/briefing/21677228-technology-behind-bitcoin-lets-people-who-do-not-know-or-trust-each-other-
build-dependable, last accessed Jan 4, 2018.
90. 90
Inspired from The Economist (Oct 31st 2015).The great chain of being sure about things,
https://www.economist.com/news/briefing/21677228-technology-behind-bitcoin-lets-people-who-do-not-know-or-trust-each-other-
build-dependable, last accessed Jan 4, 2018.
91. 91
Merkle R.C. (1988) A Digital Signature Based on a Conventional Encryption Function. In: Pomerance C. (eds) Advances in
Cryptology — CRYPTO ’87. CRYPTO 1987. Lecture Notes in Computer Science, vol 293. Springer, Berlin, Heidelberg,
https://people.eecs.berkeley.edu/~raluca/cs261-f15/readings/merkle.pdf, last accessed Apr 7, 2019.
Ralph C. Merkle, born in 1952, computer scientist, is
one of the inventors of public key cryptography and
the inventor of cryptographic hashing.
Mining and the miners
Ralph Merkle
96. 96
Ken Shirriff’s blog on
http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html:
97. 97
Ken Shirriff’s blog on
http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html:
98. 98
Ken Shirriff’s blog on
http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html:
99. 99
import hashlib
# Hash pairs of items recursively until a single value is obtained
def merkle(hashList):
if len(hashList) == 1:
return hashList[0]
newHashList = []
# Process pairs. For odd length, the last is skipped
for i in range(0, len(hashList)-1, 2):
newHashList.append(hash2(hashList[i], hashList[i+1]))
if len(hashList) % 2 == 1: # odd, hash last item twice
newHashList.append(hash2(hashList[-1], hashList[-1]))
return merkle(newHashList)
def hash2(a, b):
# Reverse inputs before and after hashing
# due to big-endian / little-endian nonsense
a1 = a.decode('hex')[::-1]
b1 = b.decode('hex')[::-1]
h = hashlib.sha256(hashlib.sha256(a1+b1).digest()).digest()
return h[::-1].encode('hex')
# https://blockexplorer.com/rawblock/0000000000000000e067a478024addfecdc93628978aa52d91fabd4292982a50
txHashes = [
"00baf6626abc2df808da36a518c69f09b0d2ed0a79421ccfde4f559d2e42128b",
"91c5e9f288437262f218c60f986e8bc10fb35ab3b9f6de477ff0eb554da89dea",
"46685c94b82b84fa05b6a0f36de6ff46475520113d5cb8c6fb060e043a0dbc5c",
"ba7ed2544c78ad793ef5bb0ebe0b1c62e8eb9404691165ffcb08662d1733d7a8",
"b8dc1b7b7ed847c3595e7b02dbd7372aa221756b718c5f2943c75654faf48589",
"25074ef168a061fcc8663b4554a31b617683abc33b72d2e2834f9329c93f8214",
"0fb8e311bffffadc6dc4928d7da9e142951d3ba726c8bde2cf1489b62fb9ebc5",
"c67c79204e681c8bb453195db8ca7d61d4692f0098514ca198ccfd1b59dbcee3",
Ken Shirriff’s blog on
http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html:
Shirriff’s Python code
100. 100
Ken Shirriff’s blog on
http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html:
import hashlib
# Hash pairs of items recursively until a single value is obtained
def merkle(hashList):
if len(hashList) == 1:
return hashList[0]
newHashList = []
# Process pairs. For odd length, the last is skipped
for i in range(0, len(hashList)-1, 2):
newHashList.append(hash2(hashList[i], hashList[i+1]))
if len(hashList) % 2 == 1: # odd, hash last item twice
newHashList.append(hash2(hashList[-1], hashList[-1]))
return merkle(newHashList)
def hash2(a, b):
# Reverse inputs before and after hashing
# due to big-endian / little-endian nonsense
a1 = a.decode('hex')[::-1]
b1 = b.decode('hex')[::-1]
h = hashlib.sha256(hashlib.sha256(a1+b1).digest()).digest()
return h[::-1].encode('hex')
# https://blockexplorer.com/rawblock/0000000000000000e067a478024addfecdc93628978aa52d91fabd4292982a50
txHashes = [
"00baf6626abc2df808da36a518c69f09b0d2ed0a79421ccfde4f559d2e42128b",
"91c5e9f288437262f218c60f986e8bc10fb35ab3b9f6de477ff0eb554da89dea",
"46685c94b82b84fa05b6a0f36de6ff46475520113d5cb8c6fb060e043a0dbc5c",
"ba7ed2544c78ad793ef5bb0ebe0b1c62e8eb9404691165ffcb08662d1733d7a8",
"b8dc1b7b7ed847c3595e7b02dbd7372aa221756b718c5f2943c75654faf48589",
"25074ef168a061fcc8663b4554a31b617683abc33b72d2e2834f9329c93f8214",
"0fb8e311bffffadc6dc4928d7da9e142951d3ba726c8bde2cf1489b62fb9ebc5",
"c67c79204e681c8bb453195db8ca7d61d4692f0098514ca198ccfd1b59dbcee3",
99 transaction Hashes
Shirriff’s Python code
101. 101Antonopoulos, A.M. (Jan 31, 2016). Consensus Algorithms, Blockchain Technology and Bitcoin UCL,
https://www.youtube.com/watch?v=fw3WkySh_Ho, last accessed Aug 23, 2017.
In 1997 Adam Back created a system for antispam
called hashcash.
The concept of hashcash
Hashcash is an algorithm that requires a sizeable amount of
work to compute.
Hashcash is an algorithm that requires a sizeable amount of
work to compute.
For an email, for example, a hashcash stamp is added to
the header of the message to prove that the sender has
expended a modest amount of CPU time calculating the stamp
prior to sending the email.
Hashcash is an algorithm that requires a sizeable amount of
work to compute.
For an email, for example, a hashcash stamp is added to
the header of the message to prove that the sender has
expended a modest amount of CPU time calculating the stamp
prior to sending the email.
Adam Back figured that this mechanism will make spammers
do some work: a few hundred thousand SHA operations in a
row, which, by definition, produce a fingerprint with a specific
value that proves that a certain amount of work was done.
102. 102
Most if not all the technologies that made the creation of the
blockchain possible existed at least 10 years earlier.
This includes
The Hashing algorithm (invented in 1953 Hans Peter Luhn)
The Internet (invented in 1969)
Asymmetric encryption (invented in 1976)1
Digital time stamping (invented in 1991)2
The proof of work (Back 2002)3
1. Diffie, W. and Hellman, M.E. (1976). New Directions in Cryptography, IEEE TRANSACTIONS ON INFORMATION THEORY, IT-22
(6). https://ee.stanford.edu/~hellman/publications/24.pdf, last accessed Mar 9, 2019.
2. Haber, S. and Stornetta, W.S. (1991). How to Time-Stamp a Digital Document, Journal of Cryptology, Vol. 3, No. 2, pp. 99–111.
3. Back, A. (2002). Hashcash - A Denial of Service Counter-Measure, http://www.hashcash.org/papers/hashcash.pdf , last accessed
Mar 9, 2019.
Cited by Pisa, M. and Juden, M. (2017). Blockchain and Economic Development: Hype vs. Reality. CGD Policy Paper. Washington,
DC: Center for Global Development. https://www.cgdev.org/publication/blockchain-and-economic-development-hype-vs-reality, last
accessed Feb 24, 2018.
Introduction
103. 103
The concept of hashcash
Why don’t spammers like this concept?
For example, consider that to send an email, you have to spend
half a second of computing.
Why don’t spammers like this concept?
For example, consider that to send an email, you have to spend
half a second of computing.
If you are a spammer, and you want to send a million
messages, you will have to do half a million seconds of
computing! (a million times .5s).
Why don’t spammers like this concept?
For example, consider that to send an email, you have to spend
half a second of computing.
If you are a spammer, and you want to send a million
messages, you will have to do half a million seconds of
computing! (a million times .5s).
That is a lot of work.
Why don’t spammers like this concept?
For example, consider that to send an email, you have to spend
half a second of computing.
If you are a spammer, and you want to send a million
messages, you will have to do half a million seconds of
computing! (a million times .5s).
That is a lot of work.
In Back’s rationale, if the sender goes through some amount of
time and effort to generate the stamp and send the email, it is
unlikely that they are a spammer.
104. 104
0:1
0
The concept of hashcash
WatchMojo.com (May 27, 2014). Top 10 Bitcoin Facts, https://www.youtube.com/watch?v=2UC_8NdR1To, last accessed Nov 6,
2017.
105. 105
Question:
How do miners validate the new transactions?
Antonopoulos, A.M. (Jan 31, 2016). Consensus Algorithms, Blockchain Technology and Bitcoin UCL,
https://www.youtube.com/watch?v=fw3WkySh_Ho, last accessed Aug 23, 2017.
Wan, T. and Hoblitzell, M. (June 26, 2014). Bitcoin - Fact. Fiction. Future, https://dupress.deloitte.com/dup-us-en/topics/emerging-
technologies/bitcoin-fact-fiction-future.html, last accessed Aug 20, 2017.
Question:
How do miners validate the new transactions?
Answer:
1. Every 10 minutes, they look at a set of unconfirmed
transactions and see whether
a. The transactions conform to some consensus rules (private/public
keys, never has been spent previously, output ≤ input, etc.).
b. The block conforms to some consensus rules (block size, reward is
not spent in less than 100 blocks, etc.).
Mining and the miners
Question:
How do miners validate the new transactions?
Answer:
1. Every 10 minutes, they look at a set of unconfirmed
transactions and see whether
a. The transactions conform to some consensus rules (private/public
keys, never has been spent previously, output ≤ input, etc.).
b. The block conforms to some consensus rules (block size, reward is
not spent in less than 100 blocks, etc.).
2. They then race to bundle data from the last block in the
ledger and data in the current block, by finding a number
called nonce. number used oncenumber
nonce
number used oncen once
107. 107
Answer (cont’d):
3. Then they compute the hash to produce a unique fingerprint
making the block and its transactions valid and verifiable.
Wan, T. and Hoblitzell, M. (June 26, 2014). Bitcoin - Fact. Fiction. Future, https://dupress.deloitte.com/dup-us-en/topics/emerging-
technologies/bitcoin-fact-fiction-future.html, last accessed Aug 20, 2017.
Mining and the miners
Answer (cont’d):
3. Then they compute the hash to produce a unique fingerprint
making the block and its transactions valid and verifiable.
4. The hashed block must have a set number of zeroes at the
beginning. So the miner has to try different nonces to find
the right value.
Answer (cont’d):
3. Then they compute the hash to produce a unique fingerprint
making the block and its transactions valid and verifiable.
4. The hashed block must have a set number of zeroes at the
beginning. So the miner has to try different nonces to find
the right value.
5. When a miner finds a hash with the correct number of
zeroes, the discovery is broadcast to the rest of the network.
108. 108
Mining and the miners - Facts
The miner’s task: Apply the hash (SHA256) so that:
SHA256 (current and previous blocks + nonce) < Target
The miner’s task: Apply the hash (SHA256) so that:
SHA256 (current and previous blocks + nonce) < Target
(i.e., starts with n zeroes).
The miner’s task: Apply the hash (SHA256) so that:
SHA256 (current and previous blocks + nonce) < Target
(i.e., starts with n zeroes).
For example: it starts with 4 zeroes.
The miner’s task: Apply the hash (SHA256) so that:
SHA256 (current and previous blocks + nonce) < Target
(i.e., starts with n zeroes).
For example: it starts with 4 zeroes, like 0000126GhghhG1jkjj6èè-
The miner’s task: Apply the hash (SHA256) so that:
SHA256 (current and previous blocks + nonce) < Target
(i.e., starts with n zeroes).
For example: it starts with 4 zeroes, like 0000126GhghhG1jkjj6èè-
For bitcoin, the nonce lies between 0 and 4.294.967.296.
All hashes begin with zeroes; at least 8 and up to 63.
Currently the number of zeroes is around 17 (on the average).
109. 109Inspired by CuriousInventor (Jul 14, 2013). How Bitcoin Works Under the Hood,
https://www.youtube.com/watch?v=Lx9zgZCMqXE, last accessed Aug 21, 2017.
Mining and the miners
To find the nonce, a computer needs to perform approximately an
average of 10²¹ operations.
Previous
s
110. 110
Previous
Mining and the miners
The amount of processing performed to find the target is what
constitutes the proof-of-work (PoW).
The amount of processing performed to find the target is what
constitutes the proof-of-work (PoW).
All target hashes begin with 0s--at least eight 0s, and up to 63 0s.
The amount of processing performed to find the target is what
constitutes the proof-of-work (PoW).
All target hashes begin with 0s--at least eight 0s, and up to 63 0s.
There is a maximum target set by the Bitcoin Protocol.
The amount of processing performed to find the target is what
constitutes the proof-of-work (PoW).
All target hashes begin with 0s--at least eight 0s, and up to 63 0s.
There is a maximum target set by the Bitcoin Protocol.
No target can be greater than this number:
0000 0000 ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff
Inspired by CuriousInventor (Jul 14, 2013). How Bitcoin Works Under the Hood, https://www.youtube.com/watch?v=Lx9zgZCMqXE,
last accessed Aug 21, 2017 and Hong, E. (Oct 17, 2017). Read more: How Does Bitcoin Mining Work? Investopedia,
s
111. 111
SHA256
is random but deterministic
finding its inverse is nearly impossible
SHA256
is random but deterministic
finding its inverse is nearly impossible
what are the chances the first bit is going to be zero?
50%
SHA256
is random but deterministic
finding its inverse is nearly impossible
what are the chances the first bit is going to be zero?
50%
2 bits?
25%
SHA256
is random but deterministic
finding its inverse is nearly impossible
what are the chances the first bit is going to be zero?
50%
2 bits?
25%
10 bits?
Mining and the miners
1
2 𝑛
112. 112
SHA256
is random but deterministic
finding its inverse is nearly impossible
what are the chances the first bit is going to be zero?
50%
2 bits?
25%
10 bits?
nearly impossible
How?
Mining and the miners
113. 1133Blue1Brown (Jul 7, 2017). Ever wonder how Bitcoin (and other cryptocurrencies) actually work?
https://www.youtube.com/watch?v=bBC-nXj3Ng4, last accessed Aug 23, 2017.
Mining and the miners
For example, for 60 zeroes:
114. 114Inspired by CuriousInventor (Jul 14, 2013). How Bitcoin Works Under the Hood,
https://www.youtube.com/watch?v=Lx9zgZCMqXE, last accessed Aug 21, 2017 and Hong, E. (Oct 17, 2017). Read more: How
Mining and the miners
The amount of processing performed to find the target is what
constitutes the proof-of-work (PoW).
All target hashes begin with 0s--at least eight 0s, and up to 63 0s.
There is a maximum target set by the Bitcoin Protocol.
No target can be greater than this number:
0000 0000 ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff
115. 115
Digital Signatures
A B
A computes the hash of
the message she is
sending
B receives the hashcode of the
message crypted with A’s private
key
The hashcode obtained is
then crypted with A’s
private key
B receives the hashcode of the
message crypted with A’s private
key AND
B receives the hashcode of the
message crypted with A’s private
key AND
the original message
117. 117
B checks whether A’s
public key
B computes the message’s hash
again
B checks whether A’s
public key matches her
private key
118. 118
B checks whether A’s
public key
B computes the message’s hash
again
B checks whether A’s
public key matches her
private key
Get the hash value
of the message
Signature is
valid when
values are
equal
119. 119
B checks whether A’s
public key
B computes the message’s hash
again
B checks whether A’s
public key matches her
private key
Get the hash value
of the message
Signature is
valid when
values are
equal
121. 121
Digital Signatures – An example: Outlook
To digitally sign all messages:
1. Click on the File tab
Microsoft Support (n.d.). Secure messages by using a digital signature, https://support.office.com/en-us/article/secure-messages-by-
using-a-digital-signature-549ca2f1-a68f-4366-85fa-b3f4b5856fc6, last accessed Dec 24, 2018.
122. 122
2. On the File tab, click Options >Trust Center.
Digital Signatures – An example: Outlook
123. 123
3. Then on Trust Center:
Digital Signatures – An example: Outlook
124. 124
4. Under rust Center, click Trust Center Settings.
Digital Signatures – An example: Outlook
125. 125
5. On the Email Security tab, under Encrypted Mail, select
the Add digital signature to outgoing messages check box.
Digital Signatures – An example: Outlook
126. 126
If the calculation takes more than 10mn, the miner will have to
drop this block and move to the next one.
Again, to do this more and more efficiently, more and more
powerful hardware has to be used.
Bitcoin Mining (n.d.). Bitcoin Knowledge Podcast, Bitcoin Mining, Hesiod Services LLC, https://www.bitcoinmining.com/, last
accessed Aug 20, 2017.
Hiếu, L. Th. (May 13, 2017). Bitcoin Transaction - Double-Spending Attack (51% Attack),
https://www.youtube.com/watch?v=9U2MWaHG-xM, last accessed Aug 21, 2017.
Lead Blockchain Editor (September 12, 2016). Why Investors Should Care About Bitcoin Mining Pools, Bitcoin Investment News,
https://bitcoinira.com/articles/investors-care-bitcoin-mining-pools, last accessed Nov 26, 2017.
Wan, T. and Hoblitzell, M. (June 26, 2014). Bitcoin - Fact. Fiction. Future, https://dupress.deloitte.com/dup-us-en/topics/emerging-
technologies/bitcoin-fact-fiction-future.html, last accessed Aug 20, 2017.
Mining and the miners
If the calculation takes more than 10mn, the miner will have to
drop this block and move to the next one.
Again, to do this more and more efficiently, more and more
powerful hardware has to be used.
To avoid that miners with modest computing power wait more
time to earn BTC rewards, pools were formed to group miners
and distribute BTC rewards on a fairer basis.
If the calculation takes more than 10mn, the miner will have to
drop this block and move to the next one.
Again, to do this more and more efficiently, more and more
powerful hardware has to be used.
To avoid that miners with modest computing power wait more
time to earn BTC rewards, pools were formed to group miners
and distribute BTC rewards on a fairer basis.
The Bitcoin network, for example, is producing 500
petaflops (quadrillion) hashes per second!
127. 127
A mining farm is a site for the production of crypto currency.
A farm is also a collection of powerful computers that miners need.
Mining farms
See http://www.sciencedebate2008.com/fermy-dlya-mayninga-kriptovalyut-eto-uzhe-realnost/, last accessed Nov 26, 2017.
128. 128Wan, T. and Hoblitzell, M. (June 26, 2014). Bitcoin - Fact. Fiction. Future, https://dupress.deloitte.com/dup-us-en/topics/emerging-
technologies/bitcoin-fact-fiction-future.html, last accessed Aug 20, 2017.
Mining and the miners
Answer (cont’d):
3. Then they compute the hash to produce a unique fingerprint
making the block and its transactions valid and verifiable.
4. The hashed block must have a set number of zeroes at the
beginning. So the miner has to try different nonces to find
the right value.
5. When a miner finds a hash with the correct number of
zeroes, the discovery is broadcast to the rest of the network.
Answer (cont’d):
3. Then they compute the hash to produce a unique fingerprint
making the block and its transactions valid and verifiable.
4. The hashed block must have a set number of zeroes at the
beginning. So the miner has to try different nonces to find
the right value.
5. When a miner finds a hash with the correct number of
zeroes, the discovery is broadcast to the rest of the network.
6. The miner gets a reward valued in BTC.
129. 129Wan, T. and Hoblitzell, M. (June 26, 2014). Bitcoin - Fact. Fiction. Future, https://dupress.deloitte.com/dup-us-en/topics/emerging-
technologies/bitcoin-fact-fiction-future.html, last accessed Aug 20, 2017.
Mining and the miners
Answer (cont’d):
3. Then they compute the hash to produce a unique fingerprint
making the block and its transactions valid and verifiable.
4. The hashed block must have a set number of zeroes at the
beginning. So the miner has to try different nonces to find
the right value.
5. When a miner finds a hash with the correct number of
zeroes, the discovery is broadcast to the rest of the network.
6. The miner gets a reward valued in BTC.
The reward is then registered in the
blockchain as if it was a transaction.
130. 130
The reward has not always been 50 BTC, and will not always be
50 BTC:
Jan 2009: 50 BTC per mined block.
3Blue1Brown (Jul 7, 2017). Ever wonder how Bitcoin (and other cryptocurrencies) actually work?,
https://www.youtube.com/watch?v=bBC-nXj3Ng4, last accessed Aug 23, 2017.
The miner’s reward
131. 1313Blue1Brown (Jul 7, 2017). Ever wonder how Bitcoin (and other cryptocurrencies) actually work?
https://www.youtube.com/watch?v=bBC-nXj3Ng4, last accessed Aug 23, 2017.
The miner’s reward
The reward has not always been 50 BTC, and will not always be
25 BTC:
Jan 2009: 50 BTC per mined block.
Nov 2012: 25 BTC per mined block.
July 2016: 12.5 BTC
Feb 2020: 6.25 BTC
Sep 2023: etc.
The reward gets cut in half every 210.000 blocks (every 4 years or
so).
The reward has not always been 50 BTC, and will not always be
25 BTC:
Jan 2009: 50 BTC per mined block.
Nov 2012: 25 BTC per mined block.
July 2016: 12.5 BTC
Feb 2020: 6.25 BTC
Sep 2023: etc.
The reward gets cut in half every 210.000 blocks (every 4 years or
so).
Note: This means that there will never be more than 21.000.000
bitcoins in existence:
210,000 (50+25+12,5+6,25….) < 21.000.000.
132. 132
The miner’s reward
The reward has not always been 50 BTC, and will not always be
25 BTC:
Jan 2009: 50 BTC per mined block.
Nov 2012: 25 BTC per mined block.
July 2016: 12.5 BTC
Feb 2020: 6.25 BTC
Sep 2023: etc.
The reward gets cut in half every 210.000 blocks (every 4 years or
so).
Note: This means that there will never be more than 21.000.000
bitcoins in existence:
210,000 (50+25+12,5+6,25….) < 21.000.000.
210 000,00 x 50,00 = 10 500 000,000210 000,00 x 50,00 = 10 500 000,000
210 000,00 x 25,00 = 5 250 000,000
210 000,00 x 50,00 = 10 500 000,000
210 000,00 x 25,00 = 5 250 000,000
210 000,00 x 12,50 = 2 625 000,000
210 000,00 x 6,25 = 1 312 500,000
210 000,00 x 3,13 = 656 250,000
210 000,00 x 1,56 = 328 125,000
210 000,00 x 0,78 = 164 062,500
210 000,00 x 0,39 = 82 031,250
210 000,00 x 0,20 = 41 015,730
210 000,00 x 0,10 = 20 507,760
210 000,00 x 0,05 = 10 253,880
210 000,00 x 0,02 = 5 126,940
210 000,00 x 0,01 = 2 563,470
210 000,00 x 0,01 = 1 281,840
210 000,00 x 0,00 = 640,920
210 000,00 x 0,00 = 320,460
210 000,00 x 0,00 = 160,230
210 000,00 x 0,00 = 80,010
210 000,00 x 0,00 = 40,110
210 000,00 x 0,00 = 20,034
210 000,00 x 50,00 = 10 500 000,000
210 000,00 x 25,00 = 5 250 000,000
210 000,00 x 12,50 = 2 625 000,000
210 000,00 x 6,25 = 1 312 500,000
210 000,00 x 3,13 = 656 250,000
210 000,00 x 1,56 = 328 125,000
210 000,00 x 0,78 = 164 062,500
210 000,00 x 0,39 = 82 031,250
210 000,00 x 0,20 = 41 015,730
210 000,00 x 0,10 = 20 507,760
210 000,00 x 0,05 = 10 253,880
210 000,00 x 0,02 = 5 126,940
210 000,00 x 0,01 = 2 563,470
210 000,00 x 0,01 = 1 281,840
210 000,00 x 0,00 = 640,920
210 000,00 x 0,00 = 320,460
210 000,00 x 0,00 = 160,230
210 000,00 x 0,00 = 80,010
210 000,00 x 0,00 = 40,110
210 000,00 x 0,00 = 20,034
20 999 980,134
3Blue1Brown (Jul 7, 2017). Ever wonder how Bitcoin (and other cryptocurrencies) actually work?
https://www.youtube.com/watch?v=bBC-nXj3Ng4, last accessed Aug 23, 2017.
133. 133
The last Bitcoin will be
mined somewhere
between May 7th and
October 8th, 2140.
Bitcoins created
Reward halved every 4 years
The miner’s reward
134. 134
Where does the 50 BTC come from when mining?
The first 50 BTC come from devaluing all the following bitcoin
rewards by a tiny amount.
Which explains why the reward decreases with time. When all
bitcoins have been exhausted, they disappear.
The miner’s reward
135. 135
CuriousInventor (Jul 14, 2013). How Bitcoin Works Under the Hood, https://www.youtube.com/watch?v=Lx9zgZCMqXE, last
accessed Aug 21, 2017.
Wan, T. and Hoblitzell, M. (June 26, 2014). Bitcoin - Fact. Fiction. Future, https://dupress.deloitte.com/dup-us-en/topics/emerging-
technologies/bitcoin-fact-fiction-future.html, last accessed Aug 20, 2017.
In PoW, validating transactions requires significant resources:
hardware, electricity, time, data storage, bandwidth, …
Source: https://www.blockchain.com/fr/charts/n-transactions?timespan=1year, July 23, 2018.
Validating transactions
In July 2018, Bitcoin reached 182,000 transactions per day.
137. 137
In the beginning, miners solved these math
problems with ordinary processors.
Bitcoin Mining (n.d.). Bitcoin Knowledge Podcast, Bitcoin Mining, Hesiod Services LLC, https://www.bitcoinmining.com/, last
accessed Aug 20, 2017.
In the beginning, miners solved these math
problems with ordinary processors.
Then they realized that graphics cards used for
gaming were better suited to this kind of working:
Graphics cards (GPUs) are faster
Validating transactions - GPUs
139. 139
Hong, E. (Oct 17, 2017). Read more: How Does Bitcoin Mining Work? Investopedia, https://www.investopedia.com/tech/how-does-
bitcoin-mining-work/, last accessed Feb 17, 2018.
Here, the graphics cards are the rectangular blocks with whirring
circles.
Again, this is probably no longer the most efficient way to mine.
Validating transactions - GPUs
140. 140
2300
transistors
In 2017, the largest transistor count in a traditional commercially
available single-chip processor was 19.2 billion: AMD’s Ryzen-
based Epyc.
Moore’s Law
141. 141
In the beginning, miners solved these math
problems with ordinary processors.
Bitcoin Mining (n.d.). Bitcoin Knowledge Podcast, Bitcoin Mining, Hesiod Services LLC, https://www.bitcoinmining.com/, last
accessed Aug 20, 2017.
In the beginning, miners solved these math
problems with ordinary processors.
Then they realized that graphics cards used for
gaming were better suited to this kind of working:
Graphics cards (GPUs) are faster
In the beginning, miners solved these math
problems with ordinary processors.
In the beginning, miners solved these math
problems with ordinary processors.
Then they realized that graphics cards used for
gaming were better suited to this kind of working:
Graphics cards (GPUs) are faster, but they use
more electricity and generate a lot of heat.
Validating transactions - GPUs
142. 142
In the beginning, miners solved these math
problems with ordinary processors.
Bitcoin Mining (n.d.). Bitcoin Knowledge Podcast, Bitcoin Mining, Hesiod Services LLC, https://www.bitcoinmining.com/, last
accessed Aug 20, 2017.
In the beginning, miners solved these math
problems with ordinary processors.
Then they realized that graphics cards used for
gaming were better suited to this kind of working:
Graphics cards (GPUs) are faster, but they use
more electricity and generate a lot of heat.
In the beginning, miners solved these math
problems with ordinary processors.
Then they realized that graphics cards used for
gaming were better suited to this kind of working:
Graphics cards (GPUs) are faster, but they use
more electricity and generate a lot of heat.
The first commercial Bitcoin mining chips that
were reprogrammed for mining Bitcoin were
faster but still power-hungry.
ASIC, or Application Specific Integrated Circuit,
for example, are chips that are designed
specifically for Bitcoin mining.
Validating transactions - ASICs
143. 143Bitcoin Mining (n.d.). Bitcoin Knowledge Podcast, Bitcoin Mining, Hesiod Services LLC, https://www.bitcoinmining.com/, last
accessed Aug 20, 2017.
4.73 Tera Hashes
per second
Validating transactions - ASICs
144. 144Bitcoin Mining (n.d.). Bitcoin Knowledge Podcast, Bitcoin Mining, Hesiod Services LLC, https://www.bitcoinmining.com/, last
accessed Aug 20, 2017.
Validating transactions - ASICs
4.73 Tera Hashes
per second
1 Tera = 240
145. 145
CuriousInventor (Jul 14, 2013). How Bitcoin Works Under the Hood, https://www.youtube.com/watch?v=Lx9zgZCMqXE, last
accessed Aug 21, 2017.
Wan, T. and Hoblitzell, M. (June 26, 2014). Bitcoin - Fact. Fiction. Future, https://dupress.deloitte.com/dup-us-en/topics/emerging-
technologies/bitcoin-fact-fiction-future.html, last accessed Aug 20, 2017.
Martin, W. (16 Oct 2017). The electricity required for a single Bitcoin trade could power a house for a whole month,
https://www.weforum.org/agenda/2017/10/the-electricity-required-for-a-single-bitcoin-trade-could-power-a-house-for-a-whole-month,
last accessed Dec 15, 2017.
In PoW, validating transactions requires significant resources:
hardware, electricity, time, data storage, bandwidth, …
Validating transactions
0:5
6
146. 146
World’s average electricity price is 18.8 cents per 1 kWh.
Overall, prices vary between 3 cents per kWh in Algeria to 62
cents per kWh in South Korea.
Nail, M. and Di Giuda, M.(Dec 20, 2017). What countries are most profitable for mining?
https://bitnewstoday.com/market/mining/what-countries-are-most-profitable-for-mining/, last accessed Feb 16, 2018.
Validating transactions
147. 147
Williams-Grut, O. (Nov. 26, 2017). The electricity used to mine bitcoin this year is bigger than the annual usage of 159 countries,
http://uk.businessinsider.com/bitcoin-mining-electricity-usage-2017-11, last accessed Feb 16, 2018.
The electricity used to mine bitcoin in 2017 was bigger than the
annual usage of 159 countries, including most African countries
This map shows
which countries
consume less
electricity than the
amount consumed
by global bitcoin
mining.
Validating transactions
153. 153
Nail, M. and Di Giuda, M.(Dec 20, 2017). What countries are most profitable for mining?
https://bitnewstoday.com/market/mining/what-countries-are-most-profitable-for-mining/, last accessed Feb 16, 2018.
154. 154
Nail, M. and Di Giuda, M.(Dec 20, 2017). What countries are most profitable for mining?
https://bitnewstoday.com/market/mining/what-countries-are-most-profitable-for-mining/, last accessed Feb 16, 2018.
Validating transactions
155. 155
Nail, M. and Di Giuda, M.(Dec 20, 2017). What countries are most profitable for mining?
https://bitnewstoday.com/market/mining/what-countries-are-most-profitable-for-mining/, last accessed Feb 16, 2018.
Validating transactions
156. 156
Nail, M. and Di Giuda, M.(Dec 20, 2017). What countries are most profitable for mining?
https://bitnewstoday.com/market/mining/what-countries-are-most-profitable-for-mining/, last accessed Feb 16, 2018.
Validating transactions
157. 157
Nail, M. and Di Giuda, M.(Dec 20, 2017). What countries are most profitable for mining?
https://bitnewstoday.com/market/mining/what-countries-are-most-profitable-for-mining/, last accessed Feb 16, 2018.
Validating transactions
158. 158
Nail, M. and Di Giuda, M.(Dec 20, 2017). What countries are most profitable for mining?
https://bitnewstoday.com/market/mining/what-countries-are-most-profitable-for-mining/, last accessed Feb 16, 2018.
Validating transactions
159. 159
Nail, M. and Di Giuda, M.(Dec 20, 2017). What countries are most profitable for mining?
https://bitnewstoday.com/market/mining/what-countries-are-most-profitable-for-mining/, last accessed Feb 16, 2018.
Validating transactions
160. 160
Nail, M. and Di Giuda, M.(Dec 20, 2017). What countries are most profitable for mining?
https://bitnewstoday.com/market/mining/what-countries-are-most-profitable-for-mining/, last accessed Feb 16, 2018.
Validating transactions
161. 161
Nail, M. and Di Giuda, M.(Dec 20, 2017). What countries are most profitable for mining?
https://bitnewstoday.com/market/mining/what-countries-are-most-profitable-for-mining/, last accessed Feb 16, 2018.
Validating transactions
162. 162
In PoW, validating transactions requires significant resources:
hardware, electricity, time, data storage, bandwidth, …
Validating transactions
163. 163
If you want to estimate how much Bitcoin you could mine with
your mining rig’s hash rate, the site Cryptocompare offers a
helpful calculator.
Hong, E. (Oct 17, 2017). Read more: How Does Bitcoin Mining Work? Investopedia, https://www.investopedia.com/tech/how-does-
bitcoin-mining-work/, last accessed Feb 17, 2018.
Validating transactions
165. 165
Fakhri, I. (2016). 5 minutes pour comprendre votre facture de la STEG (Tarifs et paliers), http://efigure.net/les-tarifs-et-les-paliers-de-
facturation-de-lelectricite-et-du-gaz-de-la-steg/, last accessed Feb 17, 2018.
166. 166
Summary
New transactions are broadcast to all nodes.
Each node in the network collects new transactions into a
block.
Miners verify that transactions within each block are legitimate
Each node works on finding a proof-of-work for its block.
When a node finds a proof-of-work, it broadcasts the block to all
nodes.
Nodes validate the block with all its transactions and accept it.
Nodes work on creating the following block in the chain by
using the hash of the just accepted block.
A reward is given to the first miner who solves each blocks
problem/
Verified transactions are stored in the public blockchain.
Somewhat inspired from GitHub (n.d.). Consensus achieved using Proof-of-Work,
https://mastanbtc.github.io/blockchainnotes/consensustypes/, last accessed Mar 3. Also see See Proof of Work vs Proof of Stake:
168. 168
Excerpted from Motherboard (Feb 6, 2015). Life Inside a Secret Chinese Bitcoin Mine,
https://www.youtube.com/watch?v=K8kua5B5K3I, last accessed Apr 6, 2019.
1:4
3
The biggest mining pools in July 2018
170. 170
A 51% attack is an infringement to a blockchain which is
performed by a group of miners when they happen to control more
than 50% of the network’s computing power.
These miners will thus be able to prevent new transactions from
gaining confirmations.
While they are in control of the network, they will also be able to
take control of the blockchain to reverse transactions, with the
unwanted consequences (double spend).
Frankenfield, J. (Feb 7, 2019). 51% Attack, https://www.investopedia.com/terms/1/51-attack.asp, last accessed Apr 2, 2019.
51% attacks and double spending
issues
171. 171
CuriousInventor (Jul 14, 2013). How Bitcoin Works Under the Hood, https://www.youtube.com/watch?v=Lx9zgZCMqXE, last
accessed Aug 21, 2017 [10:10].
1:0
0
51% attacks and double spending
issues
172. 172
Existing blockchain
Ali’s new block
Pool of unconfirmed transactions
Pool of unconfirmed transactions
Time
Multiple miners can
create blocks at the same
time, some blocks may be
different.
173. 173
Existing blockchain
Time
Unconfirmed transactions
Multiple miners can
create blocks at the same
time, some blocks may be
different.
Ali’s new block
Pool of unconfirmed transactions
Alia’s new block
Multiple miners can
create blocks at the same
time, some blocks may be
different.
Whose block is going to
be validated first, Ali’s or
Alia’s?
174. 174
Question:
Why does this happen ?
Question:
Why does this happen ?
Answer
Because of network delays (latency)
Question:
Why does this happen ?
Answer
Because of network delays (latency), which are caused by :
51% attacks and double spending
issues
Question:
Why does this happen ?
Answer
Because of network delays (latency), which are caused by :
Processing delays
Queuing delays
Transmission delays
Propagation delays
175. 175
Question:
Why does this happen ?
Answer
Because of network delays (latency), which are caused by :
Processing delays: the time taken by routers to process packet headers
Queuing delays: the time that packets spend in routing queues
Transmission delays: the time it takes to push the packet’s bits onto the
link
Propagation delays: the time for a signal to reach its destination
51% attacks and double spending
issues
176. 176
Existing blockchain
Time
Unconfirmed transactions
Ali’s new block
Pool of unconfirmed transactions
Alia’s new block
Multiple miners can create
blocks at the same time,
some blocks may be different.
Whose block is going to be
validated first, Ali’s or Alia’s?
Answer: the one whose nonce
is found first.
177. 177
Existing blockchain
Time
Unconfirmed transactions
Confirmed transactions
Ali’s block
Multiple miners can create
blocks at the same time,
some blocks may be different.
Whose block is going to be
validated first, Ali’s or Alia’s?
Answer: the one whose nonce
is found first.
181. 181Time
Current blockchain
That is exactly what a 51% attack allows to do!
When a miner (or pool of miners) cumulate 51% of the network
worth of computing power, they can insert a fraudulent transaction,
insert the corresponding block in a branch, and make it so that
that branch becomes the longest branch.
In case of ties, the new block will always build on the longest
branch.
51% attacks and double spending
issues
182. 182Time
Final blockchain
More secure Less secure
That is why it is recommended to wait several blocks before considering
received money final.
This ambiguity opens the door to double spend attacks…
51% attacks and double spending
issues
183. 183
3blue1brown! (July 11, 2017). Ever wonder how Bitcoin (and other cryptocurrencies) actually work?
https://www.3blue1brown.com/videos/2017/7/11/ever-wonder-how-bitcoin-and-other-cryptocurrencies-actually-work, last accessed
Aug 28, 2017 `[@21:38].
51% attacks and double spending
issues
184. 184
51% attackers
cannot create false transactions for someone else unless the
attacker somehow gets access to that person’s unique digital
signature
they can reverse their own transactions and prevent the
confirmation of new transactions.
Therefore, a 51% attack does really not allow to steal someone’s
cryptocurrency. However, it can allow to falsely send
cryptocurrency to someone else, then reverse that transaction and
end up keeping the funds.
Klein, J. (Jan 8, 2019). What is a 51% attack? https://breakermag.com/what-is-a-51-attack/, last accessed Apr 2, 2019.
51% attackers
cannot create false transactions for someone else unless the
attacker somehow gets access to that person’s unique digital
signature.
they can reverse their own transactions and prevent the
confirmation of new transactions.
Therefore, a 51% attack does really not allow to steal someone’s
cryptocurrency. However, it can allow to falsely send
cryptocurrency to someone else, then reverse that transaction and
end up keeping the funds.
Also, the bigger the network, the more difficult a 51%
attack!
51% attacks and double spending
issues
185. 185
Issues with the PoW scheme include:
The more difficult the problem, the longer it takes to solve it.
1. GitHub (2018). Proof of Stake FAQ, https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ, last accessed Jan 15, 2018.
Mamoria, M. (Jul 5, 2017). Is Proof of Stake really the solution? https://hackernoon.com/is-proof-of-stake-really-the-solution-
2db68487f4ba, last accessed Jan 14, 2018.
PoW vs. PoS
Issues with the PoW scheme include:
The more difficult the problem, the longer it takes to solve it.
The more difficult the problem, the more electricity it takes to
compute.
Issues with the PoW scheme include:
The more difficult the problem, the longer it takes to solve it.
The more difficult the problem, the more electricity it takes to
compute.
Thus, the value of PoW-based cryptocurrencies costs time and
money.
For instance, it is believed that both Bitcoin and Ethereum burn
over $1 million worth of electricity and hardware costs per day1.
186. 186
As a consequence:
With time, miners may ask for higher transaction fees to offset
the diminishing block reward. This will cause the transactions
on the network to be more costly compared to alternatives,
causing more network participants to leave.
If there is a reduction in the number of miners, the mining pool
will become more centralized, increasing the likelihood of 51%
attacks. This could potentially destabilize the network and
cause participants to lose trust in the blockchain.
PoW vs. PoS
187. 187
The proof-of-stake (PoS) scheme is one of the alternatives to the
(PoW).
PoW vs. PoS
In the PoS scheme, the creator of a new block is chosen
depending on its wealth (the stake).
Greenfield, R. (Jul 20, 2017). Explaining How Proof of Stake, Proof of Work, Hashing and Blockchain Work Together,
https://medium.com/@robertgreenfieldiv/explaining-proof-of-stake-f1eae6feb26f, last accessed Jan 14, 2018.
In the PoS scheme, the creator of a new block is chosen
depending on its wealth (the stake).
This means that the more coins are owned by a validator, the
more validating power it has.
188. 188
Excerpted from Cryptonauts (Jul 3, 2017). Proof of Work VS Proof of Stake - Simplified Explanation,
https://www.youtube.com/watch?v=SiKnWBPkQ4I, last accessed Jan 14, 2018 @4:30.
0:4
4
PoW vs. PoS
189. 189
The proof-of-stake (PoS) scheme is one of the alternatives to the
(PoW).
PoW vs. PoS
Greenfield, R. (Jul 20, 2017). Explaining How Proof of Stake, Proof of Work, Hashing and Blockchain Work Together,
https://medium.com/@robertgreenfieldiv/explaining-proof-of-stake-f1eae6feb26f, last accessed Jan 14, 2018.
In the PoS scheme, the creator of a new block is chosen
depending on its wealth (the stake).
This means that the more coins are owned by a validator, the
more validating (mining) power it has.
In the PoS scheme, the creator of a new block is chosen
depending on its wealth (the stake).
This means that the more coins are owned by a validator, the
more validating (mining) power it has.
Note:
In the PoS scheme, blocks are “forged” or “minted”, not
mined.
Users who validate transactions and create new blocks in
this system are referred to as “forgers” or “validators”, not
miners.
190. 190
The first cryptocurrency to adopt the PoS scheme was
Peercoin.
Investopedia (n.d.). Proof of Stake (PoS), https://www.investopedia.com/terms/p/proof-stake-pos.asp, last accessed Jan 14, 2018.
Ray, S. (Oct 6, 2017). What is Proof of Stake? https://hackernoon.com/what-is-proof-of-stake-8e0433018256, last accessed Jan 14,
2018.
PoW vs. PoS
The first cryptocurrency to adopt the PoS scheme was
Peercoin.
It was then followed by
Blackcoin
ShadowCash
Lisk
Nxt
and Ethereum.
191. 191
Wikipedia (Apr 8, 2019). Legality of bitcoin by country or territory,
https://en.wikipedia.org/wiki/Legality_of_bitcoin_by_country_or_territory, last accessed Apr 28, 2019.
Cryptocurrencies and the law
192. 192
The difference between Blockchain and
Bitcoin
Network Internet
Blockchain Bitcoin
IBMBlockchain (May 8, 2017). What is the difference between Bitcoin and blockchain, https://www.youtube.com/watch?v=MKwa-
BqnJDg, last accessed Aug 20, 2017.
193. 193
Network Internet
Blockchain Bitcoin
0:1IBMBlockchain (May 8, 2017). What is the difference between Bitcoin and blockchain, https://www.youtube.com/watch?v=MKwa-
BqnJDg, last accessed Aug 20, 2017.
The difference between Blockchain and
Bitcoin
194. 194
How do we know that quality logo is legit?
Application: Food Safety and Provenance
195. 195
Application: Food Safety and Provenance
A similar example was given by Richie Etwaru using tangerines. See Etwaru, R. (May 15, 2017). Blockchain: Massively Simplified,
TEDxMorristown, https://www.youtube.com/watch?v=k53LUZxUF50, last accessed Aug 21, 2017.
1. Quick Respone Code
How do we know that quality logo is legit?
196. 196
The same example was given by Richie Etwaru using tangerines. See Etwaru, R. (May 15, 2017). Blockchain: Massively Simplified,
TEDxMorristown, https://www.youtube.com/watch?v=k53LUZxUF50, last accessed Aug 21, 2017.
1. Quick Response Code
How do we know that quality logo is legit?
Imagine that the fig seller puts a QR code1 on the merchandise.
How do we know that quality logo is legit?
Application: Food Safety and Provenance
197. 197
How do we know that quality logo is legit?
Imagine that the fig seller puts a QR code1 on the merchandise.
We can scan that code with our smartphone.
The same example was given by Richie Etwaru using tangerines. See Etwaru, R. (May 15, 2017). Blockchain: Massively Simplified,
TEDxMorristown, https://www.youtube.com/watch?v=k53LUZxUF50, last accessed Aug 21, 2017.
1. Quick Response Code
How do we know that quality logo is legit?
Imagine that the fig seller puts a QR code1 on the merchandise.
We can scan that code with our smartphone.
An app opens showing all the transactions that took place on
that merchandise including all the chemicals that were applied
in the farm where it came from.
How do we know that quality logo is legit?
Imagine that the fig seller puts a QR code1 on the merchandise.
We can scan that code with our smartphone.
An app opens showing all the transactions that took place on
that merchandise including all the chemicals that were applied
in the farm where it came from.
And it is all running on a blockchain so that we know that we
can trust it.
Application: Food Safety and Provenance
198. 198Excerpted from LibertyPen (August 26, 2008). Power of the Market - The Pencil, https://www.youtube.com/watch?v=R5Gppi-O3a8, last accessed J
1:09
Application: Food Safety and Provenance
199. 199
The spinach outbreak in 2006
which caused national wide
kidney failures.
Consequently, all spinach was
recalled nationwide.
IBM Watson Internet of Things (Feb 16, 2017). Genius of Things: Blockchain and Food Safety with IBM and Walmart,
https://www.youtube.com/watch?v=MMOF0G_2H0A, last accessed Mar 30, 2018 @5:40.
Food safety
200. 200
It took two weeks to trace it
back to the original farm.
When it was done, they found
out it was one supplier, one
farm, one lot, one day.
Food safety
201. 201
IBM Watson Internet of Things (Feb 16, 2017). Genius of Things: Blockchain and Food Safety with IBM and Walmart,
https://www.youtube.com/watch?v=MMOF0G_2H0A, last accessed Mar 30, 2018 @5:40.
It took two weeks to trace it
back to the original farm.
When it was done, they
found out it was one
supplier, one farm, one lot,
one day.
Food safety
202. 202
Application: Food Safety and Provenance
Raw Material
Suppliers
End Customers
Distribution
Warehouses
Manufacturing
Plants
Retailers
203. 203
Application: Food Safety and Provenance
Raw Material
Suppliers
End Customers
Distribution
Warehouses
Manufacturing
Plants
Retailers
204. 204
At each transaction, a new block
is generated and added to the
Blockchain.
Each time, all parties validate the
transaction.
Application: Food Safety and Provenance
205. 205
Partz, H. (Mar 2, 2018). Walmart To Implement Blockchain-Based Delivery System, https://cointelegraph.com/news/walmart-to-implement-blockch
28, 2018.
From grower to grocer.
From farm to fork.
From grass to glass.
Application: Food Safety and Provenance
206. 206
IBM Watson Internet of Things (Feb 16, 2017). Genius of Things: Blockchain and Food Safety with IBM and Walmart,
https://www.youtube.com/watch?v=MMOF0G_2H0A, last accessed Mar 30, 2018 @5:40.
Walmart, the world largest retailer a company that serves 240
million customers every week.
Application: Food Safety and Provenance
207. 207
Thus, this technology could be used for tracking fresh food from
the grower to grocer (reducing waste and costs).
This implies documenting inspections, and recording the chain
of custody through time-stamped blockchain transactions.
Stanley, J. (Feb 5, 2018). Blockchain Explained: How It Works, Who Cares and What Its Future May Hold - Is Blockchain the Swiss
Army Knife to All of Our Cyber-Insecurities?, TechSpot, https://www.techspot.com/article/1567-blockchain-explained/, last accessed
Feb 17, 2018.
Food safety
209. 209
In Ghana around 78% of land
is unregistered.
A lot of land dispute problems.
Corruption and nepotism have
plagued every area of the
public sector.
Aitken, R. (Apr 5, 2016). Bitland's African Blockchain Initiative Putting Land On The Ledger, https://www.forbes.com/sites/rogeraitken/20
initiative-putting-land-on-the-ledger/#1a87344e7537, last accessed Jan 25, 2018.
Bitland, based in
Bloomington, Indiana, aimed
to register land titles to a
public blockchain, so that
ownership is not only public -
but immutable.
Other Use Cases: Land Titles
210. 210
Haiti, when the earthquake happened—most, if not all, of the land
titles were held in one building, which was destroyed.
You have a nation now that doesn’t have land titling.
McKinsey (May 2017). What next for blockchain? https://www.mckinsey.com/industries/high-tech/our-insights/what-next-for-
blockchain, last accessed Mar 25, 2018.
30% of the titles in the
US have errors in them.
Other Use Cases: Land Titles
211. 211
Other Use Cases: Land Titles
See http://edition.cnn.com/SPECIALS/2001/trade.center/tenants1.html
Glatersept, J.D. (Sept 13, 2001). After the Attacks: the Records; Corporate Paper Trails Lie Buried in Soot,
https://www.nytimes.com/2001/09/13/business/after-the-attacks-the-records-corporate-paper-trails-lie-buried-in-soot.html, last
212. 212
The SEC (Security and Exchange
Commission) will have to reconstruct
much of its work regarding
investigations and litigation,
according to Carmen Lawrence, who
headed the New York operations
from 1995 to 2000.
The files were largely in paper form,
and the SEC had to reconstruct
them.
Glatersept, J.D. (Sept 13, 2001). After the Attacks: the Records; Corporate Paper Trails Lie Buried in Soot,
https://www.nytimes.com/2001/09/13/business/after-the-attacks-the-records-corporate-paper-trails-lie-buried-in-soot.html, last
accessed Apr 1, 2018.
Other Use Cases: Land Titles
218. 218
T
T
H
H
A
A
N
N
K
K
S
SSong: Extracted from the song 141120 TK music sn04.-27510, by Artist: Pleasure Park Music - Licensed by AdRev for Rights Holder
(on behalf of Pleasure Park Music), https://soundcloud.com/zoxfox87/141120-tk-music-sn05-1, last accessed July 27, 2018.