0% found this document useful (0 votes)
75 views151 pages

Slide Chuỗi Khối

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views151 pages

Slide Chuỗi Khối

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 151

Blockchain

Lecture 0 - Course Introduction

aaaaaaaaaaaaaaaaaaaaaaaaaaa

November 25, 2022

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 1 / 12


Content

1 Pre-requisites
2 Course outline
3 Key topics
4 Course materials
5 Grading (plan)
6 Instructor’s contact
7 Academic policy
8 How to study?

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 2 / 12


Prerequisites

1 Pre-courses:
1 Programming fundamentals: skills related to structured programming
2 OOP: skills related to object-oriented programming
3 Data structures and algorithms: skills related to the implementation
and usage of basic data structures and algorithms (e.g., Lists, Trees,
Hash tables, sorting and searching, etc.)
4 Basic knowledge about cryptography is a plus

2 English:
not require an English certificate, but
good enough to read course materials.

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 3 / 12


Course outline

This course provides students with:

1 background knowledge of concepts and principles of the blockchain


technology
2 neccessary skills for designing and implementing applications based on
blockchain technology such as smart contracts
3 an overview of methods for developing decentralized applications
(DApps) on the blockchain in practice
4 information about the ongoing specific industry-wide blockchain
frameworks, especially in ecnonomic and finance

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 4 / 12


Key topics

1 Overview of related data structures and algorithms


2 Basic components of a blockchain:
transaction, block, block header, and the chain

3 Blockchain operations and underlying algorithms:


verification, validation, consensus model, essentials of trust
4 Smart contracts
5 Decentralized applications (DApps)
6 Blockchain flatforms
7 Implement a very first blockchain via JAVA

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 5 / 12


Course materials
Textbook:
Liebi, Luca. (2021). Antony Lewis: The basics of bitcoins and
blockchains. Financial Markets and Portfolio Management
Fatima Castiglione Maldonado. (2018). Introduction to Blockchain
and Ethereum: Use distributed ledgers to validate digital transactions
in a decentralized and trustless manner. Packt Publishing.

Lecture slides and tutorials


Delivered during the course

Course website:
http://lms.buh.edu.vn

Tools:
Java Programming Environment
Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 6 / 12
Grading (plan)

Maximum score: 10
Assessments:
Class attendance (C) (10%)
Progress tests/Group work (P) (20%)
Midterm tests (M) (20%)
Final exam (FE) (50%)
Total score = 0.1*C + 0.2*P + 0.2*M + 0.5*FE

Pass if you satisfy ALL requirements below:


Attend at least 40% of class lectures
If you are absent in the lecture that has a progress test, then your score
is zero. This means you are failed the course.
Total score ≥ 5

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 7 / 12


Instructor’s contact

Instructor: Vo Duc Vinh (Ph.D)


Department of Economic Mathematics - Hochiminh city University of
Banking
Email: vinhvd@hub.edu.vn
Email subject: [Blockchain]-<Title>
Face to face discussion is always WELCOME

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 8 / 12


How to study?

Before classes:
Reading textbooks and related documents.
Read lecture slides.

Attend lectures
Listen, understand, then make your own notes
Give your explanation about some topics in lectures
Ask questions
Give some examples that are not existed in your books
Practice all the exercises to make your sense

After classes
Discuss your classmates directly or on forum
Analyze, design and implement workshops and assignments
Build your teams to support together in studying
Complete chapter assessments in time (programs and/or reports).

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 9 / 12


Academic policies

Cheating, plagiarism and breach of copyright are serious offenses under


this policy.
Cheating
Cheating during a test or exam is construed as talking, peeking at
another student’s paper or any other clandestine method of
transmitting information.

Plagiarism
Plagiarism is using the work of others without citing it; that is, holding
the work of others out as your own work.

Breach of copyright
If you photocopy a textbook without the copyright holder’s permission,
you violate copyright law.

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 10 / 12


Enjoy the course!

Be enthusiastic about the material because it is interesting, useful


and an important part of computer-aided decision making.

Our job is to help you learn and enjoy the experience. We will do our
best but we need your engagement too.

So let’s enjoy the course.

Oh, noop! I am not good of programming, also not a computer


science student ==> Don’t worry that much.

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 11 / 12


B B B B B

B B B B B

B B
Q&A B B

B B B B B

B B B B B

Duc Vinh VO (BUH) Lecture 0 - Course Introduction November 25, 2022 12 / 12


ĐẠI HỌC NGÂN HÀNG THÀNH PHỐ HỒ CHÍ MINH

BLOCKCHAIN

THÀNH PHỐ HỒ CHÍ MINH, 2022


OUTLINE

1. Introduction to Cryptographic Digital Money, Ledger, Bitcoin


