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

  区块链教程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
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值