Hyperledger Fabric 2.0 Endorser

本文介绍了Hyperledger Fabric 2.0中Endorser的工作原理,包括System Chaincode如ConfigtxValidator、LedgerQuery、LSCC等的功能,Proposal的处理流程分为Pre Process、Simulate和Endorse三个阶段,以及Simulate Proposal如何模拟执行Chaincode并生成读写集。同时,文中提到了2.0版本中Chaincode启动和交互的改进。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

文章内容基于 Fabric v2.0.1 整理

Fabric 中所有与链相关的操作都通过 Chaincode 来实现,所有 Chaincode 的执行都是向 EndorserServer 提交 SignedProposal 来触发。

1. System Chaincode


Fabric 对于一些特殊功能(如 Chaincode 本身的管理,Channel 相关操作等)提供内置的 System Chaincode 来实现。有如下 System Chaincode :

  • cscc :the configuration handler for the peer,对 Channel 的管理
  • qscc :the ledger query functions,一些通用的查询功能
  • lscc :chaincode lifecycle and policies around it,1.x 版 Chaincode 管理
  • _lifecycle :2.0 新增用于替代 lscc ,实现更完善的 Chaincode lifecycle 管理(根据命令等的组织方式,个人臆测今后可能还会用于其他内容的 lifecycle 管理

另外还有两个 System Chaincode 通过插件的方式提供:

  • escc :endorsement system chaincode,部署 Chaincode 时指定,对 Chaincode 执行结果进行背书
  • vscc :Validate system chaincode,validates the given envelope corresponding to a transaction with an endorsement policy as given in its serialized form.

2. Process Proposal


Proposal 处理流程主要分为三部分:

  • Pre Process : 校验 Proposal 有效性,签名是否匹配等,对于非 System Chaincode 此阶段进行 ACL 检查
  • Simulate :此阶段会以当前 World State 为基础,使用提供的输入执行 Chaincode ,并生成对 World State 操作的读写集(RWSet
  • Endorse :当前 Peer 对此次 Proposal 正确的执行结果进行签名背书,有些 System Chaincode 不进行背书如 _lifecycle InstallChaincode

大体流程如下:

Created with Raphaël 2.2.0 Start Recv SignedProposal UnpackProposal
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值