Chuong 03
Chuong 03
BLOCKCHAIN
Nguyen Trung Thong
thongnt@ueh.edu.vn
Blockchain Basics
and Cryptography
Bitcoin: A Peer-to-Peer Electronic Cash System
6
Blockchain Technology
timestamped
auditable database network consensus protocol
append-only log
• 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 10
Cryptographic Hash Functions
Digital Fingerprints for Data
• Uses as
• Names
• References
• Pointers
• Commitments
11
‘How to Time-Stamp a Digital Document’
Habor & Stornetta (1991)
Surety 1995 - present
• Version
• Previous Block hash
• Merkle Root hash
• Timestamp
• Difficulty target
• Nonce
14
Merkle Tree – Binary Data Tree with Hashes
15
Image is in the public domain by National Institute Standards and Technology.
Asymmetric Cryptography & Digital Signatures
16
© Source unknown. All rights reserved. This content is excluded from our Creative Commons license. For more information, see https://ocw.mit.edu/help/faq-fair-use/
Asymmetric Cryptography & Digital Signatures
• Digital Signature Algorithms
• Generate Key Pair - Public Key (PK) & Private Key (sk) - from random number
• Signature – Creates Digital Signature (Sig) from message (m) and Private Key (sk)
• Verification – Verifies if a signature (Sig) is valid for a message (m) and a Public
Key (PK)
• Properties
• Infeasible to find Private Key (sk) from Public Key (PK)
• All valid signatures verify
• Signatures infeasible to forge
18
Deposits & Negotiable Orders
Input Output
In satoshis
Uniquely Previous transaction ID Value 108 = 1
identifies an Index bitcoin
output Public Key
(Bitcoin Address)
Signature
A “coin”
lock_time 20
Conclusions
Discussed Bitcoin Design Features
• Timestamped Append-only Logs (Blocks)
• Secured through Cryptographic Hash Functions & Digital Signatures
Consensus Protocol
• Consensus through Proof of Work
• Network of Nodes
• Native Currency
Transactions Ledgers
• Transaction Inputs & Outputs
• Unspent Transaction Output (UTXO)
• Scripting language 23