Lecture 2.1 作者: bao_zijian@163.com Centralization vs decentralization such as e-mail: decentralized protocol,but dominated bu centralized webmail services
aspects of decentralization in Bitcoin: 1.who maintains ledger。 2.who has authority over which transactiona are valid? 3.who creaters new bitcoins? 4.who determines how the rules of the system change?(wait next lecture) 5.how do bitcoins acquires exchange values。(金融來解決)
Beyond the protocol: exchangers,wallet software,service providers
aspects of decentralization in Bitcoin: 1.p2p network open to anyone,low barrier to entry 2.mining open to anyone, but inevitable concentration of power often seen as undesirable 3.updates to softwate: core developers trusted by community,have great power.
Lecture 2.2 作者: bao_zijian@163.com Distributed consensus Why consensus protocols? Traditional motivation:reliability in distributed systems Distributed key-value store enables various applications: DNS,public key directory,stock trades
Distributed consensus protocol. There are nnodes that each have an input value. Some of these nodes are faulty or malicious. A distributed consensus protocol has the following two properties:
● It must terminate with all honest nodes in agreement on the value ● The value must have been generated by an honest node
How consensus could work in Bitcoin At any given time : All nodes have a sequence of blocks of transactions they have reached consensus on Each node has a set of outstanding transactions(沒有寫到區塊中的) it is heard about
Why consensus is hard nodes may crash nodes may be malicious Network is imprefect not all pairs of nodes connected faults in network latency
Many impossibility results Byzantine generals problem Fischer-Lynch_paterson(deterministic nodes): consensus impossible with a single faulty node
Lecture2.3 作者: bao_zijian@163.com Consense without identitiy:the block chain why identity。 Pragmatic:some protocols need node IDs 一些分布式協議需要ID最小的identitiy去做事 Security:assume less than 50% malicious 因為這些比特幣的一致性有些困難,但為什麼沒有identity。 1.點對點的去中化系統沒人可以賦值給ID——會有sybil attack 2.使用假名是比特幣的一個goal
Most common heuristic: 6 confirmations double-spend probability decreases exponentially with# of confirmations
Lecture 2.4 作者: bao_zijian@163.com Incentives and proof of work bitcoin 去中心化 一部分是技術機制 一部分是工程激勵機制 Assumption of honesty for behaving honestly。 can we give nodes incentives for behaving honestly。
Incentive 1: block reward Creator of block gets to include special coin-creation transaction in the block(把一個創幣記錄放入block中) choose recipient adddress of this transaction Value is fixed :currently 25 BTC,halves every 4 years Block creator gets to "collect" the reward only if the block ends up on long-term consensus branch.
Incentive 2: transaction fees(小費) Creator of transaction can choose to make output value less than input value. Remainder is a transaction fee and goes to block creator.
Remianing problems How to pick a random node? How to avoid a free-for-all due to rewards?(有激勵的情況下怎麼解決混戰問題。) How to prevent Sybil attack。(女巫攻擊,建立很多數量的合法節點,試圖破壞共識過程) 解決這3個問題? proof of work 工作量證明 To approximate selecting a random node: select nodes in proportion to a resource that no one can monopolize(we hope) In proportion to computing power : proof-of-work In proportion to ownership : proof-of-stake
Hash puzzles To create block, find nonce s.t. H(nonce || prev_hash || tx || ... || tx ) is very small
if hash function is secure: only way to succeed is to try enough nonces until you get lucky.
POW property 1: difficult to compute about 10的20次方 hashes/block Only some nodes bother to compete ——miners. POW property 2: parameterizable cost(成本能夠參數化) Nodes automatically re-calculate the target every two weeks. Goal: avarage time between blocks = 10minutes prob(Alice wins next block) = fraction of global hash power she controls
Key security assumption Attacks infeasible if majority of miners weigted by hash power follow the protocol. POW property 3: trivial to verify(簡單) 很容已驗證他是正確的。
Lecture 2.5 作者: bao_zijian@163.com Putting it all together mining economics if mining reward (block reward + tx fees)(bitcoin) > hardware electricity cost(dollars)——》profit complications: fixed vs variable costs reward depends on globle hash rate
Recap identities Block chain&consensus Transactions P2P network Hash puzzles&mining
Bitcoin has three types of consensus value state rules (硬軟分叉)
What can a 51% attacker do? 不行 Steal coins from existing address? Suppress some transactions? From the block chain yes From the P2P network no Change the block reward? no(比特幣的獎勵是寫在挖礦人的軟體上的) Destory confidence in bitcoin? yes 失去信心
Remaining questions how do we get from consensus to currency? what else can we do with consensus?