区块链教程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相关结构体定义

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

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

相关文章:

  • 2021-12-02
  • 2021-07-08
  • 2021-11-15
  • 2022-01-20
  • 2021-04-27
  • 2021-09-13
  • 2022-12-23
  • 2022-01-23
猜你喜欢
  • 2021-09-16
  • 2021-10-06
  • 2021-09-11
  • 2021-08-19
  • 2021-07-02
  • 2022-01-01
  • 2021-09-22
相关资源
相似解决方案