Top Banner
Copyright 2017 Aaron Li ([email protected]) Copyright 2017 Aaron Li ([email protected]) Blockchain The technologies behind Bitcoin, Ethereum, ICOs… Aaron Li [email protected] Oct 28, 2017
63

Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Jan 22, 2018

Download

Technology

Aaron Li
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

BlockchainThe technologies behind Bitcoin, Ethereum, ICOs…

Aaron [email protected]

Oct 28, 2017

Page 2: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Me & Blockchain

• Miner 2011-2012• Built several mining clusters and tools

• Evangelist / supporter 2011 -

• Investing / trading occasionally

• Interested in core tech / products / apps

https://www.linkedin.com/in/aaronqli/

Page 3: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

What is

Bitcoin?

Ethereum?

ICO?

Blockchain?

Page 4: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

History: 2008 - Present

Tech: P2P Distributed Cryptographic Ledger

Coins: Bitcoin, Ethereum, Litecoin, …

Applications: Finance, Law, Businesses, Computing, …

Jobs: Security, Infrastructure, Trading, Applications, …

Page 5: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Basic Technical Topics

• Blockchain Overview• Proof of Work, Transactions, Consensus

• Bitcoin• Mining: Hardware, Pools, Mechanism…

• Ethereum• Ether, Smart Contract, Applications

• Others: Litecoin, ICO, …

Page 6: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

History

Page 7: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

2008 - Bitcoin Paper

Satoshi Nakamoto

image from: Google Image

Page 8: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

https://bitcoin.org/bitcoin.pdf

Page 9: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

• Decentralised digital currency• Backed by math & algorithms• No government / company control

• Low fee P2P international transfer

• “Anonymous” & verifiable transactions

What is Bitcoin?https://youtu.be/Gc2en3nHxA4https://www.weusecoins.com/

Page 10: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

What is Bitcoin?

• 1 Bitcoin = 1 BTC = 1 (Ƀ, ฿, …)

• BTCs are stored in an address• e.g. 3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy

• Max circulation: 21 millions (by ~2033)

• Minimum unit: 0.00000001 (1e-8) = 1 satoshi

• Transaction = one address send BTC to another

Page 11: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])image from: weusecoins.com

Page 12: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])image from: weusecoins.com

Page 13: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

2009 - Early days

Open Source Software & early supporters

Page 14: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])bitcoin.org July, 2009

image from: archive.org

Page 15: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])image from: archive.org

Page 16: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin in 2009 - 2011• No applications

• People just doing it for fun

• Almost no one accepts Bitcoin

• First community: bitcointalk.org

Page 17: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin in 2009 - 2011

• 10,000 Bitcoins = 2 pizzas

• Alpaca Socks • First vendor accepting Bitcoin

image from: Google Image search

Page 19: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

What happened in 2011?

GPU Mining

Mass Media Reports

Alternatives & Forks (Litecoin, etc.)

Page 20: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

2011: My first miner

15 GPUs (HD5850)

Power: 4kWh

Cooling: Water / Fan

@ Balcony & Tent

Page 21: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

2012 - 2015+ Speculators (non-tech people)

+ Exchanges (- MtGox)

+ Merchants (Shipito, Overstock, …)

+ Services (POS, Wallets, …)

Page 23: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

2015 - NowThe Biggest Thing

“Decentralised Turning Complete Virtual Machine”

image from: ethereum.org

Page 24: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

What is Ethereum?

• Decentralised Computer• Run “Smart Contracts” (programs)• Turing-complete machine

• Use Ether (ETH) to operate

• Not a currency, but is treated as one

https://ethereum.org/

Page 25: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

2015 - Now: Other Big Things

ICOs

Ripple, Tether, BitGo, Qtum, …

Coinbase & GDAX

Regulations: SEC, China, US Laws …

Page 26: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Nowhttps://coinmarketcap.com/

Page 27: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

TradingCoinbase: Good for starters. Easiest to setup. High fees (1-5%)

Use credit card / banks. Need ID verification.

Support BTC, ETH, LTC

in USA, Canada, Australia, Singapore, most Europe

USA based (reports earning to IRS!)

Page 28: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

GDAX: Professional version of Coinbase; Low fees (0% - 0.3%)

limit/stop orders, depth graph, order book, history, …

margin trading (temporarily unavailable)

USA based (reports earning to IRS!)

Trading

Page 29: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

TradingBitstamp: Professional exchange, low fees (0% - 0.3%)

