首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

大狗精读区块链白皮书之比特币(三)—Transactions

本文由币乎社区(http://bihu.com)内容支持计划奖励。

目前为止,本系列是全中文互联网中最清晰的白皮书解读系列。

今天是第三篇,讲的是比特币白皮书的Transactions(交易)部分,「区块链原理」的详细阐述就从这部分正式开始啦!

Transactions部分的核心内容是「区块链电子货币的交易过程」。为大家更好的理解,我已将该过程用图的形式进行拆分。祝大家阅读顺利:)

1 区块链电子货币的交易过程

1.1 白皮书译文

译文:我们定义,一枚电子货币是一系列数字签名构成的链(a chain of digital signatures)。每一位所有者根据前一次交易和下一位拥有者的公钥(public key)签署一个形式为「哈希」(hash)的数字签名,并将签名附加在这枚电子货币的末尾,电子货币就发送给了下一位所有者。而收款人通过对签名进行检验,就能够验证该链条的所有者。

1.2 概念解析

Hash:译为「哈希」或者「散列」。指将一串任意长度的数据通过「哈希函数」(Hash Function)转换出的「固定长度的字符串」,等同于这串数据的「唯一签名」。通过原始数据可以校验hash,也即判断签名真实性;但不能通过hash还原数据,也即是「不可逆」的。

公钥和私钥:两把相互配套的「数字钥匙」,可用来「加密解密」或「签名验证」。一般来说,公钥是公开的,私钥是所有者保密的。

既然是加密,那肯定是不希望别人知道我的消息,所以只有我才能解密,所以可得出公钥负责加密,私钥负责解密;同理,既然是签名,那肯定是不希望有人冒充我发消息,只有我才能发布这个签名,所以可得出私钥负责签名,公钥负责验证(*引用1)。

1.3 交易过程图解

(1)根据前一次交易和下一位拥有者(拥有者2)的公钥生成一个「哈希」(Hash)。

(2)「拥有者1」用「拥有者1」的私钥「签名」,「拥有者2」用「拥有者1」的公钥「验证」,无误后将签名添加至币的末端。

(3)同样过程的下一次交易。

2 传统解决方案——引入类似于「造币厂」的第三方机构

译文:该过程的问题在于,收款人将难以检验,之前的某位所有者,是否对这枚电子货币进行了双重支付。通常的解决方案,就是引入信得过的第三方权威,或者类似于造币厂(mint)的机构,来对每一笔交易进行检验,以防止双重支付。在每一笔交易结束后,这枚电子货币就要被造币厂回收,而造币厂将发行一枚新的电子货币;而只有造币厂直接发行的电子货币,才算作有效,这样就能够防止双重支付。可是该解决方案的问题在于,整个货币系统的命运完全依赖于运作造币厂的公司,因为每一笔交易都要经过该造币厂的确认,而该造币厂就好比是一家银行。

传统交易系统

「造币厂式」的第三方机构的运作机制

3 抛弃「造币厂式」第三方机构,构建「超级账本」

3.1 白皮书译文

译文:我们需要收款人有某种方法,能够确保之前的所有者没有对更早发生的交易实施签名。从逻辑上看,为了达到目的,实际上我们需要关注的只是于本交易之前发生的交易,而不需要关注这笔交易发生之后是否会有双重支付的尝试。为了确保某一次交易是不存在的,那么唯一的方法就是获悉之前发生过的所有交易。在造币厂模型里面,造币厂获悉所有的交易,并且决定了交易完成的先后顺序。如果想要在电子系统中排除第三方中介机构,那么交易信息就应当被公开宣布(publicly announced) ,我们需要整个系统内的所有参与者,都有唯一公认的历史交易序列。收款人需要确保在交易期间绝大多数的节点都认同该交易是首次出现。

3.2 解读

传统的「造币厂式」第三方机构通过「中心化」的方式,获悉了所有的交易和交易顺序,从而避免了「双重支付」,但这样的解决方案需要很高的成本。中本聪提出一种「去中心化系统」替代传统方案,在该系统中所有的交易都记载一个「账本」上,这个账本「公开透明」「唯一」——这就是我们一直听到的「超级账本」啦!

4 原文

We define an electronic coin as a chain of digital signatures.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.A payee can verify the signatures to verify the chain of ownership.

The problem of course is the payee can’t verify that one of the owners did not double-spend the coin. A common solution is to introduce a trusted central authority, or mint, that checks every transaction for double spending. After each transaction, the coin must be returned to the mint to issue a new coin, and only coins issued directly from the mint are trusted not to be double-spent.The problem with this solution is that the fate of the entire money system depends on the company running the mint, with every transaction having to go through them, just like a bank.

We need a way for the payee to know that the previous owners did not sign any earlier transactions. For our purposes, the earliest transaction is the one that counts, so we don’t care about later attempts to double-spend. The only way to confirm the absence of a transaction is to be aware of all transactions. In the mint based model, the mint was aware of all transactions and decided which arrived first.To accomplish this without a trusted party, transactions must be publicly announced , and we need a system for participants to agree on a single history of the order in which they were received. The payee needs proof that at the time of each transaction, the majority of nodes agreed it was the first received.

* 引用1:https://www.zhihu.com/question/25912483/answer/46649199

  • 发表于:
  • 原文链接http://kuaibao.qq.com/s/20180124G10D0500?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券