2. Cryptography and cryptocurrency
3. Consensus protocol and mining
4. Transactions and Transaction processing in blockchain
5. Contract and Smart contract
6. The future of blockchain technology
7. Writing very first blockchain in JAVA

2
ĐẠI HỌC NGÂN HÀNG THÀNH PHỐ HỒ CHÍ MINH

Chapter 1

INTRODUCTION TO
CRYPTOGRAPHIC DIGITAL MONEY,
LEDGER, BITCOIN

TP. HCM 2022


WHAT YOU WISH TO LEARN?
1. Technological Understanding
• Understand Blockchain Technology
• Understand the blockchain ecosystem (ICOs, currencies, etc.)
• Benefits, risks, challenges and next steps of blockchain

2. Application
• Understand blockchain applications
• Learn to apply blockchain to areas of interest
• Think about new applications of blockchain

4
WHAT YOU WISH TO LEARN?
3. Impact
• Understand blockchain impacts on internet, business, and finance
• Implications in people’s lives

4. Regulation
• How will regulation and public policy change and need to change
• Learning about regulations
5. Market & Money
• Make money
• Investment
• Trends and top influencers in the market
5
SURVEY

§ Assess how realistic it is for blockchain to traditional systems


§ Specific blockchain startup success/failure stories and why
§ Get a startup idea
§ Application to international trade supply chains
§ When to use and when not to use
§ How blockchain can improve financial system
§ Assets tokenization

6
Study Questions

§ What is a blockchain as an overview?


§ What is money? Role of money? Characteristics of money?
§ What is ledgers? Characteristics of good ledgers?
§ What is a payment system? Its entities? Potential issues?
§ Group of 3 or 4 students:
§ self-study and take notes: 45 minutes
§ discussion: 45 minutes

7
NON-METAL MONEY

Salt Bars - Ethiopia Cowrie Shells - Nigeria

Tally Sticks - England Rai Stones - Yap


8
METAL MONEY

Bronze Aes Rude - Rome Bronze Spade - China

Cooper Plate - Sweden


9
MINTED MONEY

Silver Dekadrachm - Gold Aureus - Rome


Bronze Yuan - China
Greece

10
PAPER MONEY

5 Pound Note - England Continental Note – U.S.

Jiaozi Promissory Note -


China
11
PRIVATE BANK NOTES

Australia USA

Canada England 12
What is money?

§ Money is any substance that serves as a medium of


exchange, store of value, or unit of account
§ It must be accepted by everyone in a society
§ Fiat money - money issued by government decree

13
What is the role of money?

§ Medium of exchange: an item that can be traded for


another good or service
§ Store of value: allows purchasing power to be used
over time
§ Unit of account: a common denominator that can be
used to express worth
14
Characteristics of money?

To be a successful medium of exchange, money must be:


§ Portability: easily transferred from one to one
§ Durability: does not deteriorate when handled often
§ Divisibility: easily split/merge into smaller/larger
denominations
§ Limited supply: money loses value if there is too much
15
LEDGERS

Personal Ledger
Proto Cuneiform George Washington
Uruk, ca 3000 B.C 1747

Principal Recordings of Accounts:


Ø Economic Activities
Ø Financial Relationships
16
CHARACTERISTICS OF GOOD LEDGERS

§ Immutable, Consistency
§ Timestamped
§ Ownership
§ Accuracy
§ Description of Transaction
§ Comprehensive
17
What is a payment system?

Ø A method to amend &


record changes in ledgers for
money

Ø Any system used to settle


financial transactions
through the transfer of
monetary value [wikipedia]

Ø Potential issues in online


payment systems? Image from https://www.tcmb.gov.tr

18
EARLY CRYPTOGRAPHIC DIGITAL CURRENCIES

§ DigiCash (David Chaum) – 1989


§ Mondex (National Westminster Bank) – 1993
§ CyberCash (Lynch, Melton, Crocker & Wilson) – 1994
§ E-gold (Gold & Silver Reserve) – 1996 FAILED
§ Hashcash (Adam Back) – 1997
§ Bit Gold (Nick Szabo) – 1998
§ B-Money (Wei Dai) – 1998
§ Lucre (Ben Laurie) – 1999
19
WHY DID EARLY DIGITAL CURRENCIES FAIL?

§ Merchant adoption
§ Centralization
§ Double spending
§ Consensus

20
DIGITAL & MOBILE PAYMENTS

2007 1999 2003 2007

2011 2011 2013 2014

👉 Have you ever used one of the above payment method?


21
THE RIDDLE REMAINED

§ P2P transactions
§ Without trusted central intermediary
Bitcoin: A Peer-to-Peer Electronic Cash System (2008)
Satoshi Nakamoto: “I've been working on a new electronic cash
system that's fully peer-to-peer, with no trusted third party”

