Blockchain Nanodegree Notes 20181026
Term 1 S3 Lesson 1: Blockchain Data Overview
Blockchain vs Traditional Databases
Blockchain as a dataset - overview
- Blockchain as a dataset?
- traditional database characteristics
- blockchain characteristics
- Traditional Database vs Blockchain
Traditional Database Characteristics
- Network - Centralized
- Functions - Create, Read, Update, Delete (CRUD)
- Mutability - mutable (can be updated after adding to the database)
- Authorization - Centralized
- Transparency - Low
Blockchain Characteristics
- Network - Distributed
- Pro: Control given to nodes
- Con: Must achieve consensus
- Functions - Read, append and validate
- Pros: accurate historical record; faster read and write
- Con: must achieve consensus
- Mutability - Immutable
- Pro: permanent historical record
- Con: storage space
- Authorization - Distributed
- Pro: Extremely secure
- Con: Cannot dispute transactions
- Transparency - High
- Pro: everyone has access
- Con: No permission control
Do you need a blockchain?
Blockchain Questions Overview
- Do you need a database
- Does it require shared write access
- Will you need to create the trust between users
- Canyou operate without trusted 3rd parties
- Can you operate without control over permissions
(preview: 3 types of blockchains - public, private and hybrid)
Blockchain Types
- public
- private
- hybrid: shared private network combined with not publicly available data
https://www.ibm.com/blogs/blockchain/2017/05/the-difference-between-public-and-private-blockchain/
https://hackernoon.com/3-popular-types-of-blockchains-you-need-to-know-7a5b98ee545a
Which type to use
Here are 3 questions to help you determine which type of blockchain is right for your situation.
- Will transactions be public?
- Will other companies need access to your data?
- Should some information be public while other information is restricted?
P2P Network vs Client-Server Model Overview
Client Server Model
- Client - makes requests
- Server - responds to client
P2P network
network of computers that share access to files with each other
P vs C
- Infrastructure: single server (corporations) vs collection of nodes (mining farms)
- Cost: expensive vs cheap
- Control: authority vs network
- Security: high vs low
- Stability: stable vs unstable
Explore Blockchain Data
Blockchain Explorer
Block - Block Header + Block Transactions
- Block header: metadata about the block, including hash value
- Block Transactions:
- Coinbase (aka. first transaction)
- input, output, fee, # of confirmations, # amount sent
Explore: Search block #
Explore blockchain data in JSON
Block header:
- hash
- confirmations
- strippedsize
- size
- weight
- height
- version
- versionHEX
- merkleroot
- tx (transaction hash values)
- time
- mediantime
- nonce
- bits
- difficulty
- chanwork
- perviousblockhash
Block transactions:
-
txid
-
hash
-
vin
"vin":[ { "coinbase": "039ff1072...", "sequence": 3579139394 } ],
-
vout (some are not shown)
"vout":]{ "value": 12.52201057 "n": 0, "scriptPubKey":{"..."} },{ "value": 0.00000000, "n":1, "scriptPubKey":{"..."} }
Raw data are just hex strings
Nonce是Number once的縮寫,在密碼學中Nonce是一個只被使用一次的任意或非重複的隨機數值。在加密技術中的初始向量和加密雜湊函式都發揮著重要作用,在各類驗證協議的通訊應用中確保驗證資訊不被重複使用以對抗重放攻擊(Replay Attack)
Practice Blockchain Data
see: https://github.com/xiaozhenliu/udacity-blockchain.git
Explore Bitcoin’s Codebase
https://github.com/bitcoin/bitcoin
- Genesis Block: /src/chainparams.cpp, line 20
- Original Timestamp: line 54
- Other Variables
BIPs and Forks
- Bitcoin Improvement Proposals: Technical documents used to issue changes to the bitcoin core client
- Written by community members
- Voted on by miners
- Accepted or denied
- Implemented by developers
- Forks:
- hardfork
- softfork
- source code fork