One-Way Hash Functions
Bitcoin and Blockchain
Overview
Introduction to Blockchain & Bitcoin
Theoritical aspects
Bitcoin address
Bitcoin transactions
Locking and unlocking script
Blocks and Bitcoin mining
Blockchain learning path
Introduction of Bitcoin & Blockchain
Introduction to Blockchain
A blockchain is a time-stamped series of immutable records of data that is managed by a group of computers rather than any single entity.
Each of these blocks bound to each other using cryptographic principles in a chronological order (i.e. chain)
Structure of Bitcoin
Bitcoin demo:
z
https://andersbrownworth.com/blockchain/tokens
Structure of Bitcoin
80 bytes block header
1 MB for each block
Average trasaction size = 250 bytes
Average Block time = 10 mins
Block header
Size (bytes) Name Description
4 Version The version number of the block which follows the consensus rules of that protocol version
32 PrevBlockHash The hash of the previous block header
32 MerkleRootHash The hash of all the transactions inside the block (Hashed by using SHA256)
4 TimeStamp When the miners started hashing on the block(Seconds from 1/1/1970)
4 TargetToBeSolved (Difficulty)
4 NonceForProofOfWork The discovered value that the miner who validated the block has used.
Concepts of Bitcoin
Bitcoin Address
Elliptic Curve Cryptography : y2 = x3+ax+b
(ECDSA, SECP256K1 Standard: a=0 & b=7)
Generating Public and Private Keys
Compressing Public Key
Generating Public-Key Hash
Bitcoin Address
Interesting story :Why Nakamoto use ECC over other algorithms (e.g. RSA)
Faster & Safer
ECC keys are smaller than RSA keys and can be computed considerably faster.
256 bit ECC public key provides security equivalent to a 3072 bit RSA public key
Scandal: Snoden – RSA
https://www.reuters.com/article/us-usa-security-nsa-rsa-idUSBREA2U0TY20140331
Turning Public-Key Hash into Bitcoin Address
Base58 Encoding Table
Transactions: Intuition
Components of Transactions & Examples
An Example
Changes
Transaction fee = (2 + 1.5) – (2.5 + 0.5 + 0.49997) = 0.00003 BTC
Sending Transaction
After a node has generated a transaction, it sends the transaction to its peers
Each peer will verify the transaction, and then forward it to their peers
Eventually, every node on the network will receive the transaction
Some special node called miner will be responsible for adding the transaction to the public ledger (i.e., blockchain).
Generating Blocks
Miners group transactions into a new block
The new block is appended to the existing blockchain
Mining
Proof-of-Work: find a nonce, s.t. when the hash of the block satisfies a special requirement, such as having 20 leading zeros
Rewarding:
Coinbase transaction: new bitcoins are minted and given to the miner
Transaction fees
Once a miner has found a block, it immediately sends the block to its peers, who will verify the block and then forward the block to their peers.
Eventually, all the nodes will see this new block, and add it to their ledgers.
Include Merkle Root in Block
Merkle Tree
Benefit:
To find whether a transaction is included in a block, you don’t need all the transactions
Good for non-full nodes
Branching
Branching occurs when two valid blocks are found at about the same time
The longest chain wins
Confirmation Number
The larger a block’s confirmation number is, the less likely it will be removed from the blockchain
Probability of Double Spending
Double Spending with Majority Hash Power
Learning path of Blockchain
Learning path
Blockchain 1.0
Blockchain 2.0 Blockchain 3.0
Example Bitcoin Ethereum Hyperledger
Advantageous area Cryptocurrencies User applications Industrial applications
Fields —————– Programable Financial Dapps E-government, Logistics, Medical services, etc.
Pros —————– Open source, Turing complete, Easy to deploy Open source, Turing complete, Enterprise-level solution
Cons Limited functions Service charge (Gas) Hard to deploy
Language C++ Solidity Go
My research
A decentralized e-commerce review system based on Blockchain
Use cryptocurrency to present a seller’s credibility
Incentive mechanism motivates buyers to leave honest reviews
Data has been stored in a decentralized way
Why Blockchain?
The father of World Wide Web, Sir Tim Berners-Lee:
“The web has evolved into an engine of inequity and division; swayed by powerful forces who use it for their own agendas.”
“Today, I believe we’ve reached a critical tipping point, and that powerful change for the better is possible — and necessary.”
Summary
Introduction to Blockchain
Theories and concepts of Bitcoin
Blockchain’s learning path
Any questions?
Email (Zickey Yan): zy203@sussex.ac.uk