比特币开发者指南(区块链)

Block Chain(区块链)

The block chain provides Bitcoin’s public ledger, an ordered and timestamped record of transactions. This system is used to protect againstdouble spending  and modification of previous transaction records, usingproof of work verified by the peer-to-peer network to maintain a global consensus.

        比特币的区块链上提供按时间顺序排序的比特币交易公共记录。这个利用p2p网络的工作证明确认机制来维护一个全球共识的区块链系统是用来防止双重支付和防止修改以前交易记录的。

Block Chain Overview(区块链概述)

The illustration above shows a simplified version of a block chain.A block of one or more new transactions is collected into the transaction data part of ablock.Copies of each transaction are hashed, and the hashes are then paired,hashed, paired again, and hashed again until a single hash remains, themerkle root of a merkle tree.

The merkle root is stored in the block header. Each block also stores the hash of the previous block’s header, chaining the blocks together. This ensures a transaction cannot be modified without modifying theblock that records it and all following blocks.

Transactions are also chained together. Bitcoin wallet software gives the impression that satoshis are sent from and to wallets, but bitcoins really move from transaction to transaction. Each transaction spends the satoshis previously received in one or more earlier transactions, so the input of one transaction is the output of a previous transaction.

         上面的插图显示了一个简化版本的区块链。一批新交易作为交易数据的一部分被收集进区块链。所有交易中每笔交易的副本先被散列化,然后两两配对,然后两两被散列化,然后再配对,直到最后只有一个散列值剩下,这个散列值就是这个merkle tree的merkle root。

        merkle root被存储在区块头中。每一个区块以存储前一个区块头的的散列值这种方式将区块链接起来。这样做保证了一笔交易在不改动记录着本笔交易的区块及其该区块之后的所有区块的情况下是不会被修改的。

        交易也是被链接起来的。比特币钱包软件给人的印象是将satoshis从钱包里移进移出,但是实际上比特币是在各交易中流通的。每笔交易都是在花费之前一个或更早的交易中的satoshis,所以每笔交易的输入是更早一笔交易的输出。

A single transaction can create multiple outputs, as would be the case when sending to multiple addresses, but each output of a particular transaction can only be used as an input once in the block chain. Any subsequent reference is a forbidden doublespend—an attempt to spend the same satoshis twice.

Outputs are tied totransaction identifiers (TXIDs), which are the hashes of signed transactions.

Because each output of a particular transaction can only be spent once,the outputs of all transactions included in the block chain can be categorized as either Unspent Transaction Outputs (UTXOs) or spent transaction outputs. For  a payment to be valid, it must only use UTXOs as inputs.

Satoshis cannot be left in aUTXO after a transaction or they will be irretrievably lost, so any difference between the number ofsatoshis in atransaction’s inputs and outputs is given as a transaction fee to the Bitcoin miner who creates the block containing that transaction. For example, in the illustration above, each transaction spends 10,000satoshis fewer than it receives from its combined inputs, effectively paying a 10,000satoshitransaction fee.

        一笔交易可以生成多笔支出,这种情况下会输出到多个账户地址,但是每笔特定的支出只能在区块链上被仅作为一次输入。任何后续对之前交易中已经被当作输入的特定支出的引用都是被禁止的双重支付----企图对同一笔satoshis花费两次。

        支出和交易的标识符即已签名的交易的散列值关系密切。

        因为每笔特定交易的中的支出只能被花费一次,所以区块链上所有交易的支出可以被分为未花费的交易支出和已花费的交易支出。为了使支付有效,必须只能将未花费的交易支出作为交易的输入。

        一笔交易之后不能将satoshis剩余为未花费的交易支出,否则这剩余的satoshis将会彻底丢失,所以任何支出和输入的差额都将被作为交易费而奖励给挖到包含这笔交易的区块的矿工。例如。在上图中,每笔交易花费的10000satoshis比整体输入的satashis要少,实际上支付了10000satoshi作为交易费。


打赏地址:13dyX9hbF9d1VQsCYLN5KHmq3uaQEdqNMz

个人小站:春华秋月

你可能感兴趣的:(bitcoin)