6. 6
Transaction Digital Signature
Bill needs to pay £50 to Lily signature1xxxx
Bill needs to pay £50 to Lisa signature2xxxx
Lily needs to pay £50 to Andy signature3xxxx
7. 7
Transaction Digital Signature
Bill needs to pay £51 to Lily signature1xxxx
Bill needs to pay £50 to Lisa signature2xxxx
Lily needs to pay £50 to Andy signature3xxxx
9. 9
Digest::SHA256.hexdigest 'Bill
needs to pay £50 to Lily'
"1cbb5cb1831bbab61070b25341
ac3898fb5dcd40d607a7c50acd6
b63f9ed0e93"
Digest::SHA256.hexdigest 'Bill
needs to pay £50 to Lily.'
"c04c79682b701328dd2ac96bd9
be282763a18319ffa3e6e70e64f6
56e538508a"
Digest::SHA256.hexdigest 'Bill
needs to pay £50 to Lisa'
"7c8e0549760456d0030ec2ff78a
b1289af0e7be71e3aa22b215bad
c8a9348c8"
10. 10
Transaction Digital Signature
Bill needs to pay £50 to Lily SHA256(Bill needs to pay £50 to
Lily)
Bill needs to pay £50 to Lisa SHA256(Bill needs to pay £50 to
Lisa)
Lily needs to pay £50 to Andy SHA256(Lily needs to pay £50 to
Andy)
Identifiability?
14. 14
Bill’s Private
key
SHA256(Bill
needs to
pay £50 to
Lily)
Encrypt
1150641
3127484
2252621
6519612
Bill’s Public key
Decrypt
SHA256(Bill
needs to
pay £50 to
Lily)
Original
message
Hash1
SHA256(Receive
message)
Hash2
If Hash1 == Hash2
Signature is specifically
for this record
The signature is Bill’s
The original message is
the same as received
one
15. 15
Transaction Digital Signature
Bill needs to pay £50 to Lily Bill’s private-key
encrypt[SHA256(Bill needs to pay
£50 to Lily)]
Bill needs to pay £50 to Lisa Bill’s private-key
encrypt[SHA256(Bill needs to pay
£50 to Lisa)]
Lily needs to pay £50 to Andy Lily’s private-key
encrypt[SHA256(Lily needs to pay
£50 to Andy)]
20. 20
Transaction Digital Signature
Bill paid BTC50 to Lily Bill’s private-key
encrypt[SHA256(Bill paid BTC50
to Lily)]
Bill paid BTC50 to Lisa Bill’s private-key
encrypt[SHA256(Bill paid BTC50
to Lisa)]
Bill paid BTC50 to Lily -> Lily paid
BTC50 to Andy
Lily’s private-key
encrypt[SHA256(Bill paid BTC50
to Lily -> Lily paid BTC50 to Andy)]
21. When Andy is receiving
BTC50 >= BTC50
SHA256(the message) = Hash1
Use Lily’s public-key
decrypt[record signature] =
Hash2
Hash1 == Hash2
21
When Lily is paying
The message:
Bill paid BTC50 to Lily -> Lily paid
BTC50 to Andy
Record signature:
Lily’s private-key
encrypt[SHA256(Bill paid BTC50
to Lily -> Lily paid BTC50 to
Andy)]
Payee publick-key:
Lily’s public-key
22. 22
Transaction Digital Signature
Bill’s UID paid BTC50 to Lily’s
UID
Bill’s private-key
encrypt[SHA256(Bill’s UID paid
BTC50 to Lily)]
Bill’s UID paid BTC50 to Lisa’s
UID
Bill’s private-key
encrypt[SHA256(Bill’s UID paid
BTC50 to Lisa’s UID)]
Bill’s UID paid BTC50 to Lily’s
UID -> Lily’s UID paid BTC50 to
Andy’s UID
Lily’s private-key
encrypt[SHA256(Bill’s UID paid
BTC50 to Lily’s UID -> Lily’s UID
paid BTC50 to Andy’s UID)]
27. 27
There are many miners so there are many new blocks
generated
Solution:
By requiring the miners to complete a math task before
broadcasting to the network. The task is complicated so that in
every ten minutes there’s only one miner can solve it in the
entire network. It limits the amount of new blocks in an interval
time period.
28. 28
Task step 1:
Get a string A derived from (SHA256 of the previous block +
new block metadata + all transactions in the new block)
The SHA256 of the previous block means the output of
SHA256(all the information of the previous block)
In Blockchain, every block has its previous block’s SHA256.
Blockchain is using the previous block’s SHA256 to link all
blocks as a unique chian.
29. Task step 2:
Find a RANDOM number (called Nonce, number used once),
append this number to the end of the step 1 string A as a new
string B.
SHA256(string B) outputs a 256-bit binary numbers, if the
leading 72 bits are all 0s, this random number is right and task
completed.Otherwise, try another random number.
It requires on average 2**72 times of calculation in order to find
the correct number.
29
30. 30
Created by the miner
Add the Nonce to the new
block
All nodes on the network
validate the new block:
SHA256(SHA256 of the
previous block + new block
metadata + all transactions in
the new block + the Nonce)
32. 32
Three consensus problems:
1. Synchronisation
a. The entire network maintains only the longest blockchain
b. When BitcoinWallet is connected to the network, automatically
requests the missing blocks, validate then add to own
blockchain
2. Manipulation
a. Any change to any block, the SHA256 of the block is changed
so the chain is broken.
b. Hacker could create a new longest chain only if the hacker has
the computing capacity to defeat more than 50% of the entire
network.
3. Double spend
a. Check if the BTC is used in the previous transactions
33. Blockchain usages
33
User profile data. Stores in blockchain,
customers to control what to sell/share,
how much they worth. All the trusted
information.
IoT to collect data, Blockchain to
transfer trusted data, AI to process the
data
Why would miners are willing to upgrade the devices, validate the transactions?
The whole world comes for profit
Reward BTC 12.5 if the new block is added
The transaction fee in the block is BTC 1-4
On average each new block miner awards 14.5 BTC, total xxx