22
DISTRIBUTED DATABASES vs DISTRIBUTED
LEDGER
Centralized relational databases:
§ (Multiple) clients talk to central server
§ Server manages competing requests, assigns priority, prevents conflicts
§ Examples: web server

Distributed databases:
§ Distribute storage of information across multiple locations
§ Distributed consensus algorithm is used to ensure consistency
§ Examples: 2PC, 3PC, Paxos

Distributed ledgers: adds additional features


§ Complete (unalterable) history of transactions
§ Protection against (Byzantine) attack
23
DISTRIBUTED DATABASES vs
DISTRIBUTED LEDGER

24
BITCOIN

Bitcoin = mechanism for maintaining a distributed ledger of payment transactions

25
DATA STORING

26
BLOCKCHAIN - A NEW LAYER?

Blockchain 2009

SSL/TLS 1996

HTTP 1990

TCP/IP 1974

Ethernet 1974
27
BLOCKCHAIN – WEB 3.0?

28
DISCUSSION

29
ĐẠI HỌC NGÂN HÀNG THÀNH PHỐ HỒ CHÍ MINH

Chapter 2

CRYPTOGRAPHY
AND
CRYPTOCURRENCY

TP. HCM 2022


OVERVIEW
§ Blockchain definition
§ Bitcoin Design Features
§ Cryptographic Hash Functions
§ Timestamped Append-only logs
§ Block Headers & Merkle Trees
§ Asymmetric Cryptography & Digital Signatures
§ Bitcoin Addresses 2
Study Questions

§ What is distributed ledger technology (DLT)?


§ The relationships between blockchain and DLT?
§ What is a block, transactions?
§ Types of blockchains?
§ Advantages & Disadvantages of Blockchains?
§ Potential applications of blockchain in practice?
§ Group of 3 or 4 students:
§ self-study and take notes: 25 minutes
§ discussion: 25 minutes 3
Blockchain - Definition
§ A blockchain is a type of distributed ledger technology (DLT) that consists
of growing list of records, called blocks, that are securely linked together
using cryptography [wikipedia].
§ Each block contains:
§ a timestamp
§ a cryptographic hash of the previous block,
§ transaction data (generally represented as a Merkle tree, where data
nodes are represented by leaves)
§ Types of blockchains:
§ Public Blockchains
§ Private Blockchains
§ Hydrid blockchains (consortiums)
§ Sidechains
4
Blockchain - An Instance

Structure of Bitcoin blockchain (image: wikipedia)


5
Blockchain - Types

§ Public blockchains:
§ open, decentralized networks of computers accessible to anyone who want
to request or validate a transaction (check for accuracy)
§ Those (miners) who validate transactions receive rewards.
§ Proof-of-work or proof-of-stake consensus mechanisms are used.
§ Examples: the Bitcoin and Ethereum (ETH) blockchains.

6
Blockchain - Types
§ Private blockchains:
§ NOT open, they have access restrictions
§ Require a permission from the system administrator to join
§ They are typically governed by one entity, meaning they’re centralized
§ Example: Hyperledger is a private, permissioned blockchain

7
Blockchain - Types
§ Hybrid blockchains (consortiums):
§ a combination of public and private blockchains
§ contain centralized and decentralized features.
§ Example: Dragonchain, Energy Web Foundation, and R3.

8
Blockchain - Types
§ Sidechains:
§ a blockchain running parallel to the main chain.
§ allows users to move digital assets between two different blockchains
§ improves scalability and efficiency.
§ Example: the Liquid Network.

9
Blockchain - How it works

Image by http://www.blockgeeks.com 10
Benefits of Blockchain Over Traditional Finance
§ Trustless
§ Unstoppable
§ Immutable
§ Decentralized
§ Lower Cost
§ Peer-to-Peer
§ Transparent
§ Universal Banking

11
Disadvantages of Blockchain
§ Environmental Impact
§ Personal Responsibility
§ Growing Pains
§ False Narratives

12
Applications of Blockchain
§ Cryptocurrencies: Bitcoin, Ethereum, etc.
§ Smart Contracts
§ Decentralized Banking
§ Video Games/Art
§ Peer-to-peer Energy Trading
§ Supply chain and logistics tracking
§ Healthcare process optimization

13
Applications of Blockchain
§ Real estate processing platform
§ NFT marketplaces: These are marketplaces that allow you to buy nonfungible
tokens (NFTs) è “FTX sập rồi”
§ Music royalties tracking
§ Personal identity security
§ Automated Advertising Campaigns

