英文地址:http://hyperledger-fabric.readthedocs.io/en/latest/fabric_model.html
Hyperledger Fabric Model/ Hyperledger Fabric模型
This section outlines the key design features woven into Hyperledger Fabric that fulfill its promise of a comprehensive, yet customizable, enterprise blockchain solution:
本节概述交织在Hyperledger Fabric中的关键设计功能,以帮助Hyperledger Fabric实现其全面的,可定制的企业区块链解决方案的承诺:
Assets — Asset definitions enable the exchange of almost anything with monetary value over the network, from whole foods to antique cars to currency futures.
资产 - 资产定义使得能够在网络上交换几乎所有具有货币价值的东西,从整个食品到古董车到货币期货。
Chaincode — Chaincode execution is partitioned from transaction ordering, limiting the required levels of trust and verification across node types, and optimizing network scalability and performance.
链码 - 链码执行与交易排序分离,限制了跨节点类型的所需信任级别和验证级别,并优化了网络可伸缩性和性能。
Ledger Features — The immutable, shared ledger encodes the entire transaction history for each channel, and includes SQL-like query capability for efficient auditing and dispute resolution.
总账功能 - 不可变的共享总账对每个管道(channel)的整个交易历史记录进行编码,并且包含类似于SQL的查询功能,以进行高效的审计和争议解决。
Privacy through Channels — Channels enable multi-lateral transactions with the high degrees of privacy and confidentiality required by competing businesses and regulated industries that exchange assets on a common network.
通过管道(channel)进行隐私 - 管道(channel)能够实现多边交易,因为竞争企业和受管制行业在通用网络上交换资产所需的隐私和保密程度高。
Security & Membership Services — Permissioned membership provides a trusted blockchain network, where participants know that all transactions can be detected and traced by authorized regulators and auditors.
安全和会员服务 - 经过授权认证的会员关系提供了一个可信任的区块链网络,参与者知道所有的交易都可以被授权的监管机构和审计人员检测和追踪。
Consensus — A unique approach to consensus enables the flexibility and scalability needed for the enterprise.
共识 - 达成共识的独特方法可实现企业所需的灵活性和可扩展性。
Assets/资产
Assets can range from the tangible (real estate and hardware) to the intangible (contracts and intellectual property). Hyperledger Fabric provides the ability to modify assets using chaincode transactions.
资产可以从有形(不动产和硬件)到无形(合同和知识产权)。 Hyperledger Fabric提供了使用链码交易修改资产的功能。
Assets are represented in Hyperledger Fabric as a collection of key-value pairs, with state changes recorded as transactions on a Channel ledger. Assets can be represented in binary and/or JSON form.
资产在Hyperledger Fabric中被表示为键值对的集合,状态的改变记录为一个管道(channel)总账上的交易。资产可以用二进制和/或JSON格式表示
You can easily define and use assets in your Hyperledger Fabric applications using the Hyperledger Composer tool.
您可以使用Hyperledger Composer工具轻松定义和使用Hyperledger Fabric应用程序中的资产。
Chaincode/链码
Chaincode is software defining an asset or assets, and the transaction instructions for modifying the asset(s); in other words, it’s the business logic. Chaincode enforces the rules for reading or altering key-value pairs or other state database information. Chaincode functions execute against the ledger’s current state database and are initiated through a transaction proposal. Chaincode execution results in a set of key-value writes (write set) that can be submitted to the network and applied to the ledger on all peers.
Chaincode是定义资产的软件,以及修改资产的交易指令;换句话说,它是商业逻辑。 Chaincode强制执行读取或修改键值对或其他状态数据库信息的规则。 Chaincode函数针对总账的当前状态数据库执行,并通过交易提议启动。 Chaincode执行产生一组键值写入(写集),可以将其提交到网络并应用于所有peers方的总账。
Ledger Features/总账特点
The ledger is the sequenced, tamper-resistant record of all state transitions in the fabric. State transitions are a result of chaincode invocations (‘transactions’) submitted by participating parties. Each transaction results in a set of asset key-value pairs that are committed to the ledger as creates, updates, or deletes.
总账是序列化的,防篡改的,Fabric中所有状态转换的记录。状态转换是由参与方提交的链码调用('交易')的结果。每笔交易都会生成一组资产键值对,并将其作为创建,更新或删除提交给总账。
The ledger is comprised of a blockchain (‘chain’) to store the immutable, sequenced record in blocks, as well as a state database to maintain current fabric state. There is one ledger per channel. Each peer maintains a copy of the ledger for each channel of which they are a member.
总账由区块链('链')和状态数据库组成,区块链用于存储不可变的顺序记录,状态数据库用于维护当前结Fabric的状态。每个管道(channel)都有一个总账,每个管道(channel)的参与者都有一份该管道(channel)的总账的副本。
Some features of a Fabric ledger:
Fabric 总账的一些功能:
Query and update ledger using key-based lookups, range queries, and composite key queries
使用基于键的查找,范围查询和组合键查询来查询和更新总账
Read-only queries using a rich query language (if using CouchDB as state database)
用丰富查询语言的只读查询(如果使用CouchDB作为状态数据库)
Read-only history queries — Query ledger history for a key, enabling data provenance scenarios
只读历史记录查询 - 为一个键查询记录历史记录,实现数据来源方案
Transactions consist of the versions of keys/values that were read in chaincode (read set) and keys/values that were written in chaincode (write set)
交易由键/值的版本构成,这些键/值是在链码中读取的(读取集合)和在链码中写入的(写集合)。
Transactions contain signatures of every endorsing peer and are submitted to ordering service
交易包含每个背书(endorsing) peer方的签名,并提交给ordering 服务
Transactions are ordered into blocks and are “delivered” from an ordering service to peers on a channel
交易按顺序排列组装进块,并通过管道(channel)从ordering 服务“交付”给peers。
Peers validate transactions against endorsement policies and enforce the policies
Peers根据背书(endorsement)策略验证交易并执行相关策略
Prior to appending a block, a versioning check is performed to ensure that states for assets that were read have not changed since chaincode execution time
在附加块之前,执行版本检查以确保自链码执行开始以来读取的资产的状态未发生变 化
There is immutability once a transaction is validated and committed
一旦交易得到确认和承诺,交易具有不变性
A channel’s ledger contains a configuration block defining policies, access control lists, and other pertinent information
管道(channel)总账包含一个定义策略,访问控制列表和其他相关信息的配置块
Channels contain Membership Service Provider instances allowing for crypto materials to be derived from different certificate authorities
管道(channel)包含会员服务提供商(MSP)实例,允许加密材料从不同的认证机构派生
See the Ledger topic for a deeper dive on the databases, storage structure, and “query-ability.”
查看Ledger主题,深入了解数据库,存储结构和“查询能力”。
Privacy through Channels/通过管道(channel)隐私
Hyperledger Fabric employs an immutable ledger on a per-channel basis, as well as chaincodes that can manipulate and modify the current state of assets (i.e. update key-value pairs). A ledger exists in the scope of a channel — it can be shared across the entire network (assuming every participant is operating on one common channel) — or it can be privatized to include only a specific set of participants.
Hyperledger Fabric在每个管道(channel)基础上采用不变的总账,以及可以操纵和修改资产当前状态(即更新键值对)的链码。总账存在于管道(channel)范围内 - 可以在整个网络中共享(假设每个参与者都在一个公共管道(channel)上运营) - 或者可以向只是包含一个特定的参与者集合进行私有化。
In the latter scenario, these participants would create a separate channel and thereby isolate/segregate their transactions and ledger. In order to solve scenarios that want to bridge the gap between total transparency and privacy, chaincode can be installed only on peers that need to access the asset states to perform reads and writes (in other words, if a chaincode is not installed on a peer, it will not be able to properly interface with the ledger).
在后一种情况下,这些参与者将创建一个单独的管道(channel),从而隔离/隔离其交易和总账。为了解决想要缩小总体透明和隐私之间差距的方案,链码可以只安装在需要访问资产状态以执行读取和写入的peer方处(换句话说,如果一个链码未安装在peer方上,它将无法正确地与总账进行交互)。
To further obfuscate the data, values within chaincode can be encrypted (in part or in total) using common cryptographic algorithms such as AES before sending transactions to the ordering service and appending blocks to the ledger. Once encrypted data has been written to the ledger, it can be decrypted only by a user in possession of the corresponding key that was used to generate the cipher text. For further details on chaincode encryption, see the Chaincode for Developers topic.
为了进一步混淆数据,可以在将交易发送到ordering 服务和将块附加到总账之前,使用常用的加密算法(如AES)对链码中的值进行加密(部分或全部)。一旦将加密数据写入总账,只有拥有用于生成密文的相应密钥的用户才能解密。有关链式码加密的更多详细信息,请参阅Chaconode for Developers主题。
Security & Membership Services/安全和会员服务
Hyperledger Fabric underpins a transactional network where all participants have known identities. Public Key Infrastructure is used to generate cryptographic certificates which are tied to organizations, network components, and end users or client applications. As a result, data access control can be manipulated and governed on the broader network and on channel levels. This “permissioned” notion of Hyperledger Fabric, coupled with the existence and capabilities of channels, helps address scenarios where privacy and confidentiality are paramount concerns.
See the Membership Service Providers (MSP) topic to better understand cryptographic implementations, and the sign, verify, authenticate approach used in Hyperledger Fabric.
Hyperledger Fabric支持所有参与者已知身份的交易网络。公钥基础设施用于生成与机构,网络组件,最终用户或客户端应用程序绑定的加密证书。因此,数据访问控制可以在更广泛的网络和管道(channel)级别上进行操纵和管理。 Hyperledger Fabric的这种“许可”概念,再加上管道(channel)的存在和功能,有助于解决隐私和机密性成为首要问题的场景。
Consensus/共识
In distributed ledger technology, consensus has recently become synonymous with a specific algorithm, within a single function. However, consensus encompasses more than simply agreeing upon the order of transactions, and this differentiation is highlighted in Hyperledger Fabric through its fundamental role in the entire transaction flow, from proposal and endorsement, to ordering, validation and commitment. In a nutshell, consensus is defined as the full-circle verification of the correctness of a set of transactions comprising a block.
在分布式账本技术中,在一个单一功能中,共识最近已成为特定算法的同义词。然而,共识不仅仅是简单地就交易顺序达成一致,而且Hyperledger Fabric通过其在整个交易流程中的基本角色(从提议和认可,到ordering,确认和承诺)突出了这种差异。简而言之,共识被定义为构成一个区块的一组交易的正确性的全面验证。
Consensus is achieved ultimately when the order and results of a block’s transactions have met the explicit policy criteria checks. These checks and balances take place during the lifecycle of a transaction, and include the usage of endorsement policies to dictate which specific members must endorse a certain transaction class, as well as system chaincodes to ensure that these policies are enforced and upheld. Prior to commitment, the peers will employ these system chaincodes to make sure that enough endorsements are present, and that they were derived from the appropriate entities. Moreover, a versioning check will take place during which the current state of the ledger is agreed or consented upon, before any blocks containing transactions are appended to the ledger. This final check provides protection against double spend operations and other threats that might compromise data integrity, and allows for functions to be executed against non-static variables.
最终在区块交易的顺序和结果符合明确的策略标准检查时达成共识。这些检查和平衡发生在交易的生命周期中,并且包括使用背书(endorsement)策略来规定哪些特定成员必须认可某个交易类别,以及系统链码以确保这些策略得到执行和维护。在承诺之前,peers将使用这些系统链码来确保有足够的认可出现,并且它们来源于适当的实体。此外,在包含交易的任何块被附加到总账之前,将进行版本检查,在该期间,总账的当前状态是同意或商妥的。此最终检查可防止双重支出操作以及可能危及数据完整性的其他威胁,并允许针对非静态变量执行功能。
In addition to the multitude of endorsement, validity and versioning checks that take place, there are also ongoing identity verifications happening in all directions of the transaction flow. Access control lists are implemented on hierarchical layers of the network (ordering service down to channels), and payloads are repeatedly signed, verified and authenticated as a transaction proposal passes through the different architectural components. To conclude, consensus is not merely limited to the agreed upon order of a batch of transactions; rather, it is an overarching characterization that is achieved as a byproduct of the ongoing verifications that take place during a transaction’s journey from proposal to commitment.
除了发生大量的认可,有效性和版本检查之外,还有在交易流程的各个方向上进行的身份验证正在进行中。访问控制列表在网络的分层结构上实现(ordering 服务直至管道(channel)),并且在交易提议通过不同的架构组件时,有效载荷会重复签名,验证和验证。总而言之,共识并不仅限于一批交易的协商排序;相反,这是一个包罗万象的特征,是交易从提议到承诺之间的持续验证的副产品。
Check out the Transaction Flow diagram for a visual representation of consensus.
查看交易流程图以获得共识的直观表示。
Hyperledger Fabric 官网翻译入门教程目录