The Blockchainbigotheoryclub.weebly.com/uploads/5/8/3/7/58370541/big-o... · 2018. 9. 1. · see...

Post on 24-Jan-2021

6 views 0 download

Transcript of The Blockchainbigotheoryclub.weebly.com/uploads/5/8/3/7/58370541/big-o... · 2018. 9. 1. · see...

The BlockchainJosh Vorick

Bitcoin is a currency.Blockchain is a technology.

What is a blockchain? ● A decentralized database that anyone can add to and no one can delete from

The Bitcoin blockchain

Agenda● Why You Should Care● Bitcoin

○ Transactions○ Mining○ Mining Pools○ Scalability

● Other blockchain applications

Why you should care

Many are comparing the blockchain to TCP/IP

$1 Billioninvested into blockchain-related startups

$110,000median “blockchain engineer” starting salary

In case money isn’t enough...● Trustless, decentralized networks● Remove third parties

○ Smaller fees○ Don’t need to trust a central authority

● Corruption-proof (e.g. Bitcoin is a safe haven from bank crisis)● Privacy● Completely Digital● Trustless● Removes Third Parties

time to get technical

The Bitcoin blockchain

● Public key (verification key)

● Secret key (signing key)

● Sign a message with your secret key

● Verify that a signature is valid using their public key

Digital Signatures

Cryptographic Hash● Deterministically maps an input string to

a fixed length output● Output looks like a random number● Collision resistant

HASH

6d324eff6c3f40c14c24642f82272e8b16bc158a67a6e6

4e8c511e534dbb7c8d

a0cd8d94408af12bc1bdb677ca47d86b049c448e300568b5015c396a56827ea70fe8d2bf473ea9be8265a6b39e9d1e3e0581db2b25a4cc061a6de9ff44b30a314400b44ebad3d1af844cdb40b58bcf35632152bf825718912eaa0f65b4a780c0581983570796b7a8eced52f936e2b106e8191227c351415b8f525f994077ca002460cc3b6f9e45776042f9cbe8cd6441dc891fe4daf5a7ce22bb0e7c04e3253ff37542514e3967e7dca8518310f8851301e33ad1b831aaae1ca1ec6c31639dd54691c4987ede6c3228bf453c01dc1a1f67242d601473c2f533f6b30a31440c3b6f9e

45776042831

0

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

01

2ca5cfc1a35679225c87410c2039dce459f67138c8a23b8d19aad4d3c037c23b

hash

5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9

hash

0a13032d6e91709e88effb654657fcb620432caa2dc1f37db32871eb5e3a2aa7

hash

57bb432fbc63aa7588e8a66329e4534b6567fd2f4f26f91caa5f9b01396d4f98

hash

(non-cryptographic) hash

def myHash(str): hash = 5831 for c in str: hash = hash * 33 + int(c)

return hash

cryptographic hash (blake2b)

Transactionsare complicated

What’s in a Transaction?the super duper basics

● Sender

● Recipient

● Amount

● Signature

txn1Alice -> Bob

25 Btc-Alice

What’s Really in a Transaction?the super basics

● Sender

● Recipient

● Amount○ List of inputs○ List of outputs○ SUM(in) = SUM(out)

● Signature

txn1Alice -> Carol15 Btc (see txnx)

-Alice

txn2Bob -> Carol10 Btc (see txny)

-Bob

txn3Carol -> Dave25 Btc (txn1+txn2)

-Carol

txn115 Btc to Carol

see txnx-Alice

txn210 Btc to Carol

see txny-Bob

txn325 Btc to Dave

see txn1, txn2-Carol

txn115 Btc to Carol

see txnx-Alice

txn210 Btc to Carol

see txny-Bob

txn320 Btc to Dave5 Btc to Carol

see txn1, txn2-Carol

What’s Really Really in a Transaction?

the basics

● Sender

● Recipient’s public key

● Amount○ List of inputs○ List of outputs○ SUM(in) = SUM(out) + Miner fee

● Sender’s signature

txn115 Btc to pkC

see txnxsign(txn1, skA)

txn210 Btc to pkC

see txnysign(txn2, skB)

txn320 Btc to pkD

4.999 Btc to pkCsee txn1, txn2

sign(txn3, skC)

txn115 Btc to pkC

see txnxsign(txn1, skA)

txn210 Btc to pkC

see txnysign(txn2, skB)

txn320 Btc to pkD

4.999 Btc to pkCsee txn1, txn2

sign(txn3, skC)

What’s Really Really Really in a Transaction?

● Sender

● Recipient’s public key

● Amount○ List of inputs○ List of outputs○ SUM(in) = SUM(out) + Miner fee

● Script○ Multisig○ Locktime○ Puzzles○ etc

● Sender’s signature

Mining

Miners● Get sent transactions

● Compile them into blocks

