区块链的分类、架构和技术
Classification, structure and technology of block chains
吴国发
Oh Guofang!
(2020年12月19日)
(19 December 2020)
内容提要:本文简明扼要地介绍了区块链的分类、特征,三代区块链的架构,以及区块链的基本技术。
EXECUTIVE SUMMARY: This paper provides a brief and concise description of the classification of the block chain, its characteristics, the structure of the three-generation block chain and the basic techniques of the block chain.
关键词:区块链 比特币 以太坊 密码学 电子货币
Keywords: block chains, bitcoin, Etheria, cryptology, electronic currency.
区块链起源于比特币(Bitcoin)。比特币和区块链都是中本聪首创的。
The chain of blocks originates in Bitcoin. Bitcoin and the chain of blocks are the first to be created in China.
区块链有公共链、联盟链、私有链等多种类型。它们都有共同的特点。
Block chains are different types of public chains, chains of alliance, private chains, etc. They all share common features.
区块链的架构与一般计算机网络的架构不同,也与互联网的架构不同。
The structure of the block chain differs from that of the general computer network and from that of the Internet.
区块链技术不是一种技术,而是多种技术的综合体。
Block chain technology is not a technology, but a combination of multiple technologies.
区块链的分类
Classification of Block Chains
区块链有两种分类方法:按照参与方式分类;按照链与链的关系分类。
There are two classifications of block chains: by participatory approach; and by chain-to-chain relationship.
1.按照参与方式分类
1. Classification by mode of participation
(1)公共链(公有区块链)
(1) Public chain (public block chain)
公有区块链(Public Blockchain)对外公开,用户不必注册就可以匿名参与,无需授权就可以访问网络和区块链。公共链上的区块链可以被世界上的任何人查看。任何人都可以在公共链上发送交易,而且交易能够获得该区块链的有效确认;任何人都可以参与其共识过程。公共链是完全去中心化的区块链。
The public block chain (Public Blockchain) is publicly available, and users can participate anonymously without having to register, and access the network and block chain without being authorized to do so. The chain of blocks on the public chain can be viewed by any person in the world. Anyone can send a transaction on the public chain, and the transaction can be validly confirmed in that block chain; anyone can participate in its consensual process. The public chain is a completely decentralized chain.
公有区块链是最早的区块链,也是应用最广泛的区块链。各大比特币系列的虚拟数字货币(电子货币)都基于公共链。对于每个特定的比特币的币种,全世界有而且仅有一条对应的公共区块链。
The public block chain is the earliest and the most widely applied. Virtual digital currency (e-money) in each large bitcoin series is based on a public chain. For each particular bitcoin currency, there is and there is only one corresponding public block chain in the world.
(2)联盟链(联合区块链)
(2) Alliance chain (joint block chain)
联盟区块链(Consortium Blockchain)是某个群体创建的区块链,仅限于联盟成员参与。联盟成员需要获得注册许可,所以又称为许可链(Permission Blockchain)。区块链上的读写权限、记账权限按照联盟规则执行。
Union blocks chain (Consortium Blockchain) is a block chain created by a group and is limited to members of the union. Union members need a registration permit, so they are also called the licensing chain (Permission Blockchain).
联盟链创建者指定多个预选的节点为记账人。每个块的生成由所有的预选节点共同决定。预选节点参与共识过程;其它接入节点可以参与交易,但不过问记账过程。因此,其本质是托管记账,只是变成分布式记账。其他任何人可以通过该区块链开放的API(区块链接口)进行被限定的查询。
Union chain creators assign multiple pre-selected nodes as bookkeepers. Each block is generated by all pre-selected nodes jointly. Pre-selected nodes participate in the consensus process; other access nodes can be involved in the transaction, but only in the bookkeeping process.
世界上有两个著名的联盟链:
There are two well-known alliances in the world:
其一,2015年,由40多家银行和IT巨头组成了R3区块链联盟。联盟成员包括美国的摩根大通、高盛,瑞士的瑞信,英国的汇丰、巴克莱,美国IT巨头IBM、微软公司。
First, in 2015, more than 40 banks and IT giants formed the R3 block chain alliance. The alliance includes Morgan Chase, Goldman Sachs, Switzerland, Britain’s HSBC, Barclay, America’s IT giant, IBM, Microsoft.
其二,操作系统Linux基金会支持的超级账本(Hyperledger)。
Second, a superbook (Hyperledger) supported by the operating system Linux Foundation.
(3)私有链(私有区块链)
(3) Private chain (private block chain)
私有区块链(Private Blockchain)是供个人或者组织内部记账用的区块链。区块链上的读写权限、记账权限按照组织制定的规则执行。私有链一般是单位内部使用。私有链的成员也需要获得注册许可,所以也是许可链。
The private chain is usually used within the unit. Members of the private chain also need a registration permit, and are therefore also a licensing chain.
币科学(Coin Science)公司开发了一个“多链(Multichain)平台”,供企业建立私有链之用。
Coin Science has developed a Multi-chain (Multechain) platform for enterprises to build private chains.
2.按照链与链的关系分类
2. Classification by chain-to-chain relationship
(1)侧链
(1) Side chains
2014年,亚当·贝克(Adam Back)等人发表了一篇论文《用与比特币挂钩的侧链来提供区块链创新》(Enlabling Blockchain Innovations with Pegged Sidechains),提出了侧链(Sidechain)的概念。所谓侧链就是与比特币交互且与比特币挂钩的区块链。
In 2014, Adam Back et al. published a paper, Enlabling Blockchain Innovations with Pegged Sidechais, presenting the concept of Sidechain. The so-called Side Chain is a sector chain that interacts with Bitcoin and is linked to Bitcoin.
(2)互联链
(2) Links
特定领域应用的联盟链和特定组织的私有链可能会有互联互通的需求。这些区块链会通过某种互联互通的协议连接起来,组成大型的区块链网络,称为互联链。
There may be a need for connectivity in the union chain applied in a particular area and in the private chain of a particular organization. These blocks are linked by some kind of interconnection agreement, forming a large network of blocks, known as the interlinkage chain.
区块链的特征
Features of block chains
区块链的基本特征如下:
The basic characteristics of the block chain are as follows:
(1)去中心化
(1) Centralization
由于区块链使用分布式核算和存储,不存在中心化的硬件或管理机构。对于公共链,任意节点的权利和义务都是均等的。区块链系统中的数据由具有维护功能的节点来共同维护。去中心化(无中心)是区块链最突出、最本质的特征。
There is no centralized hardware or regulatory body because block chains use distributed accounting and storage. For public chains, the rights and obligations of any node are equal.
(2)开放性
(2) Openness
区块链基础技术的计算机源程序是开源的。
Computer source programs for block chain basic technology are open-sourced.
除了交易各方的私有信息被加密外,公共链的区块链数据对所有人开放,任何人都可以通过公开的接口查询区块链数据和开发相关应用。因此,公共链的整个系统信息高度透明。
In addition to encryption of private information from the parties to the transaction, the block chain data in the public chain are open to all, and anyone can access the block chain data and develop related applications through open interfaces. Therefore, the entire system information in the public chain is highly transparent.
(3)自治性
(3) Autonomy
基于协商一致的规范、协议和公开的算法(比如比特币采用的哈希算法),各种区块链系统都不依赖第三方,所有节点能够在系统内自动安全地验证、交换数据,不需要任何人为的干预。
Consensus-based norms, protocols and open algorithms (e.g. the Hashi algorithm used in Bitcoin) do not rely on third parties for various block chain systems, and all nodes are able to verify and exchange data automatically and safely within the system without intervention by anyone.
在区块链系统,对“人”的信任改成了对机器的信任,任何人为的干预不起作用。
In the block chain system, trust in the “person” has been transformed into trust in the machine, and intervention by any person is ineffective.
(4)安全性
(4) Security
一旦信息经过验证并添加到区块链,就会永久地存储起来。单个节点上对数区块链数据的修改是无效的。只要不能掌控全部数据节点的51%,就无法有效地修改网络数据。这使区块链本身变得相对安全,数据稳定性和可靠性很高。
Once the information is verified and added to the block chain, it is stored permanently. The modification of the logarithmic block chain data on a single node is invalid. As long as 51 per cent of all data nodes cannot be controlled, the network data cannot be effectively modified. This makes the block chain itself relatively secure, with high data stability and reliability.
但是,区块链存在安全隐患。对此,我们将在区块链序列文章的最后一篇《比特币和区块链是大阴谋吗》详细阐述。
However, there are security risks to the block chain. In this regard, we will elaborate on the last article of the block chain series, " Is Bitcoin and block chain a big conspiracy? ".
(5)匿名性
(5) Anonymousity
除非有法律规范要求,单从技术上来讲,各区块节点的操作者的身份信息不需要公开或验证,信息传递可以匿名进行。
Unless required by legal norms, the identity information of the operator at each block node is not technically required to be publicly available or authenticated, and the transmission of the information may be anonymous.
区块链的架构
Structure of the block chain
在“区块链系列”的第一篇文章《区块链的起源、定义和发展》中,我们已经说明,区块链的发展经历了三代:区块链1.0,区块链2.0,区块链3.0(刚开始)。每一代区块链有不同的架构。
In the first article in the Block Chain Series, Origins, Definitions and Developments of the Block Chain, we have explained that the Block Chain has evolved over three generations: the Block Chain 1.0, the Block Chain 2.0, and the Block Chain 3.0 (beginning).
一.区块链1.0的架构
I. Structure of block chain 1.0
区块链1.0.的典型应用是比特币。因此,比特币的区块链架构就是区块链1.0.的典型架构。
The typical application of a block chain of 1.0. is Bitcoin. Thus, the block chain structure of a bitcoin is the typical structure of a block chain of 1.0.
比特币架构由两部分组成:前端和后端。
The Bitcoin structure consists of two parts: front and back.
前端是用户和开发者的图形化界面,包括钱包(Wallet)。
The front end is a graphical interface for users and developers, including Wallet.
后端是运行在每个节点的后台程序,包括“挖矿”、区块链管理、网络管理等。
The backend is a back-office procedure for each node, including “mining”, block chain management, network management, etc.
二.区块链2.0的架构
II. Structure of block chain 2.0
通常,我们所说的“区块链架构”是指区块链2.0的架构。区块链2.0架构有多种,典型的区块链2.0架构是以太坊架构。
Usually, what we call a block chain structure is a block chain structure of 2.0. The block chain structure of 2.0 is diverse, and the typical block chain structure of 2.0 is a box structure.
以太坊(Ethereum)是全球通用的开源无中心区块链平台,包括电子货币(数字货币)“以太币(Ether,简称ETH)”、以太虚拟机(Ethereun Virtual Machine,简称EVM)和编程语言。以太坊提供三种编程语言:Solidity,Serspent,LLL(List Like Language)
Etheeum is a global open-source no-centre block chain platform, including electronic currency (digital currency), Etherun Virtual Machine and programming language. Three programming languages are available in Etherity, Serspent, LL (List Like Language)
区块链2.0的架构分成六层,从底层到顶层依次是:数据层,网络层,共识层,激励层,合约层,应用层,如下图所示:
The block chain 2.0 structure is divided into six layers, from the bottom to the top: the data layer, the network layer, the consensus layer, the incentive layer, the contract layer, the application layer, as shown in the figure below:
1.数据层
1. Data layer
数据层是区块链的底层,是一切的基础。
The data layer is the bottom of the block chain and the basis of everything.
数据层主要有两个功能:一个是相关数据的存储;另一个是账户和交易的实现与安全。
The data layer has two main functions: the storage of relevant data; and the realization and security of accounts and transactions.
数据存储主要基于Merkle树,通过区块的方式和链式结构实现。
Data storage is based mainly on Merkle trees and is done by block mode and chain structure.
帐号和交易的实现基于数字签名、哈希函数和非对称加密技术等多种密码学算法和技术。这样就保证了交易在去中心化的情况下能够安全地进行。
Accounts and transactions are performed on the basis of a variety of cryptographic algorithms and techniques, such as digital signatures, Hashi functions and non-symmetric encryption techniques. This ensures that transactions can be carried out safely when decentralised.
2.网络层
2. Network level
网络层主要实现网络节点的连接和通讯。
The network layer primarily provides connection and communication to network nodes.
网络层使用的技术称为点对点技术。这是没有中心服务器、依靠用户群交换信息的互联网体系。与有中心服务器的中央网络系统不同,对等(P2P)网络的每个用户端既是一个节点,也有服务器的功能。
The technology used at the network level is called point-to-point technology. This is an Internet system that does not have a central server and relies on the user community to exchange information. Unlike a central network system with a central server, each user end of a peer (P2P) network is either a node or a server function.
3.共识层
3. Consensus layer
共识层的功能主要是:实现全网所有节点对交易和数据达成一致,保障交易的安全。在共识层,能够防范拜占庭攻击、女巫攻击、51%攻击等共识攻击。
The main function of the consensus level is to achieve agreement on transactions and data across the network at all nodes and to guarantee the security of transactions. At the consensus level, it protects against consensus attacks such as Byzantine attacks, witch attacks, and 51% attacks.
共识层的算法称为共识机制。因为其应用场景不同,区块链2.0出现了四种不同的共识机制: PoS,DPoS,PoW,PBFT。
The consensus layer algorithm is called the consensus mechanism. Because of its different application scenarios, the block chain 2.0 has four different consensus mechanisms: PoS, DDPS, PoW, PBFT.
4.激励层
4. Incentive layer
激励层主要实现区块链代币的发行和分配。
The incentive layer mainly achieves the issuance and distribution of block chain tokens.
以太坊中的以太币,可以通过“挖矿”获得,每挖到一个区块固定奖励5个以太币。
Ether in the Etherm, which can be obtained through “mining”, has a fixed incentive of five for each block that has been dug up.
5.合约层
5. Contract floor
合约层赋予账本可编程的特性。区块链通过虚拟机(例如以太坊的EVM)的方式运行代码实现智能合约的功能。
The contract layer assigns a programable character to the account book. The block chain functions as a smart contract by running a code using virtual machines (e.g., the EVM in Taiwan).
同时,合约层通过在智能合约上添加能够与用户交互的前台界面,形成去中心化的应用(DAPP)。
At the same time, the contract layer develops decentralised applications (DAPPs) by adding front-office interfaces to smart contracts that can interact with users.
6.应用层
6. Application layer
区块链2.0的应用层封装了区块链的各种应用场景和案例,例如电子货币。
The application layer of block chain 2.0 covers various applications and cases of block chain, such as electronic currency.
下面所述区块链3.0的应用也归结到应用层。
The application of 3.0 of the block chain described below is also attributed to the application layer.
三.区块链3.0的架构
III. Structure of block chain 3.0
美国梅兰妮·斯万(Melanie Swan)的著作《区块链:新经济蓝图》把超越货币、金融范围的区块链应用归结为区块链3.0。
The US publication Melanie Swan, The Block Chain: A New Economic Blueprint, classifies the use of blocks that go beyond monetary and financial boundaries as block chains of 3.0.
至今,区块链行业界还没有成熟的区块链3.0平台,所以也没有公认的区块链3.0的架构。
To date, the block chain industry has not had a mature block chain 3.0 platform, so there is no accepted block chain 3.0 structure.
区块链的技术
Technology for block chains
所谓“区块链技术”不是一种技术,而是多种技术的综合体。区块链基本技术包括:分布式账本,非对称加密,共识机制,智能合约,以及密码学技术。
The so-called block chain technology is not a technology, but a combination of multiple technologies. The basic technologies of the block chain are distributed books, asymmetric encryption, consensus mechanisms, smart contracts, and cryptography.
一.分布式账本
I. Distributed books of accounts
分布式账本指的是交易记账由分布在不同地方的多个独立节点共同完成,而且每一个节点记录的是完整的账目。因此,各个节点都可以参与监督交易合法性,同时也可以共同为其作证。
Distributed books refer to transactions that are carried out jointly by several separate nodes located in different locations, and each node records a complete account. Each node can therefore be involved in monitoring the legitimacy of the transaction and can testify against it together.
除了个人私有的账本外,没有任何一个节点可以排他性地单独记录账本数据,从而避免了单一记账人被控制或者被贿赂而记假账的可能性。
With the exception of privately owned books of accounts, there is no single node for exclusive separate recording of account book data, thus avoiding the possibility of a single bookkeeper being controlled or bribed to keep a false account.
二.非对称加密
II. Asymmetric encryption
存储在区块链上的交易信息是公开的,但是账户身份信息是高度加密的。区块链采用非对称加密算法保障账户身份信息的安全。
The transaction information stored on the block chain is publicly available, but the account identification information is highly encrypted.
非对称加密算法需要两个密钥:公开密钥(public key)和私有密钥(private key)。公开密钥与私有密钥是一对,如果用公开密钥对数据进行加密,只有用对应的私有密钥才能解密;如果用私有密钥对数据进行加密,那么只有用对应的公开密钥才能解密。因为加密和解密使用的是两个不同的密钥,所以这种算法叫作非对称加密算法。
Asymmetric encryption algorithms require two keys: public key and private key. Public key versus private key is a pair, and if the data is encrypted with a public key, only the corresponding private key can be decrypted; if the data is encrypted with a private key, then only the corresponding public key can be decrypted with a corresponding key. Because encryption and decipher use two different keys, this algorithm is called as an asymmetric encryption algorithm.
三.共识机制
III. Consensus mechanism
共识机制就是所有记账节点之间怎么达成共识,去认定一个记录的有效性。这既是认定的手段,也是防止篡改的手段。
The consensus mechanism is how to reach a consensus among all the bookkeeping nodes to determine the validity of a record. This is both a means of identification and a means of preventing tampering.
区块链的共识机制具备“少数服从多数”以及“人人平等”的特点,其中“少数服从多数”并不完全指节点个数,也可以是计算能力、股权数或者其他的计算机可以比较的特征量。“人人平等”是当节点满足条件时,所有节点都有权优先提出共识结果,被其他节点认同后成为最终共识结果。
The consensus mechanism of the block chain has the characteristics of “minority submissive majority” and “equality for all” in which “minority subservient majority” does not refer exclusively to the number of nodes, but can also be the number of characteristics that can be compared between computing capacity, equity or other computers. “Equality for all” is the right of all nodes to give priority to consensus outcomes, which are endorsed by other nodes as final consensus outcomes when the conditions are met.
四.智能合约
IV. Smart contracts
智能合约是基于可信的不可篡改的数据,可以自动化地执行一些预先定义好的规则和条款。
Smart contracts are based on credible and irrevocable data and allow for the automated implementation of predefined rules and provisions.
五.密码学技术
V. cryptography technology
密码学技术是区块链技术的核心。
cryptography is at the core of block chain technology.
区块链使用的技术涉及到的密码学技术包括:hash算法、对称加密与非对称加密、数字签名等。
The techniques used in block chains involve cryptography techniques such as: hash algorithms, symmetric encryption and asymmetric encryption, digital signatures, etc.
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论