14
BITCOIN DESIGN FEATURES
Cryptography & Timestamped Logs
§ Cryptographic Hash Func1ons
§ Timestamped Append-only Logs (Blocks)
§ Block Headers & Merkle Trees
§ Asymmetric Cryptography & Digital Signatures
§ Addresses
Decentralized Network Consensus
§ Consensus through Proof of Work
§ Network of Nodes
§ Na1ve Currency
Transac>on Script & UTXO
§ Transac1on Inputs & Outputs
§ Unspent Transac1on Output (UTXO)
§ Scrip1ng language 15
CRYPTOGRAPHIC HASH FUNCTIONS
Hash = Digital Fingerprints for Data
General Properties
§ Maps Input x of any size to an Output of fixed size – called a ‘Hash’
§ Deterministic: Always the same Hash for the same x
§ Efficiently computed

Cryptographic Properties
§ Preimage resistant (One way): infeasible to determine x from Hash(x)
§ Collision resistant: infeasible to find and x and y where Hash(x) = Hash(y)
§ Avalanche effect: Change x slightly and Hash(x) changes significantly
§ Puzzle friendliness: knowing Hash(x) and part of x it is still very hard to find
rest of x 1
16
CRYPTOGRAPHIC HASH FUNCTIONS
Hash = Digital Fingerprints for Data
Use cases
§ Hash password before storing in database
§ Verify data integrity when receiving
§ Using as reference
§ Using in digital signature

Bitcoin hash functions


§ Headers & Merkle Trees – SHA 256
§ Bitcoin Addresses – SHA 256 and RIPEMD160
Hash calculator online
17
TIME-STAMP DIGITAL DOCUMENT

18
TIME-STAMP DIGITAL DOCUMENT

WHY TIME-STAMP?
§ Bind a signed document to a parWcular date and Wme
§ Prove in the future that the signed document existed at this parWcular date
and Wme.
§ Ensure the accuracy of the date and the Wme it indicates and the integrity of
the data to which the date and Wme are bound

USE CASE
§ Digital signature for contract

19
TIME-STAMP DIGITAL DOCUMENT

WHY TIME-STAMP?
§ Bind a signed document to a particular date and time
§ Prove in the future that the signed document existed at this particular date
and time.
§ Ensure the accuracy of the date and the time it indicates and the integrity of
the data to which the date and time are bound

USE CASE
§ Digital signature for contract

20
TIMESTAMPED APPEND-ONLY - BLOCKCHAIN

GENESIS BLOCK

0000000…0000

21
BLOCK HEADER

§ Version
§ Previous Block hash
§ Merkle Root hash
§ Timestamp
§ Difficulty target
§ Nonce

22
MERKLE TREE
Binary Data Tree with Hashes

23
SYMMETRIC & ASYMMETRIC CRYPTOGRAPHY

SYMMETRIC ENCRYPTION

24
SYMMETRIC & ASYMMETRIC CRYPTOGRAPHY

ASYMMETRIC ENCRYPTION

25
ASYMMETRIC CRYPTOGRAPHY & DIGITAL
SIGNATURES

26
BITCOIN ADDRESSES

27
Bitcoin explorer
BITCOIN ADDRESSES

Sign transaction with private key Verify transaction with public key
-----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PUBLIC KEY-----
MIIBOgIBAAJBAKj34GkxFhD90vcNLYLInFEX6Ppy1tPf9Cnzj4p4WGeKLs1Pt8Qu MEgCQQCo9+BpMRYQ/dL3DS2CyJxRF+j6ctbT3/Qp84+KeFhnii7NT7fELilKUSnx
KUpRKfFLfRYC9AIKjbJTWit+CqvjWYzvQwECAwEAAQJAIJLixBy2qpFoS4DSmoEm S30WAvQCCo2yU1orfgqr41mM70MBAgMBAAE=
o3qGy0t6z09AIJtH+5OeRV1be+N4cDYJKffGzDa88vQENZiRm0GRq6a+HPGQMd2k -----END RSA PUBLIC KEY-----
TQIhAKMSvzIBnni7ot/OSie2TmJLY4SwTQAevXysE2RbFDYdAiEBCUEaRQnMnbp7
9mxDXDf6AU0cN/RPBjb9qSHDcWZHGzUCIG2Es59z8ugGrDY+pxLQnwfotadxd+Uy
v/Ow5T0q5gIJAiEAyS4RaI9YG8EWx/2w0T67ZUVAw8eOMB6BIUg0Xcu+3okCIBOs
HASH SHA 256
/5OiPgoTdSy7bcF9IGpSE8ZgGKzgYQVZeN97YE00
61087f7e8804c5361dd0291c2dd4083a6d28014a999b43c981a42435cf0fce00
-----END RSA PRIVATE KEY-----

HASH RIPEMD 160


First 4 bytes 2x SHA 256
09bcbf6b 21799c282798d07dc5cf385d5fe2fcb7c5e91a53
(8 hex digits)

Bitcoin address
base58
3xVUrcYNkxtrpgeD6Lez2QbfZGW7g3MDWTV34mZy 21799c282798d07dc5cf385d5fe2fcb7c5e91a5309bcbf6b

28
Bitcoin explorer
QUESTIONS

