您现在的位置是:首页 > 文章详情

区块链教程Fabric1.0源代码分析Proposal(提案)-兄弟连区块链学院

日期:2018-11-06点击:379

区块链教程Fabric1.0源代码分析Proposal(提案),2018年下半年,区块链行业正逐渐褪去发展之初的浮躁、回归理性,表面上看相关人才需求与身价似乎正在回落。但事实上,正是初期泡沫的渐退,让人们更多的关注点放在了区块链真正的技术之上。

Fabric1.0源代码笔记之Proposal(提案)

1、Proposal概述

Proposal,即向Endorser发起的提案。
Proposal代码分布在protos/utils、protos/peer目录下,目录结构如下:

protos/utils目录:
    proputils.go,Proposal工具函数。
    txutils.go,Proposal工具函数。
protos/peer目录:
    proposal.pb.go,Proposal相关结构体定义。

2、Proposal相关结构体定义

_3

2.1、SignedProposal定义

type SignedProposal struct {     ProposalBytes []byte //Proposal序列化,即type Proposal struct     Signature []byte //signer.Sign(ProposalBytes) } //代码在protos/peer/proposal.pb.go

2.2、Proposal定义

type Proposal struct {     Header []byte //Header序列化,即type Header struct     Payload []byte //ChaincodeProposalPayload序列化,即type ChaincodeProposalPayload struct     Extension []byte //扩展 } //代码在protos/peer/proposal.pb.go

2.3、ChaincodeProposalPayload定义

type ChaincodeProposalPayload struct {     Input []byte //ChaincodeInvocationSpec序列化,即type ChaincodeInvocationSpec struct     TransientMap map[string][]byte //瞬态映射 } //代码在protos/peer/proposal.pb.go

3、ProposalResponse结构体定义

3.1、ProposalResponse定义

type ProposalResponse struct {     Version int32     Timestamp *google_protobuf1.Timestamp     Response *Response //type Response struct,peer.Response{Status: 200, Message: "OK"}}     Payload []byte     Endorsement *Endorsement //type Endorsement struct } //代码在protos/peer/proposal_response.pb.go

3.2、Response定义

type Response struct { //peer.Response{Status: 200, Message: "OK"}}     Status int32     Message string     Payload []byte } //代码在protos/peer/proposal_response.pb.go

3.3、Endorsement定义

type Endorsement struct {     Endorser []byte //bccspmsp.signer     Signature []byte } //代码在protos/peer/proposal_response.pb.go
原文链接:https://yq.aliyun.com/articles/665682
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章