Bitcoin Transactions, High-level Prof. Tom Austin San Jos State - - PowerPoint PPT Presentation

bitcoin transactions high level
SMART_READER_LITE
LIVE PREVIEW

Bitcoin Transactions, High-level Prof. Tom Austin San Jos State - - PowerPoint PPT Presentation

Cryptocurrencies & Security on the Blockchain Bitcoin Transactions, High-level Prof. Tom Austin San Jos State University Lab Review Bitcoin Blocks Collections of transactions Fixed size Collectively, form a blockchain


slide-1
SLIDE 1

Cryptocurrencies & Security on the Blockchain

  • Prof. Tom Austin

San José State University

Bitcoin Transactions, High-level

slide-2
SLIDE 2

Lab Review

slide-3
SLIDE 3

Bitcoin Blocks

  • Collections of transactions
  • Fixed size
  • Collectively, form a blockchain
  • Genesis block – the very first block
slide-4
SLIDE 4

Block Information

  • Version
  • Timestamp
  • Previous block hash
  • Proof-of-work (PoW) target
  • Nonce (the "proof")
  • Merkle root
slide-5
SLIDE 5

Block Information

  • Version
  • Timestamp
  • Previous block hash
  • Proof-of-work (PoW) target
  • Nonce (the "proof")
  • Merkle root

Reviewed another day

slide-6
SLIDE 6

Block Information

  • Version
  • Timestamp
  • Previous block hash
  • Proof-of-work (PoW) target
  • Nonce (the "proof")
  • Merkle root

Determines transactions in block

slide-7
SLIDE 7

Merkle Trees

  • Binary tree.
  • All nodes are hashes.
  • The leaves are hashes of the data.

– In Bitcoin's case, the data is transactions.

  • Definitions

– Merkle root – the root of a Merkle tree. – Merkle path – ONLY the nodes needed to reconstruct the Merkle root from a transaction.

slide-8
SLIDE 8

Merkle Trees

H(A) H(B)

A B

H(C) H(D)

C D

H1 H2 MR

H1 = H(H(A),H(B)) H2 = H(H(C),H(D)) MR = H(H1,H2) (Merkle root)

slide-9
SLIDE 9

Storing Merkle Trees

4 5 6 7 2 3 1

More efficient to store in an array. Left child = n*2 Right child = n*2 +1 (A little adjustment is needed when indexing from 0).

slide-10
SLIDE 10

Using Merkle Trees

  • Merkle root is known
  • Validator requests specific transaction
  • Miner provides Merkle proof

–Pieces needed to reconstruct Merkle root

slide-11
SLIDE 11

Merkle Path

H(A) H(B)

A B

H(C) H(D)

C D

H1 H2 MR

Merkle path for block B:

  • Block B
  • H(A)
  • H2
slide-12
SLIDE 12

Why a Merkle Tree?

  • Requires log n hashes to verify a

transaction.

  • Minimal data needed to transmit

across the network.

  • Old transactions may be pruned more

easily.

slide-13
SLIDE 13

Lab: Implement a Merkle Tree

Details in Canvas and course website.

slide-14
SLIDE 14

Double-entry Bookkeeping

  • Each transaction specifies inputs and outputs
  • All inputs must be spent

– Transaction fee = sum(inputs) – sum(outputs) – Change address = Address spender gives to reclaim unused bitcoins.

  • Special case: coinbase transactions

– New coins generated as a reward for miners.

slide-15
SLIDE 15

Transaction Chains

  • Not the same as blockchains
  • Each transaction output can be a future

transaction input.

  • Each output can only be spent once
  • To know what bitcoins are available you only

need to keep track of the Unspent Transaction Outputs (UTXOs).

slide-16
SLIDE 16

Transaction Chains

Figure from Mastering Bitcoin

slide-17
SLIDE 17

Transaction Chains

Figure from Mastering Bitcoin

slide-18
SLIDE 18

Transaction Forms

slide-19
SLIDE 19

Common Transactions

Most typical: Alice pays Bob, and keeps the change

Figure from Mastering Bitcoin

slide-20
SLIDE 20

Aggregating Transaction

Alice has many private keys and wants to combine them.

Figure from Mastering Bitcoin

slide-21
SLIDE 21

Distributing Transaction

Alice pays several different people simultaneously.

Figure from Mastering Bitcoin

slide-22
SLIDE 22

Reading for Next Time

  • Mastering Bitcoin, Chapter 9

–Reviews the blockchain

  • Mastering Bitcoin, Chapter 10

–Reviews mining and consensus