笔记 MIT6.824 Lecture 19: Bitcoin
目录
前言
讲的是比特币,一个去中心化的例子,谈到了相关的技术与问题
一、Bitcoin
1.1 去中心化
peer-to-peer有很多参与者,且它们中会有malicious,需要有新的解决方法
1.2 digital currency 的challenges
- outright forgery - 造假
- double spendig
- theft
1.3 idea: signed sequency of transactions
- 有bunch of coins, 有owners
- 每个coin都是有完整的交易记录
- 每个coin最近一次的交易indicates its owners
1.4 transaction record
pub(user1) : public key of new owner
hash(prev): hash of this coin’s previous transaction record
sig(user2): signature over transaction by previous onwer’s private key
Y owns a coin, previously given to it by X:
T6: pub(X), ...
T7: pub(Y), hash(T6), sig(X)
Y buys a hamburger from Z and pays with this coin
Z sends public key to Y
Y creates a new transaction and signs it
T8: pub(Z), hash(T7), sig(Y)
Y sends transaction record to Z
Z verifies:
T8's sig(Y) corresponds to T7's pub(Y)
Z gives hamburger to Y
1.5 prevent double-spending
publish a log of all transactions
ensure everyone sees the same log (in same order!)
ensure Y can’t un-publish a transaction
result:
Z will see Y->Z came before Y->Q, and will accept Y->Z
Q will see Y->Z came before Y->Q, and will reject Y->Q
a "public ledger"
二、the BitCoin block chain
the goal: agreement on transaction log to prevent double-spending
the block chain contains transactions on all coins
有很多peers
– 有完整的chain
– TCP 链接
– 新的block以及transactions会by TPC通知给各个peers
new block every 10 minutes containing xactions since prev block payee doesn’t accept transaction until it’s in the block chain
为什么要create each new block
2.1 how is a fork resolved?
会有Fork的可能性,但是会有一个会在后面接更多的blocks,然后多的那个就会变成主要的,之后的mining都会在这个上进行,这个叫做winning fork。
在没有决定谁是winning fork的时候,transaction是不可靠的,所以需要等待后面有多个Bolcks才能确保交易被成功记录在winning fork上
三、weak points
– too bad it’s a new currency as well as a payment system
– transaction confirmation takes at least 10 minutes, or 60 for high confidence
– flooding limits performance, may be a point of attack
– maximum block size plus 10 minutes limits max transactions per second
– users have trouble securing private keys
总结
通过ledger账本去中心化是一个greate idea,但是block以及transactions速度的限制不利于频繁大规模地交易,也就有很多不适用的场景