Supports BTC, XRP, LTC, ETH and many fiat currencies

Page 30: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Others

See bitcoincharts.com

Page 31: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Initial Coin Offering (ICO)

• Similar benefits compared to IPO:

• Allow general public to participate

• Raise large sum of money ($1M’s - $100M’s)

• Public trust, public audit & examination

New way to raise money for a project / company

Page 32: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

• Better than IPO in some areas:

• Much less complicated legal paperwork

• Can be started by any person / team

• Much easier for the public participate & trade

Initial Coin Offering (ICO)

Successes: Ethereum, Filecoin, Bancor, Tezos, BAT

Page 33: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Initial Coin Offering (ICO)

• Issues, compared to IPO:

• Many projects are scams / impossible to deliver

• No regulations exist to sue / recoup damages

• No supervision to project owners

Failures: DAO, and many others

Page 34: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Initial Coin Offering (ICO)

• Usual Process:

• Get a team

• Write a white paper

• Get people to talk about it

• Set up a beautiful website

• ICO!

Page 35: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Initial Coin Offering (ICO)

• Future talks:

• What is expected in whitepapers?

• Open source tools for designing / launching ICO

• Case studies

• For startups: Future of ICOs v.s. VC?

Page 36: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Career OpportunitiesFriends’ companies with successful ICOhiring engineers, etc.

• Orchid ($4.7M, a16z, etc.)

• WeTrust ($>10M)

• doc.ai

• many more…

Page 37: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Tech

Page 38: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

BlockchainGoal: Design a distributed ledger such that

• All transactions are recorded and verifiable

• Owners can remain anonymous

• No central authority required (“trustless”)

• Resistant to malicious attacker

• Participants are incentivised and rewarded

Page 39: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

BlockchainSolution: Store transactions distributively as

a chain of blocks (“blockchain”)

Issues: How to (efficiently)

definecreateverifystore

transactions?

track

Page 40: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Blockchain

Issues: How do we make sure the transactions are

respecting every participant’s privacy?

resilient to attackers?robust against malicious users?

Page 41: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin Blockchain• Fully decentralised network

• Each node is a user

• Some nodes are miners

• Miners: nodes that verify transactions between users

• Miners are incentivised by two types of rewards• Transaction fees• Validating a new block (hard)

image from: Google Image Search

Page 42: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin BlockchainAddress: an object for receiving Bitcoins

Address = Hashes of public keySee this article of details

• Controlled by corresponding private key

• Key pairs can be arbitrarily generated (address too)

• Intended to be used only once

define and create transactions

Page 43: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin BlockchainTransaction: A sends some X coins to B

Process: 1. A controls an address P with X coins

2. A obtain an address Q controlled by B (B could generate Q with a new private key)

3. A creates a transaction T transfer X Bitcoins from P to Q

4. A signs T using private key of P

Define and create transactions

Page 44: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin Blockchainverify transactions

• What about all transactions before that?

• How do we know A did not spend his Bitcoin twice?

• How do we know A has X Bitcoins before sending them to B?

Single transaction: verifiable using hashes / public key

(To be discussed later in “blocks”)

Page 45: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin TransactionsExample: 1 Bitcoin transferred through owner 0, 1, 2, 3, …

1 Bitcoin ….

track transactions

image from: [Nakamoto, 2008] (Bitcoin paper)

Page 46: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin Transactions• Can have multiple in/out

• Combine fractions / divide coins

• Unspent coins are stored in new address

0.1 BTC

1.3 BTC

….

0.5 BTC

track transactions

image from: [Nakamoto, 2008] (Bitcoin paper)

Page 47: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin Blockchain

1. Store transactions in blocks

2. Simplify the blocks (just enough to verify things)

3. Store blocks to all nodes in network

How to efficiently store and verify transactions?

Page 48: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin Blockchainblockchain = A chain of blocks

Bitcoin Block = Block Header + (Hashes of) Transactions

Header = Last Block’s Hash + Nounce + (Root Hash of Transactions)

Nounce = a sequence of bytes to show proof-of-work

track transactions

image from: [Nakamoto, 2008] (Bitcoin paper)

Page 49: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin Blockchain

Issue: Most nodes don’t want to store all transactions

They only want to verify a transaction is in the blockchain

Page 50: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin BlockchainGoal: minimise information needed to verify a transaction

Solution: Merkle tree

image from: [Nakamoto, 2008] (Bitcoin paper)

