[IT-Security-2] 數位貨幣及比特幣 Digital Cash and Bitcoin

Digital Cash and Bitcoin


Notes from RWTH Aachen University course 
“IT security 2” Wintersemester 2019/20
professor: Meyer, Ulrike Michaela

:cactus: Money

  • Commodity money
    • salt, gold, silver
  • Commodity standard
    • tokens (paper notes) of gold and silver
  • Fiat money
    • tokens have value decared by government
  • Electronic money
    • electronic representation of money

:cactus: E-cash

  • Naive approach
    • \((\text{value},sig_{bank}(\text{value}))\)
    • :film_projector: Problem 1: Double spending
      • 用 serial number (sn)
      • \((\text{sn, value},sig_{bank}(\text{sn, value}))\)
      • bank maintain sn 的database
      • 只有沒有被 deposit 過的錢可以被 deposit
    • :film_projector: Problem 2: increasing database
      • 用 expiration time (exp)
      • \((\text{sn, value, exp},sig_{bank}(\text{sn, value, exp}))\)
    • :film_projector: Problem 3: traceability
      • bank可以透過 sn link user/merchant
      • Blind RSA signatures
        • \(h=\text{H(sn,value,exp)}\)
        • user 選擇一個 random number \(r\)
        • user 給 bank \(h\cdot r^e \text{ mod } n\)
        • bank 簽章 \(h^d \cdot r \text{ mod } n\)
        • user 計算 \(h^d\cdot r\cdot r^{-1}\text{ mod } n\)
        • 即得到 bank 的數位簽章 \(h^d\text{ mod } n\)

        bank 無法link \(h^d \cdot r\) 及 \(h^d\)

    • :film_projector: Problem 4: how much the user pay
      • bank 用不同的 key 簽章
    • 其他機制:
      • 使用者要對 bank 認證自己

:cactus: Bitcoin

  • :droplet: Motivation
    • 沒有bank/ government
    • 沒有transaction cost,適合micropayments
    • anonymous payment
  • :droplet: Address
    • Address 是 public key 的 Hash
  • :droplet: Transactions
    • 對前一個交易的 output address (public key) 簽章以 authorize

      前一筆交易只有擁有 private key 的人能用

  • :droplet: Wallet
    • 有 private key/ public key pairs
    • 有 private key 就能花錢
  • :droplet: Transaction Verification
    • double spending
    • 沒有 bank 可以驗證這筆錢只花了一次
    • 用 Proof of Work
      • 找到nonce
  • :droplet: Blocks

    • transactions 的 collections
    • 三種type
      • in the main chain
      • in a side branch
      • orphan(孤兒) blocks: 沒有前一個 block
  • Merkle root
    • 所有 transactions 的 hash
    • 要驗證某筆交易是不是在 block 中,不需要下載所有交易
      只需要有跟這筆交易計算到 hash 的交易就可以


  • :droplet: Block Verification
    • 每個 transaction 被廣播
    • peer 蒐集 transaction
    • 驗證每個 transaction 的
      • 簽章
      • 輸入等於輸出
      • 前一筆交易是否在 main chain 中
    • 集合每個驗證的 transactions
    • 加入Tx0和自己的output address
    • 計算 nonce
    • 公開 nonce 和 hash 值
  • :droplet: Incentives
    • mining (驗證 block 的獎勵)
      • 透過 Tx0 得到
    • transaction fee (optionally)
      • 不直接定義
      • input - output
      • 透過 Tx0 傳給自己 的address
  • :droplet: Double spending
    1. 兩個transaction在同個block: 會立刻被檢查到
    2. 在不同個block: 一個已經在main chain上,另一個就不能再接下去
  • :droplet: Fast transaction
    • 通常要經過 6 個 block 後,才會被認為此 block 在 main chain 上

    bitcoin 不適合 fast transaction

  • :droplet: Anonymity
    • 製造多個地址,如果 address 和 identity 被連起來的話才不容易被知道
    • Problem: 如何被 customers 辨別多個地址是同個人
    • Problem: 如果要花錢要 link 兩個 addresses
  • Bitcoin 沒有提供 unlinkability
    • :socks: Linking with Multiple input transactions
      • 多個同個使用者的input
    • :socks: Linking with the help of Change to Own Address
      • input: address 0
        output: address 1, address 2
      • address 0 必屬於 1 或 2
    • :socks: Linking with real identity
      • 購買 bitcoin 通常會要真實 identity (with vendor/ exchange)
    • :pretzel: Protecting against de-anonymization
      • 用 Mixes
        • :one: Online wallet
          • 與 wallet 進行交易
          • 大家只會看到 wallet 的交易
          • 但會向 wallet 透露 identity
        • :two: Dedicated mixing service
          • 不要求identity
          • 送 bitcoin 給 mixing addresses
          • 再告訴 mix 要送到哪個 address
        • :three: CoinJoin
          • Decentralized mixing
          • users 共同創造一個 transaction
          • 只簽章自己的 transaction
          • 步驟:
            • 找到誰要 mix
            • 交換 input/ output
            • 創造 transaction
            • 每個人簽章自己的交易
            • 送到Bitcoin



Readings
§ David Chaum, Blind Signatures for untraceable payments, 1982 §Ron Rivest, PayWord and MicroMint, 1996
§ Satoshi Nakamoto, Bitcoin- A Peer-to-Peer Electronic Cash System, 2009 
§ Bitcoin Wiki
§ Nrayanan, Bonneau, Felten, Millder, Goldfeer: Bitoin and Cryptocurrency Technologies, Princeton University Press 2016

留言

這個網誌中的熱門文章