§ Why bitcoin need time-stamp and hash?


§ Why we need seed phrase instead of password to initiate
blockchain transaction?

29
DISCUSSION

30
ĐẠI HỌC NGÂN HÀNG THÀNH PHỐ HỒ CHÍ MINH

Chapter 3

CONSENSUS PROTOCOL
AND
MINING
TP. HCM 2022
OVERVIEW

§ The Byzantine Generals Problem


§ Proof of Works
§ Proof of Stakes
§ Crypto currency mining

2
THE BYZANTINE GENERALS PROBLEM

The abstract problem:


§ Each division of Byzantine army is directed by its own general.
§ There are n Generals, some of which are traitors.
§ All armies are camped outside enemy castle, observing enemy.
§ Communicate with each other by messengers.
§ Requirements:
o G1: All loyal generals decide upon the same plan of action
o G2: A small number of traitors cannot cause the loyal generals to
adopt a bad plan
§ Note: We do not have to identify the traitors.
3
THE BYZANTINE GENERALS PROBLEM

4
SOLUTION I: ORAL MESSAGES

A commanding general must send an order to his n-1


lieutenant generals such that:
Ø All loyal lieutenants obey the same order
Ø If the commanding general is loyal, then every loyal
lieutenant obeys the order he sends

5
L. Lamport, R. Shostak, and M. Pease, “The Byzantine generals problem,” ACM TOPLAS, vol. 4, pp. 382–401, July 1982.
SOLUTION I: ORAL MESSAGES

COMMANDER

v v
v

v x
LEUTENANT 1 LEUTENANT 2 LEUTENANT 3
v v
traitor

Final decision = majority(v,v,x) = v


6
L. Lamport, R. Shostak, and M. Pease, “The Byzantine generals problem,” ACM TOPLAS, vol. 4, pp. 382–401, July 1982.
SOLUTION I: ORAL MESSAGES
traitor
COMMANDER

x z
y

x z
LEUTENANT 1 LEUTENANT 2 LEUTENANT 3
y y

Final decision = majority(x,y,z) = default decision (retreat)

7
L. Lamport, R. Shostak, and M. Pease, “The Byzantine generals problem,” ACM TOPLAS, vol. 4, pp. 382–401, July 1982.
SOLUTION II: SIGNED MESSAGES

A signed message satisfies all the conditions of


oral message, plus two extra conditions:
§ Signature cannot be forged. Forged message
are detected and discarded by loyal generals.
§ Anyone can verify its authenticity of a
signature.
Signed messages improve resilience.
8
SOLUTION II: SIGNED MESSAGES

COMMANDER
COMMANDER

traitor

1{0} 1{0}
1{0} 0{0}

0{0,2}
traitor 0{0,2}

LEUTENANT 1 LEUTENANT 2 1{0,1}


LEUTENANT 1 LEUTENANT 2

discard

9
SOLUTION II: SIGNED MESSAGES
SIGNATURE PATH

v{0}
1
4
0 v{0,1}
v{0,1,5,4}
v{0,1,5}
5
6

v{0,1,5,4,6}

2 v{0,1,5,4,6,3}

10
BLOCKHAIN CONSENSUS – PROOF OF WORK

difficulty

11
BLOCKHAIN CONSENSUS – PROOF OF WORK

difficulty

12
BLOCKHAIN CONSENSUS – PROOF OF WORK

Pros Cons
Better ability to be Slower transaction
decentralized speeds

Higher costs to
Better security
validate transactions

Higher energy
consumption
13
BLOCKHAIN CONSENSUS – PROOF OF STAKE

14
BLOCKHAIN CONSENSUS – PROOF OF STAKE

15
BLOCKHAIN CONSENSUS – PROOF OF STAKE

Pros Cons
Less energy Harder to truly
consumption decentralize the
network
Less security than
Financial opportunities
PoW

Faster transaction
speeds
16
BLOCKHAIN CONSENSUS

17
BLOCKHAIN CONSENSUS

18
BITCOIN PROOF OF WORK DIFFICULTY

§ Targets 10 minute average block generation time


§ Defined by the # of leading zeros Hash output requires to solve PoW
§ Adjusts every 2016 blocks - about every two weeks
§ Currently, > 18 leading zeros (out of 64 hexadecimal characters)

§ Block 749,952 (08/26/2022)- 19 leading zeros


00000000000000000007edd9a88903ad4f948bf3def71a520635ec769065429a
§ Genesis Block (1/3/09) – 10 leading zeros, though only required 8
000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

19
https://www.blockchain.com/
BITCOIN PROOF OF WORK DIFFICULTY

20
https://btc.com/stats/diff
EVOLUTION OF BITCOIN MINING

GPU ASIC
2009 2010 2010 2013 2014
CPU Mining pools Mining farms

21
BITCOIN MINING

