Crypto Currencies Prof. Tom Austin San Jos State University What - - PowerPoint PPT Presentation

crypto currencies
SMART_READER_LITE
LIVE PREVIEW

Crypto Currencies Prof. Tom Austin San Jos State University What - - PowerPoint PPT Presentation

CS 166: Information Security Crypto Currencies Prof. Tom Austin San Jos State University What is currency? A means of exchange, so that we don't have to carry around goats. Something we all agree is valuable maybe because


slide-1
SLIDE 1

CS 166: Information Security

  • Prof. Tom Austin

San José State University

Crypto Currencies

slide-2
SLIDE 2

What is currency?

  • A means of exchange, so that we

don't have to carry around goats.

  • Something we all agree

is valuable…

  • …maybe because people

with guns tell us it is valuable?

slide-3
SLIDE 3

History of currency

  • 2000 BC – Receipts represented grain stored in

Sumerian temple granaries (representative money)

  • 600-700 BC – Coins developed in Anatolia,

Greece, India, and China (commodity money)

– Value of these coins tied to metal content

  • 900 AD – Jiaozi banknote developed in China

– fiat money– valuable because government says so

  • 1971 – U.S. breaks away from the gold standard
slide-4
SLIDE 4

So what is a digital currency?

slide-5
SLIDE 5

Properties of an ideal digital currency

(Okamoto and Ohta)

  • 1. Independence

– not dependent on any physical location – can be transferred through computer networks

  • 2. Security

– cannot be copied and reused

  • 3. Privacy
  • 4. Off-line Payment

– No need to be linked to a host to process payment

  • 5. Transferability
  • 6. Divisibility
slide-6
SLIDE 6

DigiCash

  • 1983 – David Chaum invents blinding

formula allowing anonymous, verifiable transactions

– Blinded signatures – akin to signing a slip of carbon paper through a sealed envelope

  • Late 1980s – Chaum starts DigiCash
  • 1998 – DigiCash goes bankrupt, in part

because of difficulty working with banks

  • Today, opencoin builds on some of Chaum's
  • ideas. http://opencoin.com/
slide-7
SLIDE 7

Building a Cryptocurrency

slide-8
SLIDE 8

Digital Currency – Take 1

Alice Bob

"I Alice agree to pay the bearer of this note $100"

Any issues with this approach?

slide-9
SLIDE 9

Digital Currency 1 – Repudiation

Alice Bob

"I Alice agree to pay the bearer of this note $100"

I want my money.

I did not write that

  • note. I'm not

paying.

slide-10
SLIDE 10

Digital Currency – With Signatures

Alice Bob

"I agree to pay the bearer of this note $100"

slide-11
SLIDE 11

Digital Currency with Signatures gives Nonrepudiation Alice Bob

I want my money.

I did not write that

  • note. I'm not

paying.

"I agree to pay the bearer of this note $100"

It has your signature.

Oh… OK.

slide-12
SLIDE 12

Double Spending

Bob Charlie

Take this IOU from Alice to square our debt. OK

"I agree to pay the bearer of this note $100"

slide-13
SLIDE 13

Charlie

Double Spending

Alice

I'm here to collect my money.

But… I already paid.

"I agree to pay the bearer of this note $100"

slide-14
SLIDE 14

A centralized authority could monitor all transactions…

slide-15
SLIDE 15

Because everyone trusts banks

slide-16
SLIDE 16

Centralized Cryptocurrencies

  • A central authority can validate

transactions

  • Our initial version:

