EECS 485 Lecture 23
Blockchain
John Kloosterman
Copyright By PowCoder代写 加微信 powcoder
Learning Objectives
• Describe what a distributed ledger is and times it has an advantage over centralized databases
• Explain how mining builds a blockchain that implements a distributed ledger
• Discuss applications of blockchain technology
Distributed Ledger
What is Blockchain/Bitcoin?
• Blockchain
• Build consensus about a database and changes
• Without trusting any one person to maintain the database
• Bitcoin: Blockchain applied to currency
• Database: who has what amount of money
• No one person (like bank) who is the authority
• Central problem: double spending (give the same money to two different people)
Double spending
• In US, ACH system prevents double spending
Somebody else
Double spending
• With traditional banking, avoid double spending by checking the account’s balance
• Centralized balance sheet
• ACH system for transferring money
• Verify identity of the sender and recipient bank
• Verify account amounts
• Federal Reserve runs network
Double spending
• If you receive a Bitcoin, you can cryptographically verify the signatures
• But how can you verify that no double-spending took place?
SignA(Transfer X to B) Redeem X?
SignA(Transfer X to C)
Distributed ledger
• Distributed alternative to bank’s centralized balance sheet
• Bitcoin participants engage in peer-to-peer protocol that shares transaction data
• They collectively build a log of every Bitcoin transaction, ever
• The log is built from blocks
Distributed ledger
• Blockchain is essentially a distributed database with a shared protocol for multiple writers who don’t trust each other or a central authority.
• Blockchain useful when
• Database is shared with multiple writers • Users don’t trust each other
• Users don’t trust a central authority
• For double spend problem: agree on who has the coins 12
Spending Bitcoin
• Each block has: • A sequence id
• A timestamp
• Cryptographic hash of the previous block • Various metadata fields
• Some actual transactions!
Blockchain
• Blocks connected in a blockchain
• There’s always a backward hash link; eventually you can traverse it all the way back to the “genesis block”
• The set of blocks form a tree, with the genesis block at the root; possibly multiple branches
Mining and Blockchain
Blockchain
Stopping “fake” blocks
Why can’t anyone add blocks?
• Who is allowed to add a block is made intentionally random
• How to make something random when no central source of randomness?
• Make everyone do something that you have to get lucky to accomplish but easy to check
• Bitcoin: find a hash that starts with lots of 0s
Block difficulty
• Difficulty adjusted so one block found every ~10 minutes
• When you find a block, broadcast it to everyone, they will (hopefully) start working on new blocks that builds on yours
• Theory: you need control of 51% of miners to attack the system (can be lower)
Block rewards
• Block creator is allowed to insert some reward Bitcoin transactions
• This is how miners earn Bitcoins, and how Bitcoins are created
Who are the miners?
• You can make money mining if the value of rewards > cost of computers + power
• Power consumption of Bitcoin
• 7x all of Google’s data centers (nytimes, 9/3/21)
• $176 of power per transaction (Fortune, 10/26/21)
Bitcoin mining hardware
Blockchain Technologies
• Bitcoin + code
• “The DAO”: 2016 • $150 million
• Bug in code meant that the money was stolen
• Solution: everyone agreed to switch to a new version of
• Cryptokitties: 2017
Non-Fungible Tokens (NFTs)
• Application of blockchain to show ownership of something besides coins
• Videos of NBA dunks • $200K
• Artworks
• $69.3 million
• Bored Apes
• Where do you get money to start building a web service?
• Investors
• Users (Kickstarter)
• Invest in a platform, get coins useful on that platform
• e.g. Google Drive clone, coins might be ability to store 1GB of data
Silly uses
• If you can trust someone to maintain a database, don’t use blockchain
• Examples I hear of • Manufacturing
• Medical records
• Where do you keep your coins?
• With someone else? They’ll steal them (Mt. Gox)
• Yourself? Better not forget the password or throw the hard drive away
• Tether and Bitfinex
• Money laundering • Tax evasion
Investment
• Full disclosure: here are my financial opinions:
• Buy boring index funds
• Government macroeconomic policy is in general a good thing
• In general, the US has used its financial crimes enforcement for good
• If you find spending your fun money on “investing” enjoyable, it falls in the same category as Gamestop for me
Learning Objectives
• Describe what a distributed ledger is and times it has an advantage over centralized databases
• Explain how mining builds a blockchain that implements a distributed ledger
• Discuss applications of blockchain technology
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com