加密貨幣考試押題整理

散列hashing

  • 定義: Converts a digital object of arbitrary length, like a document, an image into a single string of fixed length, called a hash.
  • 性質:
    1. not continuous, two similar documents result in very different hashes;
    2. it is very hard to reverse engineer.
  • 什麼是SHA256和RIPEMD160
    1. SHA256 is a novel hash functions computed with 32-bit words;
    2. RIPEMD160 has a 160-bit hash value so it is used for shorted hash.

比特幣地址Bitcoin address

  • 定義:a bitcoin address is a string of 26-35 alphanumeric characters in Base58Check encoding, begining with the number 1 or 3.
  • 如何獲取:
    1. it is a hash of a public key------>P2PKH(Pay-to-Public-Key-Hash)。
    2. Public Key 經過 SHA256 + RIPEMD160 得到Public Key Hash, 再經過Base58Check Encode得到Bitcoin address。
    3. it is the hash of a script------>P2SH(Pay-to-Script=Hash)。

Merkle Tree

  • 作用:To prove some transaction included in hash.
  • 提供:交易的hash+交易的merkle path+Merkle root的hash,即可證明。

比特幣基礎知識

  • 單位:1 satoshi = 10810^{-8}Bitcoin,satoshi is smallest possible unit;
    1 MilliBit = 0.001Bitcoin = 100,000 satoshis
  • 比特幣上限是固定的,有Almost 21 million BTC,2,099,999,997,690,000 satisgus
  • 在2140年全部挖掘,共13.4million blocks
  • 每十分鐘出現一個新區快。每210,000個區塊比特幣的產出速率就會下降50%,目前是6.25bitcoin per block

比特幣編程語言——script

  • 介紹:reverse-Polish notation stack-based execution language
  • 堆棧操作:
    1. Push:adds an item to the top of the stack;
    2. pop:removes the item at the top of the stack.
  • 優點:
    1. Not hardware dependent
    2. enables execution on devices with limited memory, like embedded devices
    3. it is stateless. No state prior to execution and no state saved after execution.
  • 不能循環的影響:Does not permit loops or complex program control features:
    1. This means predictable execution times
    2. precludes attacks
    3. no infinite loops
    4. not Turing-complete.

Wallets

  • 什麼是錢包?
    1. Wallets is the primary user interface. Controls access to a user’s bitcoin; Manages keys and address; Tracks current balance; Enables creation and signing or transactions.
  • 錢包哪裏?
    1. May be held on client machine or on an exchange.
  • 錢包的功能?
    1. Wallets is the primary user interface. Controls access to a user’s bitcoin; Manages keys and address; Tracks current balance; Enables creation and signing or transactions.
    2. Wallets can keep a copy of the transaction; Can query the chain when needed.
    3. Wallet also refers to the data structure used to store and manage a user’s keys and address.
  • 錢包在personal machine vs exchange
    Wallet on personal machine is a software program in which you store Bitcoin; Wallet on exchange let you convert ‘real money’ like US dollars to Bitcoin. You don’t have full control of this exchange wallet.

區塊鏈的交易 transaction

  • 交易過程
    - origination--->bro
  • 交易的組成部分:
    1. an amount of Bitcoin, denominated in satoshis;
    2. A locking script which needs intended recipient to provide something to redeem it.
  • 如何贖回locking的script?
    1. They provide their signature and a hash of their public key or a hash of a script
  • 根據贖回方式有五種交易標準:
    1. Pay-to-Public-Key-Hash(P2PKH):a hash of a specific public key is needed to redeem.
    2. Pay-to-Script-Hash(P2SH)
    3. Pay-to-Public-Key(P2PK):Mostly used in coinbase transactions
    4. Multiple-signature:limited to 15 keys
    5. Data Output: 40 bytes of non-payment data to a Transaction output.
  • 區塊的第一筆交易basecoin trsansaction:
    定義:the bitcoin earnt by mining are awarded via the first transaction of each new block.
    性質:There are no UTXO inpus for these transaction.

UTXO

  • 什麼是UTXO?
    Unspent Transaction Output (UTXO) is the output of a transaction which may be spent as an input in a subsequent transaction.
  • UTXO與交易什麼關係?
    ‘Sending’ a recipient some bitcoin is done by creating some UTXO registered to their address.
  • UTXO的性質:
    1. All the UTXO of the system is known by every node, held in a database called UTXO set or UTXO pool.
    2. UTXO is locked to a specific address and may be scattered;
  • UTXO與wallet的關係:
    1. a wallet will aggregate the UTXO belonging to a single address.

分散共識Decentralized consensus

  • (節點如何驗證一個交易)Independen verification of each trasaction, by every full node.
    在這裏插入圖片描述
  • Independent aggregation of those transactions into new blocks by mining nodes together with demonstrated computation through a Proof-of-Work algorithm
  • (節點如何驗證一個新塊)Independent verification of the new blocks by every node and assembly into a chain
    在這裏插入圖片描述
  • independent selection, by every node, of the chain with the most cumulative computation demonstrated through Proof-of-Word.

PoW

  • 目的:Proof-of-Work is designed to create a hurdle to mining
  • 避免了什麼問題:
    1. nodes might spin-up multiple sock-puppet nodes to win the reward
    2. a form of Sybil attack
  • PoW的數學問題:Find the hash a specified object with a nonce parameter which is less than sum pre-specified total.
    對block header進行兩次SHA256運算,得到的值小於目標值即可。
    block header:version+previous_block_hash+merkle_root+time+target_bits+nonce
  • 這個數學問題的特點:
    1. Problem designed to be hard to do and easy to check
    2. Can only be solved by trial and error.
  • 哪些未記錄的transaction可以進入candidate block?
    1. Prioritized by age(how many blocks since the UTXO was recorded)
    2. Size of transaction(1 bitcoin, aged 1 day)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章