–provides anonymity –is impossible to reverse –bank can still verify correct amount

  • (From Schneier's "Applied

Cryptography")

slide-17
SLIDE 17
  • 1. Alice prepares 100 anon $1k money orders.
  • 2. She places each money order in an envelope.
  • 3. Bank opens 99 orders & verifies the amount.
  • 4. The bank signs the last order and deducts $1k

from Alice's account.

  • 5. Alice takes the anonymous money order out of

the envelope and spends it.

  • 6. Merchant accepts money order after verifying

bank's signature.

  • 7. Merchant takes money order to the bank.
  • 8. Bank verifies signature and pays money.
slide-18
SLIDE 18

The previous currency still does not address the double spending problem. The next version will solve that issue.

slide-19
SLIDE 19
  • 1. Alice prepares 100 anon $1k money orders and

places a random global identifier string on each.

  • 2. She places each money order in an envelope.
  • 3. Bank opens 99 orders & verifies the amount.
  • 4. The bank signs the last order and deducts $1k from

Alice's account.

  • 5. Alice takes the anonymous money order out of the

envelope and spends it.

  • 6. Merchant accepts money order after verifying bank's

signature.

  • 7. Merchant takes money order to the bank.
  • 8. Bank verifies signature, checks that the identifier

has not been previously used, and pays money.

slide-20
SLIDE 20

What's wrong with a centralized currency?

  • A centralized institution might find

clever ways to monitor transactions.

  • The protocol requires buy-in from

banks or other institutions.

–arguably part of the reason that DigiCash failed

  • The centralized institution might

charge heavy transaction fees.

slide-21
SLIDE 21

An alternate approach is for everyone to track all transactions, and vote whenever a discrepancy arises.

slide-22
SLIDE 22

Bitcoin

  • Protocol designed by

Satoshi Nakamoto in 2008 https://bitcoin.org/bitcoin.pdf

  • First Bitcoin client launched in 2009
  • Peer-to-peer – no centralized control

–Every client keeps track of the history

  • f all bitcoins
slide-23
SLIDE 23

What is a cryptocoin worth? Some cryptocurrencies tie there value to another currency. Other cryptocurrencies (such as Bitcoin) are not tied to any other currency. We'll follow this model.

slide-24
SLIDE 24

Digital Currency – Ledger

Alice

Bob "I am giving 10 cryptocoins to Bob" Charlie David

Alice: 20 Bob: 11 Charlie: 5 David: 34 Alice: 20 Bob: 11 Charlie: 5 David: 34 Alice: 20 Bob: 11 Charlie: 5 David: 34 Alice: 20 Bob: 11 Charlie: 5 David: 34

slide-25
SLIDE 25

Digital Currency – Ledger

Alice

Bob "I am giving 15 cryptocoins to Charlie" Charlie David

Alice: 5 Bob: 11 Charlie: 20 David: 34 Alice: 5 Bob: 11 Charlie: 20 David: 34 Alice: 5 Bob: 11 Charlie: 20 David: 34 Alice: 5 Bob: 11 Charlie: 20 David: 34

slide-26
SLIDE 26

Digital Currency – Ledger

Alice

Bob "I am giving 8 cryptocoins to David" Charlie David

Invalid transaction! Invalid transaction! Invalid transaction!

slide-27
SLIDE 27

Bitcoin Miners

slide-28
SLIDE 28

People are always tempted to cheat. How can we catch them in a peer-to- peer system?

slide-29
SLIDE 29

Bitcoin Proof of Work

  • The Bitcoin protocol uses proof of work

to verify block chains, which determine transaction history.

  • This strategy prevents double spending,

where Alice tries to spend the same coin with both Bob and Charlie.

slide-30
SLIDE 30

Mining

  • Miners hash transaction details plus a

"proof" of spending computational resources

– Reward: some bitcoins are generated plus there can be transaction fees

  • Cost to discover proof – 2N hashes
  • Cost to verify proof – One hash
  • The Bitcoin protocol is designed to make

mining more profitable than cheating

– https://bitcoin.org/bitcoin.pdf

slide-31
SLIDE 31

Digital Currency – Proof of Work

Alice

Bob "I am giving 2 cryptocoins to Charlie" Charlie David

Alice: 5 Bob: 11 Charlie: 20 David: 34 Alice: 5 Bob: 11 Charlie: 20 David: 34 Alice: 5 Bob: 11 Charlie: 20 David: 34 Alice: 5 Bob: 11 Charlie: 20 David: 34

slide-32
SLIDE 32

Digital Currency – Proof of Work

Alice

Bob "I am giving 2 cryptocoins to Charlie" Charlie David

Alice: 3 Bob: 11+1 Charlie: 22 David: 34 Alice: 3 Bob: 11 Charlie: 22+1 David: 34 Alice: 3+1 Bob: 11 Charlie: 22 David: 34 Searching for proof of work… Searching for proof of work… Alice: 3 Bob: 11 Charlie: 22 David: 34 +1 Searching for proof

  • f work…

Searching for proof

  • f work…
slide-33
SLIDE 33

Digital Currency – Proof of Work

Alice

Bob "I am giving 2 cryptocoins to Charlie" Charlie David

Found proof!

slide-34
SLIDE 34

Digital Currency – Proof of Work

Alice

Bob "I am giving 2 cryptocoins to Charlie" Charlie David

Alice: 3 Bob: 11 Charlie: 22 David: 35 Alice: 3 Bob: 11 Charlie: 22 David: 35 Alice: 3 Bob: 11 Charlie: 22 David: 35 Alice: 3 Bob: 11 Charlie: 22 David: 35

slide-35
SLIDE 35

Handling Discrepancies

Discrepancies between ledgers are resolved in favor of the chain with the greatest amount of work used in its creation. Generally, this means that we take the longest blockchain.

slide-36
SLIDE 36

Challenges in cryptocurrencies

  • Slow verification

–roughly an hour with Bitcoin

  • "Useless" work

–Bitcoin uses about 1/3 of the energy that homes in San Jose use

  • Challenges updating protocol

–hard forks

slide-37
SLIDE 37

Interesting cryptocurrencies

  • Ethereum

–Arbitrary programming contracts –Uses "gas"

  • FileCoin

–distributed cloud storage –proof-of-storage –proof-of-replication

  • Proof-of-stake protocols
slide-38
SLIDE 38

Lab: Proof of Work protocol

Download Miner.java from the course website. Implement the findProof method to: 1) Add one extra coin to the miner's account 2) Convert the new ledger to a String 3) Search for a "proof" where the result of hash(ledgerStr + proof) has NUM_ZEROES leading zeroes.