Bitcoin 學習

區塊鏈(Blockchain)是比特幣的底層技術,像一個數據庫賬本,記載所有的交易記錄。這項技術也因其安全、便捷的特性逐漸得到了銀行,金融業,保險,防僞等領域的關注。而比特幣又可以說是區塊鏈技術的應用。爲了瞭解區塊鏈的運行機制,在此簡單介紹比特幣是如何運行的。

  • 概要
    一種完全通過點對點技術實現的電子現金系統,它使得在線支付能夠直接由一方發起並支付給另外一方,中間不需要通過任何的金融機構。
  • 概念
    交易:在比特幣中的電子貨幣是一種數字簽名鏈
    數字簽名:Each owner transfers the coin to the next by digitally signing a hash of the previous transaction and the public key of the next owner and adding these to the end of the coin.
    數字簽名分步描述:
    (1) Hash previous transaction and the public key of the next owner
    (2) Owner sign the hash
    (3) Add the transaction to the end of the coin
    The current bitcoin ower want to transfer its bitcoin to the next owner
    Firstly, get a hash by hashing the previous transaction and the public key of the next owner
    Secondly, the current owner sign the hash.
    Use the corrent owner’s private key to sign it, which means the coin belongs to the current owner.
    Use the current owner’s public key to verify its ownship.
    Thirdly, add the transaction to the end of the coin.

Transaction

  • Problem

Double-spending

  • Solution

1) a trusted central authority like a bank
2) Bitcoin solution:
a.Timestamp Server:
A timestamp server works by taking a hash of a block of items to be timestamped and widely publishing the hash.
Prove that the data must have existed at the time in order to get into the hash.
b. Proof-of-work
Increment a nonce in the block until a value is found that gives the block’s hash the required zero bits.

  • Network
    The steps to run the network are as follows
    1) New transactions are broadcast to all nodes. (What is a transaction: 簽名下一個擁有者的public-key 和前一個交易的hash)
    2) Each node collects new transactions into block.
    3) Each node works on finding a difficult proof-of-work for its block. (nonce)
    4) When a node finds a proof-of-work, it broadcasts the block to all nodes.
    5) Nodes accept the block only if all transactions in it are valid and not already spent.
    6) Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.
    Where does timestamp server work?
  • Longest chain first
    If two nodes broadcast different versions of the next block simultaneously, some nodes may receive one or the other first. Ih that case, they work on the first one they received, but save the other branch in case it becomes longer.
  • Large possibility
    New transaction only needs reach many nodes, they will get into a block before long.
    Block broadcasts are also tolerant of dropped messages. If a node does not receive a block, it will request it when it receives the next block and realizes it missed one. ( It is a problem.)
  • Incentive
  • Reclaiming disk space
    Merkle Tree ( save space, it there a better way to resolve it?)
  • Simplified payment verification
    A user only needs to keep a copy of block neaders of the longest proof-of-work chain, which he can get by querying
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章