bitcoin transactions high level
play

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


  1. Cryptocurrencies & Security on the Blockchain Bitcoin Transactions, High-level Prof. Tom Austin San José State University

  2. Lab Review

  3. Bitcoin Blocks • Collections of transactions • Fixed size • Collectively, form a blockchain • Genesis block – the very first block

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

  5. Block Information • Version Reviewed another day • Timestamp • Previous block hash • Proof-of-work (PoW) target • Nonce (the "proof") • Merkle root

  6. Block Information • Version • Timestamp • Previous block hash • Proof-of-work (PoW) target • Nonce (the "proof") Determines transactions in • Merkle root block

  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.

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

  9. Storing Merkle Trees More efficient to 1 store in an array. Left child = n*2 3 2 Right child = n*2 +1 4 5 6 7 (A little adjustment is needed when indexing from 0).

  10. Using Merkle Trees • Merkle root is known • Validator requests specific transaction • Miner provides Merkle proof – Pieces needed to reconstruct Merkle root

  11. Merkle Path Merkle path for MR block B: • Block B H2 H1 • H(A) • H2 H(A) H(B) H(C) H(D) B D A C

  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.

  13. Lab: Implement a Merkle Tree Details in Canvas and course website.

  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.

  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) .

  16. Transaction Chains Figure from Mastering Bitcoin

  17. Transaction Chains Figure from Mastering Bitcoin

  18. Transaction Forms

  19. Common Transactions Most typical: Alice pays Bob, and keeps the change Figure from Mastering Bitcoin

  20. Aggregating Transaction Alice has many private keys and wants to combine them. Figure from Mastering Bitcoin

  21. Distributing Transaction Alice pays several different people simultaneously. Figure from Mastering Bitcoin

  22. Reading for Next Time • Mastering Bitcoin, Chapter 9 – Reviews the blockchain • Mastering Bitcoin, Chapter 10 – Reviews mining and consensus

Recommend


More recommend