● Add their blocks to the blockchain

If miners add blocks willy-nilly, the blockchain will quickly become inconsistent

Give the miners a hard puzzle● Miners work on puzzle

● Whoever solves it shows the network their solution

● Their block gets added to the blockchain

● Puzzle is called “proof of work”

Proof of Work● Used to prevent fraud

○ DoS attacks

○ Spam

○ Blockchain!

● Make it computationally hard to do something

● e.g. “You can’t access my website unless you do work”

Example challenge● m = “Challenge text”

● n = ???

● target = 0x0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

● Find some n such that hash(m + n) < target

“Challenge Text0” hash 0xa34adb8461404adfab8d08e6cbdb24029e1bb0a8d906d080d01842ce57ee9156

“Challenge Text1” hash 0xcc6122116e95dae6279fdb241497f92e5f50093a35a5c7dc010f1f357d43ed6c

“Challenge Text2” hash 0x669a60a2bcefaa27cad56b0d9754bbaf7cc596d2b809782345d99e8b53e5f3bd

“Challenge Text3” hash 0x85a38de18ed2a5246c778c4888b72ee62e6464e24307055a55afd995dd548576

“Challenge Text4” hash 0x67618f5b9a7f6358609f96eab68c610f375f1a580f7d9bb99d628c8ee8ba21fa

“Challenge Text5” hash 0x04f0d5919eccd435de1521c5234663971bf0e9113b129f2f689d586596dbe4fc

Lucky!!

target = 0x0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

Miner code!!def mine(Block, target): n = 0 while true: h = hash(Block + n) if h < target: return n n++

Block up to 1MB => hashing is SLOW

def mine(Block, target): n = 0 b = hash(Block) while true: h = hash(b + n) if h < target: return n n++

Version 2

Now we only hash Block once, right?

No :(

How can we do this faster?

Block

hash

Block

hash

b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15

Block

hash

b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15

Block

hash

b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15

hash

hash

Block

hash

b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15

hash

hash

hash

b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15

hash

hash hash

hash

hash hash

hash

hash hash

hash

hash

hash

hash

hash

Merkle tree

hash

b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15

hash

hash hash

hash

hash hash

hash

hash hash

hash

hash

hash

hash

hash

Merkle tree

hash

b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15

hash

hash hash

hash

hash hash

hash

hash hash

hash

hash

hash

hash

hash

Merkle tree

Sweet! Let’s Mine!

1~720,000,000,000,000,000,000

Chance of solving a block on the first try

= Chance of being struck by lightning 1,977,098 times

in one second

1~20,000,000,000

Chance of solving a block in 1 hour on a $300 CPU

1~100,000,000

Chance of solving a block in 1 hour on a $300 GPU

1~240,000

Chance of solving a block in 1 hour on a $370 ASIC

≈$1per day (amortized)

Mining Pools

Use a Central Server to Run the Pool● Mine blocks for the server

● Submit ‘partial blocks’ to server○ e.g. when you almost beat the target

● Types○ slush

○ Pay-per-Share

○ Luke-Jr’s

P2Pool● Using a blockchain to create a mining pool

● Miners in the pool have their own side-blockchain

● Not used commonly due to network latency

14,695,844PetaFLOPS

Tianhe-2 operates at just 33.86 PetaFLOPS

What if we replaced the hash with meaningful work?

Related Topics● Decentralized Computing

○ P versus NP?

● Homomorphic encryption○ Compute on encrypted data

○ Still really slow

Scalability

230,000transactions every day

Other Applications

All blockchains:● Have transactions

● Have miners

● Use Merkle trees

● Have similar scalability issues (for now)

● Trade custom assets

● Make bets

● Leverage

● Hedging

● Turing complete block chain

● Smart Contracts

● Platform for other blockchain

applications

● Decentralized prediction

market

● People bet on events’

outcomes

● Get precise forecasts on any

event

● Decentralized eBay

● Create your own store and

sell to peers on the network

● No fees / restrictions

Proof of Existence● Add the hash of a document

to Bitcoin’s block chain

● Enables to prove you had that

document on that date

● Add an ownership layer to the Internet

● Enable artists to know when/where their art is being used

● Allow users to easily pay commissions

● Enable for limited editions of digital art

● Decentralized cloud storage

● Secure peer-to-peer file

storage

● Rent out empty hard drive

space

Bitcoin Club!● Focus on blockchain technologies● Learn more about how they work● Discuss applications of the blockchain in greater detail● Workshops

○ Bitcoin○ Ethereum○ etc

● Expos!○ Get funding to go to expos

● Hackathons!○ Blockchain Madness

How do I join?● Facebook

○ Georgia Tech => Bitcoin Club

○ Message Josh Vorick (me)

● Looking for Leadership○ Drafting a Constitution soon

○ Let me know if you want to help!

Questions?