Académique Documents
Professionnel Documents
Culture Documents
1
Speakers
› Dr. Lawrence Ma
– President of the Hong Kong Blockchain Society and CEO of
eMALI.IO Limited
2
Agenda
› “I Owe yoU” (IOU) scenario
› What is Blockchain?
› Blockchain Applications
› Technical Challenges
› Blockchain Technologies
3
Imagine… I have some money.
How can I manage
my expense
properly?
Dennis
4
OK. I create my
ledger to record my
earnings and
spending.
Dennis
5
Dennis’ ledger
6
Today…
Dennis You
7
Dennis’ ledger
8
Please repay $1000 to me
by this month. I have
recorded it to my ledger.
Dennis You
9
At the end of this month…
Dennis You
11
Dennis’ ledger
12
The Ultimate Problem in Information Security
Source: https://www.tcpvid.com/establish-know-like-trust/
13
Security Requirements
› Integrity
– It includes both the correctness and the trustworthiness of the
data
› Availability
– The ability to use the information or resource desired
› Others?
– The C.I.A. model?
14
There are many transactions
Dennis’ ledger
Who should
Lend to “You”: $3000 (8 Mar
2018)
maintain the
ledger?
15
Proposed Solution
Maintain a public
ledger to record all
transactions. How?
16
Public Ledger
Public ledger
Dennis owes
A $1000
B owes C
$1000
C owes A
$400
D owes B
$123
17
Blockchain
› Originally proposed by “Satoshi Nakamoto” in 2008
– Paper: “Bitcoin: A Peer-to-Peer Electronic Cash System”
– Open sourced in Jan 2009
› Used extensively in cryptocurrency like Bitcoin
› But the core concepts can be extended to applications in
which there are numerous transactions
– Receive cash in payment of an invoice owed by a customer
– Submit tax return to the government
– Sell electricity back to utility company
18
Blockchain – A high-level view
› A chain of blocks
– Essentially a data structure in computer science
› Linked List?
› Block
– Contain information that are to be recorded in the ledger
– E.g., Who are involved? What did they do? What information are
involved?
› Chain
– The blocks are “linked” or “tied” together to indicate the
relationship of the blocks
– The whole chain forms the ledger
19
A block is tied to
previous block
Blockchain – A high level view
Each block
contains data
20
Blockchain – A more in-depth view
22
Requirements for Hash Functions
1. It can be applied to any sized message M
2. It produces fixed-length output h
3. It is easy to compute h = H(M) for any message M
4. Given h is infeasible to find x s.t. H(x) = h
– one-way property
5. Given x, it is infeasible to find y s.t. H(y) = H(x)
– weak collision resistance
6. It is infeasible to find any x, y s.t. H(y) = H(x)
– strong collision resistance
Practical Implementations of Hash Functions
› Secure Hash Algorithm (SHA-1)
– 160-bit output
24
Generating a SHA-1 hash value
› https://support.microsoft.com/en-us/help/841290
25
Blockchain – A more in-depth view
Block 4
Block 2 Block 3
Block 1 (Tx5, Tx6,
(Tx2, Tx3) (Tx4)
(Tx1) Tx7)
6653a7d4 2fe398f1e 96498cdc
1a5af825e bced1660 5a5ebd62
4b08e63e 87362626 5b6c13c2
5b234629 241b95efe 3c8bb20fc
ce294be aab407 cd96583
Note: Tx - Transaction 26
What if someone tries to modify an existing
record?
Block 4
Block 2 Block 3
Block 1 (Tx5, Tx6,
(Tx2’, Tx3) (Tx4)
(Tx1) Tx7)
6653a7d4 2fe398f1e 96498cdc
1a5af825e bced1660 5a5ebd62
4b08e63e 87362626 5b6c13c2
5b234629 241b95efe 3c8bb20fc
ce294be aab407 cd96583
627907f4dca1446096b9f3c078cc5ef2ffbb3092
The hash stored in Block 3 does not match with that of
block 2 and thus the modification is detected.
27
What if someone tries to modify an existing
record?
› The attacker has to compute the subsequent blocks’
hashes, starting from Block 2.
› To increase the difficulty of forging the blocks, the hash
begins with a number of zero bits.
– The average work required is exponential in the number of zero
bits required and can be verified by executing a single hash.
› E.g., 0000000000a1446096b9f3c078cc5ef2ffbb3092
– If a majority of CPU power is controlled by honest participates of
the chain, the honest chain will grow much faster than the forged
chain.
28
Blockchain: Distributed
Node
Node
Node
Node
29
Nonce
› Since the data in a block is fixed, a Nonce (number) is
included in a block to make sure the output hash satisfies
the leading zero(s) requirement.
– Called “mining” in cryptocurrency
› Choose the Nonce randomly or increment the previous
Nonce by 1 and hash the block again.
30
How to maintain a consistent view?
Block 4
Block 2 Block 3
Block 1 (Tx5, Tx6,
(Tx2, Tx3) (Tx4)
(Tx1) Tx7)
6653a7d4 2fe398f1e 96498cdc
1a5af825e bced1660 5a5ebd62
4b08e63e 87362626 5b6c13c2
5b234629 241b95efe 3c8bb20fc
ce294be aab407 cd96583
Block 2
Block 1 Longest chain rule:
(Tx2’, Tx3)
(Tx1) This is the “real” blockchain.
627907f4
dca14460
96b9f3c07
8cc5ef2ffb
b3092 31
Blockchain – Security Revisited
› Recall the ledger example, we require:
› Integrity
– Malicious changes to the ledger is not possible
Blockchain makes sure the blocks are related to each other by
using cryptographic hash functions
› Availability
– All nodes share the same copy of the ledger
Blockchain allows nodes to have a copy of it, and examine and
verify the data stored in the chain.
32
Blockchain Applications – Cryptocurrency
› Bitcoin
› First decentralized cryptocurrency
– Peer-to-peer, transactions take place between users directly
– Transactions are verified by network nodes and recorded in a
public ledger
› Original application of Blockchain in “Satoshi Nakamoto”
‘s paper
33
There are over 1000 cryptocurrencies now...
34
Sources: https://coinmarketcap.com/all/views/all/
Blockchain Applications – DLT in Banks
› Project Ubin: Central Bank Digital Money using Distributed
Ledger Technology
› Singapore Monetary Authority (MAS) develops a
dedicated blockchain trading platform with the goal of
building a financial blockchain ecosystem on its platform
› The platform connects multiple banks and MAS to
achieve "cross-bank, cross-industry and cross-border"
transactions
› Details: http://www.mas.gov.sg/Singapore-Financial-
Centre/Smart-Financial-Centre/Project-Ubin.aspx
Other Applications
Application Property Problems Solved
Insurance Claim Untampered global history Multiple version of data,
Double claim
Trade Finance Data Transparency Risk due to lack of information
about customer
39
UTXO
› In the Bitcoin network,
› A UTXO is the amount that is transferred to a Bitcoin address
during a transaction.
› Received amounts (UTXOs) are used individually during a
transaction and new outputs are created
– one for the receiver and,
– if applicable, one for the amount that is left over (change output).
› The amount sent to the recipient becomes a new UTXO in the
recipient’s address while the change output becomes a new
UTXO in the sender’s address that may be used in a future
transaction.
40
UTXO
› Example
20 18 PKBob 10
Alice
20 18 PKAlice 2.5
41
Blockchain Technologies – Merkle Tree
› A Merkle tree is a hash-based data structure
› It is a tree structure in which each leaf node is a hash of
data, and each non-leaf node is a hash of its children.
42
Source: https://brilliant.org/wiki/merkle-tree/
Blockchain Technologies – Merkle Tree
› Spent transaction should be removed to save disk space
› But still we need the transaction data for future
verifications
› Thanks to the one-way and weak collision resistant
properties of hash functions, we can store the hash of the
transaction data only
› Refer to the example in the next slide
43
44
Blockchain Technologies – Smart Contract
› a.k.a. Distributed Applications
(DAPP)
› Coined by Nick Szabo
› Code, but not document!
› Computer code is like a contract
if money received == $8
&& the button pressed is "Diet Coke"
then release Diet_Coke
45
Smart Contract – Example
46
Smart Contract
› If blockchains give us distributed trustworthy storage,
then smart contracts give us distributed trustworthy
calculations
› The code stored and synchronized in blockchain, which is
triggered by user initialized special transaction, and
– executed concurrently by consensus nodes
47
Key Players
› Open-source community
– Ethereum
› Oldest open source public blockchain started in 2013
– Hyperledger
› Hosted by the Linux foundation since 2016
› Members include IBM, Intel
– Corda
› Released since end of 2016
› Developed by R3, an enterprise software firm working with over 100 banks,
financial institutions, regulators, trade associations, professional services
firms and technology companies
– and more: https://medium.com/blockchain-blog/17-
blockchain-platforms-a-brief-introduction-e07273185a0b
Coming up next week
› Introduction to Corda
› Experiencing the Programming Environment in Corda
› Experience the IOU (I Owe yoU) case in Corda
49
Pre-reading
› Corda Introduction
– https://www.corda.net/wp-content/uploads/2017/10/Corda-
Solution-Guide.pdf
› Intro white paper
– https://docs.corda.net/_static/corda-introductory-
whitepaper.pdf
› Technical white paper
– https://docs.corda.net/_static/corda-technical-whitepaper.pdf
› IDE Installation and setup
– https://docs.corda.net/getting-set-up.html
50