Bit Coin
Bit Coin
Cryptographic Hash
PPT by Brandon Fain & Bruce Maggs
Credits: Some slides taken from Bruce Maggs’ CompSci 590 course.
Those slides are themselves based in part on Based on a Bitcoin Tutorial
presentation by Joseph Bonneau, from Princeton University.
Outline
• Bitcoin and cryptocurrencies at a High Level
Trusted Parties
Cryptocurrency Problem
• How do we accomplish the following transaction:
• Without any trusted parties (cryptography), and
• Without any “hard money” being moved around, while still guaranteeing that
only amazon has the money afterward? (Cryptographic hash as proof of work
and the blockchain).
Outline
• Bitcoin and cryptocurrencies at a High Level
• Everyone knows the public keys (just post them “in the clear”), but only
Alice knows SA, and only Bob knows SB. Let M be a message that Alice
wants to send to Bob. She encrypts M with Bob’s public key, and then Bob
decrypts with his private key.
• But wait, what is a bitcoin really? And why can’t I just tell multiple
people that I’m sending them bitcoin at the same time?
Double spending: why ecash is hard
BANK
Alice
Redeem X?
SignA(Transfer X to Charlie
Charlie)
SignZ(Transfer X to
Alice) JB
Solution: Maintain a global public append-only log
The block chain –a
public ledger of all
transactions.
• The transaction is signed with the private key of address Y and broadcast,
along with the public key of Y, to the payment network
bmm
Bitcoin mining
• Approximately every ten minutes, one lucky Bitcoin miner earns a reward for
extending the block chain by one block.
• Mining is the only mechanism for creating new bitcoins. The total number of
Bitcoins will never exceed 21M. (Bitcoins in circulation:
https://blockchain.info/charts/total-bitcoins)
• The rewarded miner also receives all (optional) transaction fees in the block.
bmm
How is a new block created?
bmm
How is a transaction verified?
• The miner first checks the signature using the public key for address Y.
• compute hash of public key for Y, which should be Y
• check signature of transaction using public key for Y
• Then the miner checks the public ledger to verify that Y hasn’t already sent
these Bitcoins to someone else.
bmm
The Hashing Problem
• To extend the blockchain, a miner creates a new block, which has a block header. The block header
contains:
• Difficulty chosen so that the time until the first miner wins is about ten minutes, on average.
bmm
Target and Difficulty
• A miner can win if his/her hash value is below the current 256-bit target, i.e., the hash value has
enough leading zeros.
• Probability that a given nonce will produce a winning hash value is target / 2256
• Difficulty is adjusted every 2016 blocks. If a new block is added in ten minutes, 2016 blocks are
added in exactly two weeks.
Conclusion
• Bitcoin is a complicated system of currency, payment, algorithms, and
software. There are abundant technical, legal, and ethical dilemmas.