22
BITCOIN MINING

23
BITCOIN MINING REWARDS

Starts at 50 BTC / mined block Current: 6.25 BTC / mined


block
24
Halves every 210,000 blocks
BITCOIN NETWORK

§ Full Nodes – Store full Blockchain & able to Validate all Transactions
§ Pruning Nodes – Prune transactions after validation and aging
§ Lightweight Nodes - Simplified Payment Verification (SPV) nodes –
Store Blockchain Headers only
§ Miners – Performs Proof of Work & Create new Blocks - Do not need
to be a Full Node Mining Pool Operators
§ Wallets – Store, View, Send and Receive Transactions & Create Key
Pairs
§ Mempool – Pool of unconfirmed (yet validated) Transactions

25
READINGS

1. Narayanan, A., & Clark, J. (2017). Bitcoin's academic


pedigree. Communications of the ACM, 60(12), 36-
45. https://doi.org/10.1145/3132259
2. Ethereum white paper

26
DISCUSSION

27
ĐẠI HỌC NGÂN HÀNG THÀNH PHỐ HỒ CHÍ MINH

Chapter 4

TRANSACTIONS
AND
TRANSACTION PROCESSING
TP. HCM 2022
OVERVIEW

§ Transaction Input and Output Explanation


§ Unspent Transaction Output
§ Blockchain Design

2
TRANSACTION FORMAT

3
TRANSACTION FORMAT

4
TRANSACTIONS

5
COINBASE TRANSACTION
RECAP
GENESIS BLOCK

0000000…0000

6
COINBASE TRANSACTION

7
UNSPENT TRANSACTION OUTPUT (UTXO)

Bitcoin transaction outputs that have not been spent at a given time

§ Contains All Currently Unspent Transaction Outputs


§ Speeds up Transaction Validation Process
§ Stored using a LevelDB database in Bitcoin Core called
“chainstate”

8
UNSPENT TRANSACTION OUTPUT (UTXO)

9
UNSPENT TRANSACTION OUTPUT (UTXO)

10
UNSPENT TRANSACTION OUTPUT (UTXO)

11
BLOCKCHAIN DESIGN

12
ĐẠI HỌC NGÂN HÀNG THÀNH PHỐ HỒ CHÍ MINH

Chapter 5

CONTRACT
AND
SMART CONTRACT
TP. HCM 2022
OVERVIEW

§ Contract
§ Smart Contracts
§ Blockchain Design with Smart Contracts
§ Brieft explanation of Dapps, Token, NFT
§ Legal Issues

2
CONTRACT

promise or performance
given in exchange for
promise or performance

3
SMART CONTRACT

X Code is law
4
SMART CONTRACT

“A set of promises, specified in digital form, including


protocols within which the parties perform on these
promises.”
Nick Szabo, 1996

However…
§ Smart Contracts may not be “Smart”
§ Smart Contracts may not be “Contracts“
5
SMART CONTRACT

“A set of promises, specified in digital form, including


protocols within which the parties perform on these
promises.”
Nick Szabo, 1996

However…
§ Smart Contracts may not be “Smart”
§ Smart Contracts may not be “Contracts“
6
SMART CONTRACT

§ Replaces traditional contracts in blockchain context


§ Authority-less autonomous program, that directly
controls numeric securities (digital assets), based on
mutually agreed terms
§ Looks like “if-then” instructions that automatically
evaluate predefined conditions and do transactions
§ Has an owner and a life cycle, and is executed on
Ethereum Virtual Machine (EVM)
7
SMART CONTRACT

Pros Cons
Not suitable for all kinds of
Immutability characteristic
contracts

Simple and only include “if


Autonomy and automaticity
a, then b” patterns
characteristics

BUGS???
8
INTERACTING WITH A SMART CONTRACT

§ Smart contract is not self-executable


§ It requires an external call to be executed. Otherwise, it is
pending till one calls one of its implemented functions
§ Once it is executed, transactions resulting from the
execution are transcribed on the blockchain and
eventually smart contract’s meta data are updated

9
BLOCKCHAIN DESIGN WITH SMART CONTRACTS

10
BLOCKCHAIN DESIGN WITH SMART CONTRACTS

Smart contract

Smart contract

Smart contract execution may or may not change blockchain state

11
USE CASES

§ Lending & borrowing


§ Security
§ Mortgage
§ Supply chain
§ Trade finance
§ …
12
DAPPS & TOKEN
Dapps
§ Applications run on a Decentralized Blockchain Network
§ They generally have a Native Token & Run as a Smart Contract

13
https://dappradar.com/
NFTs
§ NFTs (non-fungible tokens) are unique cryptographic
tokens that exist on a blockchain and cannot be
replicated.
§ NFTs can represent real-world items like artwork and real
estate.
§ "Tokenizing" these real-world tangible assets makes
buying, selling, and trading them more efficient while
reducing the probability of fraud.
§ NFTs can also function to represent individuals' identities,
property rights, and more.
14
INITIAL COIN OFFERING (ICO)