Page 51: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin BlockchainBitcoin Merkle tree construction:

1. Compute hashes of transactions in a block2. Compute hashes of each pair of hashes recursively

1. Load / verify root hash R

2. Load H, the hash of TP(H), the ancestors of HS(P(H)), the siblings of P(H)

3. Reproduce and verify R and P(H) using these

To verify a transaction T is in the blockchain:

image from: [Nakamoto, 2008] (Bitcoin paper)

Page 52: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin BlockchainMore on Merkle tree

A Certified Digital Signature, R. Merkle (written in 1979) Proceeding CRYPTO '89 Proceedings on Advances in cryptology

Protocols for public key cryptosystems, R. Merkle, 1980 IEEE Symposium on Security and Privacy

Used in a wide range of applications• version controls (Git, …)• file systems (IPFS, ZFS, …)• databases (Cassandra, Dynamo, …)• P2P systems (BitTorrent, …)• and many more

image from: Google Search

Page 53: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin BlockchainBitcoin block chain, with Merkle Tree

Miners generate blocks, and validate transactions

image from: [Nakamoto, 2008] (Bitcoin paper)

Page 54: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin BlockchainProof-of-work:

1. a block is valid iff hash (SHA2) of block header has N leading zero bits(miners must find it by solving the value of nounce by brute-force)

2. longest block chain is the only valid block chain3. once a valid block is found, it is propagated to all nodes

controls generation speed of new blocks (~1 block / 10 minutes)

A valid nounce is (artificially made) hard to compute

image from: [Nakamoto, 2008] (Bitcoin paper)

Page 55: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin Blockchain

Blocks and transactions are immutable

Transactions are secured by private/public keys

resilient to attackers?

resilient to forgery:

resilient to DDOS: Miners can charge transaction fees

Page 56: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin BlockchainIf someone wants to alter their own past transactions (using private keys), and create fake history, he must….

1. Find the blocks which contain those transactions

2. Change the transactions and recompute Merkle trees

3. Re-compute all blocks on his own until his chain is longest

In the meantime, other nodes continue to produce new blocks…

Impossible to catch up unless he has >50% CPU of whole network!

robust against malicious users?

Page 57: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

respecting every participant’s privacy?

Bitcoin Blockchain

image from: [Nakamoto, 2008] (Bitcoin paper)

Page 58: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

Bitcoin Blockchainincentives?

Miners are rewarded with…

1. X Bitcoins, for each valid new block found (manifested by attaching a reward transaction in new block)

2. Transaction fees, for all transactions in the new block

Bitcoin has controlled supply, so X is halved every 210000 blocks

Year 2008: X = 50

210000 blocks ~= 4 years

Page 59: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

General Blockchain

: State of blockchain at timestamp t

: The block, containing all (general) transactions: State transition function: Block finalisation function

See details in Ethereum yellow paper

image from: [Wood, EIP-150 2017] (Ethereum Yellowpaper)

Page 60: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

EthereumInstead of wasting CPUs for computing hashes of proof-of-work, let nodes do some useful work!

• Introduced new concepts: accounts, contracts, messages, …

• Transactions: define function calls, execution model, data, …

• Proof-of-work: still rely on nounce, but deprecating soon

• (Theoretically) much broader applications

• Not meant to be a currency, but people got crazy

Page 61: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

EthereumResources:

Ethereum Wallet + Mist Browser & Serverless app tutorial

White paper: https://github.com/ethereum/wiki/wiki/White-Paper

Yellow paper: https://ethereum.github.io/yellowpaper/paper.pdf

Programming: Build Helloworld DApp (decentralised app)

DApps for Beginners: https://dappsforbeginners.wordpress.com/

Page 62: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

LitecoinBased on Bitcoin. Designed to make GPU/FPGA/ASIC ineffective

• 2.5 minutes per new block, instead of 10 minutes

• Proof-of-work: use scrypt hashing algorithm, instead of SHA256

scrypt:

• time-memory tradeoff: parallelisation becomes ineffective

• fast with large memory, and slow with little memory

• See paper for details

Page 63: Blockchain: the technologies behind Bitcoin, Ethereum, ICO, and more

Copyright 2017 Aaron Li ([email protected])

Copyright 2017 Aaron Li ([email protected])

More

• Mining: history, hardware, future alternatives

• Ethereum: technical design, programming, applications

• ICOs: applications and technical advancements

• Blockchain: enterprise applications

• and more…

Topics for future talks