Hyperledger Fabric 官网翻译架构篇--之背书(endorsement)策略

3. Endorsement policies/背书(endorsement)策略

3.1. Endorsement policy specification/背书(endorsement)策略规范

An endorsement policy, is a condition on what endorses a transaction. Blockchain peers have a pre-specified set of endorsement policies, which are referenced by a deploy transaction that installs specific chaincode. Endorsement policies can be parametrized, and these parameters can be specified by a deploy transaction.

背书(endorsement)策略是认可交易的条件。区块链 peers具有预先指定的一组背书(endorsement)策略,这些策略由安装特定链码的部署交易引用。可以对背书(endorsement)策略进行参数化,并且可以通过部署交易指定这些参数。
 

To guarantee blockchain and security properties, the set of endorsement policies should be a set of proven policies with limited set of functions in order to ensure bounded execution time (termination), determinism, performance and security guarantees.

为了保证区块链和安全属性,一组背书(endorsement)策略应该是一组经过验证的策略,其功能有限,以确保有限的执行时间(终止),确定性,性能和安全保证。

Dynamic addition of endorsement policies (e.g., by deploy transaction on chaincode deploy time) is very sensitive in terms of bounded policy evaluation time (termination), determinism, performance and security guarantees. Therefore, dynamic addition of endorsement policies is not allowed, but can be supported in future.

动态添加背书(endorsement)策略(例如,通过在链码上部署交易配置时间)在有限策略评估时间(终止),确定性,性能和安全保证方面非常敏感。因此,不允许动态添加认可政策,但将来可以支持

3.2. Transaction evaluation against endorsement policy/针对背书策略的交易评估

A transaction is declared valid only if it has been endorsed according to the policy. An invoke transaction for a chaincode will first have to obtain an endorsement that satisfies the chaincode’s policy or it will not be committed. This takes place through the interaction between the submitting client and endorsing peers as explained in Section 2.

只有在根据背书(endorsement)策略批准了交易时,交易才能声明有效。链码的调用交易首先必须获得满足链码策略的认可,否则它将不会被提交。这通过提交客户端和背书(endorsing) peers之间的交互来实现,如第2节中所述。
 

Formally the endorsement policy is a predicate on the endorsement, and potentially further state that evaluates to TRUE or FALSE. For deploy transactions the endorsement is obtained according to a system-wide policy (for example, from the system chaincode).

正式的背书(endorsement)策略是对认可的预测,并可能进一步说明评估为真或假。对于部署交易,根据系统范围的策略(例如,从系统链码)获得认可。

An endorsement policy predicate refers to certain variables. Potentially it may refer to:

扫描二维码关注公众号,回复: 2806616 查看本文章

背书(endorsement)策略断言引用某些变量。它可能引用:

1.keys or identities relating to the chaincode (found in the metadata of the chaincode), for example, a set of endorsers;

与链码相关的键或身份标识(在链码的元数据中找到),例如,一组endorsers ;

2.further metadata of the chaincode;

链码的其他元数据;

3.elements of the endorsement and endorsement.tran-proposal;

endorsement and endorsement.tran-proposal 的元素

4.and potentially more.
还有更多。
 

The above list is ordered by increasing expressiveness and complexity, that is, it will be relatively simple to support policies that only refer to keys and identities of nodes.

上面的列表是通过增加表达性和复杂性来排序的,也就是说,支持仅引用节点的密钥和标识的策略将相对简单。
 

The evaluation of an endorsement policy predicate must be deterministic. An endorsement shall be evaluated locally by every peer such that a peer does not need to interact with other peers, yet all correct peers evaluate the endorsement policy in the same way.

对背书(endorsement)策略断言的评估必须是确定性的。每个endorsement (认可)都应在本地被每个peer评估认可,使得peer不需要与其他peers交互,但所有正确的peers都以相同的方式评估背书(endorsement)策略。
 

3.3. Example endorsement policies/ 背书(endorsement)策略示例

The predicate may contain logical expressions and evaluates to TRUE or FALSE. Typically the condition will use digital signatures on the transaction invocation issued by endorsing peers for the chaincode.

断言可能包含逻辑表达式,并且计算结果为TRUE或FALSE。通常情况下,条件将在由背书(endorsing) peers为链码发布的交易调用上使用数字签名。

Suppose the chaincode specifies the endorser set E = {Alice, Bob, Charlie, Dave, Eve, Frank, George}. Some example policies:

假设链码指定了endorser 集合E = {Alice,Bob,Charlie,Dave,Eve,Frank,George}。一些示例策略:

  • A valid signature from on the same tran-proposal from all members of E.

来自E所有成员的同一 tran-proposal上的有效签名

  • A valid signature from any single member of E.

来自E的任何一个成员的有效签名。

  • Valid signatures on the same tran-proposal from endorsing peers according to the condition (Alice OR Bob) AND (any two of: Charlie, Dave, Eve, Frank, George).

根据条件(Alice OR Bob) (any two of: Charlie, Dave, Eve, Frank, George). 来自背书(endorsing) peers,同一tran-proposal 上的有效签名。

  • Valid signatures on the same tran-proposal by any 5 out of the 7 endorsers. (More generally, for chaincode with n > 3f endorsers, valid signatures by any 2f+1 out of the n endorsers, or by any group of more than (n+f)/2 endorsers.)

7 endorsers 中的任何5名对同一tran-proposal 的有效签名。 (更一般地说,对于具有n> 3fendorsers 的链码,n endorsers 中的任何2f + 1或任何超过(n + f)/ 2 endorsers 的有效签名。)

  • Suppose there is an assignment of “stake” or “weights” to the endorsers, like {Alice=49, Bob=15, Charlie=15, Dave=10, Eve=7, Frank=3, George=1}, where the total stake is 100: The policy requires valid signatures from a set that has a majority of the stake (i.e., a group with combined stake strictly more than 50), such as {Alice, X} with any X different from George, or {everyone together except Alice}. And so on.

假设向endorsers 分配了“赌注”或“权重”,例如{Alice = 49,Bob = 15,Charlie = 15,Dave = 10,Eve = 7,Frank = 3,George = 1},其中总赌注为100:该策略要求拥有大部分赌注的集合中的有效签名(即,合并赌注严重超过50的集团),例如{Alice,X},其中任何X与George不同,或{除了爱丽丝之外,所有人等等。

  • The assignment of stake in the previous example condition could be static (fixed in the metadata of the chaincode) or dynamic (e.g., dependent on the state of the chaincode and be modified during the execution).

前一示例条件中的桩的分配可以是静态的(在链码的元数据中固定)或动态的(例如,取决于链码的状态并且在执行期间被修改)。

  • Valid signatures from (Alice OR Bob) on tran-proposal1 and valid signatures from (any two of: Charlie, Dave, Eve, Frank, George) on tran-proposal2, where tran-proposal1 and tran-proposal2 differ only in their endorsing peers and state updates.

来自(Alice OR Bob)对tran-proposal1的有效签名以及来自(any two of: Charlie, Dave, Eve, Frank, George)的有效签名关于tran-proposal2,其中tran-proposal1和tran-proposal2仅在其背书(endorsing) peers中有所不同和状态更新。

How useful these policies are will depend on the application, on the desired resilience of the solution against failures or misbehavior of endorsers, and on various other properties
这些策略的有用性取决于应用程序,取决于解决方案对于endorsers 的失败或不良行为的理想弹性,以及各种其他属性


Hyperledger Fabric 入门教程官方翻译目录

 

猜你喜欢

转载自blog.csdn.net/dreamslike/article/details/81712310
今日推荐