§ Proceeds used to build networks


§ Tokens usually issued prior to being functional
§ Development, while open source, is largely
centralized
§ Promoters allocate themselves ‘premined’ tokens
§ Tokens are fungible & transferable
§ Scarcity is fostered with preset ‘Monetary policy’
§ Purchasers anticipate profits through appreciation
15
INITIAL COIN OFFERING (ICO)

Advantage:
• Young enterprises do not have to wait for months before having the "go"
of an investment fund
Disadvantages:
• Difficult to verify the relevance and quality of a project that does not exist
yet
• Absence of control authority to regulate the market "anyone can issue a
digital title, so there are mechanically a lot of scams of all kinds"
• Volatility of cryptocurrency can quickly raise or lower the amount raised
depending on the technical developments of the platform and of other
exceptional events 16
LEGAL ISSUES

DISCUSSION

17
READINGS

§ Enterprises building Blockchain Confront Early Tech


Limitations
§ Technical difference between Ethereum, Hyperledger
fabric and R3 Corda
§ ‘What is Corda?
§ A Blockchain Plaform for the Enterprise, Introduction
§ What is Digital Asset? / Distributed Ledgers for Financial
Institution
18
ĐẠI HỌC NGÂN HÀNG THÀNH PHỐ HỒ CHÍ MINH

Chapter 6

THE FUTURE OF
BLOCKCHAIN TECHNOLOGY

TP. HCM 2022


OVERVIEW

§ Permissionless vs permissioned blockchain: A review


§ Blockchain use-cases
§ Blockchain – Metaverse and Payment systems

2
CHALLENGES WITH BLOCKCHAIN TECHNOLOGY

§ Performance, Scalability, & Efficiency


§ Privacy & Security
§ Interoperability
§ Governance & CollecEve AcEon
§ Commercial Use Cases
§ Public Policy & Legal Frameworks
3
VITALIK BUTERIN TRILEMMA
SCALABILITY

DECENTRALIZATION SECURITY

4
BLOCKCHAIN – TECHNICAL FEATURES
BITCOIN - PERMISSIONLESS PERMISSIONED
Cryptography & Timestamped Logs YES
§ Cryptographic Hash Functions § ü
§ Timestamped Append-only Logs (Blocks) § ü
§ Block Headers & Merkle Trees § ü
§ Asymmetric Cryptography & Digital Signatures § ü
§ Addresses § ü
Decentralized Network Consensus NO
§ Consensus through Proof of Work § PBFT, Notary Nodes, etc.
§ Network of Nodes § ü
§ Native Currency § ü
Transaction Script & UTXO YES
§ Transaction Inputs & Outputs § ü
§ Unspent Transaction Output (UTXO) § ü
§ Scripting language § ü
5
PERMISSIONED PRIVATE BLOCKCHAINS
Key Design Features
§ Membership Limited to Authorized Nodes
§ Transactions can also be Limited to Authorized Known Participants
§ Data & Ledgers can be Partitioned to Keep amongst Subgroups of Nodes
§ Consensus built on Permissioned, Private Protocols – Globally or Modular
between Transacting Parties.
§ Practical Byzantine Fault Tolerance
§ Delegated Notary Nodes
§ Diverse Protocols – from Protocols for Multi Party Consensus to Crash Fault Tolerant
for 1 Party
§ Uses Cryptography and Registration Authorities to Mask User Data
§ Facilitates Smart Contracts using Chaincode or other Programming Language
§ No Native Currency – Possible, though, with Smart Contracts
§ Code Generally Open Source

6
HYPERLEDGER FABRIC

7
HYPERLEDGER FABRIC

8
HYPERLEDGER FABRIC

A1 - application. L1 - ledger. NC4 - network configuraBon. O4 - ordering service.


P1 - peer node. C1 - channel. R1 - organizaBon. N - Hyperledger network.
S5 - smart contract. CA - certificate authority. CC1 - channel configuraBon. 9
HYPERLEDGER FABRIC vs ETHEREUM
FEATURE ETHEREUM HYPERLEDGER
Confidentiality Public blockchain Private blockchain

Purpose Client-side B2C applications Enterprise-level B2B applications

Governance Ethereum Developers Linux Foundation

Organizations having Certificate of


Participation Anyone
Authorization

Programming Language Solidity Golang, JavaScript, or Java

Consensus Mechanism POW- Proof of Work Mechanism Pluggable consensus mechanism

Speed of Transactions Less More

Cryptocurrency Ether or Ethereum None 10


BLOCKCHAINS vs TRADITIONAL DATABASES
Access Control Protocol
Open Permissionless Mul=ple Permissionless Client – Server

PUBLIC BLOCKCHAIN PRIVATE BLOCKCHAIN TRAND. DBS

§ Public Write Capability § Private Write Capability § Trusted Party host data
§ P2P transactions § Finality of Data in Append § Trusted Party can
§ No Central Intermediaries Only Log “CRUD”
§ Token economics § Public Verifiability § Client – Server
architecture

11
BLOCKCHAIN APPLICATIONS

§ Money transfer § Logis<cs


§ Smart contracts § Non-fungible tokens (NFTs)
§ Internet of Things (IoT) § Government
§ Personal identity security § Media
§ Healthcare

12
FINANCIAL SECTOR POTENTIAL USE CASES

§ Venture Capital - Crowdfunding through Initial Coin Offerings


§ Payment Systems - Cross border, Large interbank, & Retail
§ Loan Issuance & Trade Finance - Digitizing paper-based processes
§ Clearing, Settlement and Processing – Securities & Derivatives
§ Digital IDs and Data Reporting
§ Central Bank Digital Currency & Private Stable Value Tokens

13
USE CASES: ASSESSING COSTS & BENEFITS
Strategic questions?
§ What is the value creation proposition?
§ What problem or ‘pain point’ is being solved?
§ What are competitors doing to address similar ‘pain points’?
§ Why is blockchain technology and native token the best solution?

Specifics of the blockchain technology and native token use case?


§ Which costs of verification or networking can be reduced?
§ Which transactions need recording?
§ Which stakeholders need write and read access to ledgers?
§ What is the customer interface and how is it better than current interface?

14
USE CASES: ASSESSING COSTS & BENEFITS

Costs of technical challenges and transition?


§ What tradeoffs are necessary?
Ø scalability, performance, privacy, security, interoperability &
coordination
§ Can Permissioned blockchain or Traditional Data Base adequately address
use case?
§ How can broad adoption be realized?

Are net benefits sufficient?

15
METAVERSE
The metaverse is a concept of a persistent, online, 3D universe that combines
multiple different virtual and physical spaces. Metaverse is the future iteration
of the internet. The metaverse will allow users to work, meet, game, and
socialize together in these 3D spaces.
Experience Games, Social, Esports, Theater, Shopping
Discovery Ad Networks, Social CuraBon, RaBng, Store, Agents
Creator Economy Design Tools, Asset Markets, Workflow, Commerce
Spatial Computing
3D Engines, VR/AR/XR, GIS
Decentralization

Human
Edge Computing, AI Agents, Microservices, Blockchain
Interface
Mobile, Wearable, HapBc, Gestures, Voice
Infrastructure 5G, 6G, Wifi 6, Cloud, GPUs, Storage

METAVERSE 7 LỚP 16
Understanding the Seven Layers of the Metaverse
METAVERSE

ECONOMIC
SYSTEM

OPENESS UNLIMITED

METAVERSE
PERSONALIZED
IMMERSIVE

PERSISTENT INTEROPERABILITY 17
METAVERSE
Augmented Mix Virtual
Reality Reality Reality
Physical Digital
Reality Holographic Immersive Reality
Mobile phone / devices devices Mobile phone
Tablet (Hololens, Magic (Oculus, HTC (cardboard,
Leap…) Vive…) GearVR)

§ AR/VR is one of various tools to communicate with Metaverse


§ AR/VR applications are NOT Metaverse
§ AR/VR provides a more realistic experience than the traditional way
18
METAVERSE USE-CASES

PHYSICAL WORLD
Proptech Concert
Improve industrial efficiency in the virtual way

Healthcare
Generate new industries to create real value

Education Movies

Create new experiences

Enrich real experiences


Transport
Games
Industry Industrial Consumer
Metaverse Metaverse
Art shows
Digital twin
V-services
Social
V-management
Shopping

VIRTUAL WORLD
19
BLOCKCHAIN & METAVERSE

§ Blockchain promotes the


development of a “flat” economic
system on Metaverse
§ Blockchain supports digital asset
management (NFT, tokens)
§ Blockchain supports automaOc
transacOons through smart
contracts
§ The blockchain economic plaPorm
is “open” to all parOes in Metaverse

20
QUESTIONS

1. What are the tradeoffs of centralized ins<tu<ons and markets


in the financial sector?
2. Which challenges of the financial sector – periodic crises,
concentrated risks, economic rents, legacy systems, processing
risks, financial inclusion – might present opportuni<es for
blockchain applica<ons?
3. How does blockchain technology fit within other trends –
par<cularly with regard to technology - facing the financial
sector?

21
READINGS

1. Sheila Bair on What Hasn’t Changed since the Great Recession

2. The Rise of Market Concentration and Rent Seeking in Financial Sector

3. Ten Years after the Crash, We are Living in a World it Brutally Remade

22
DISCUSSION

23

You might also like