[TOC]
交易相关数据结构
Block
区块,orderer 生成的区块(账本存储的区块结构)
Block
|\_Header # BlockHeader
| |\_Number # uint64
| |\_PreviousHash # []byte
| \_DataHash # []byte
|\_Data # *BlockData
| \_Data # [][]byte -> []Envelope ↓
| |_Envelope # Data 里面的 [][]byte 就是 Envelop 数组
\_Metadata #BlockMetadata
Envelop
交易信封,交易提案及背书结果,客户端发送给 orderer 出块的数据结构
- Envelop
Envelop
|\Payload # []byte -> Payload ↓
| |_Payload # Payload
| |\_Header # *common.Header <= Proposal.Header
| \_Data # []byte -> peer.Transaction ↓
| |_Transaction # peer.Transaction
| \_Actions # []*TransactionAction
\Signature # []byte 对 payloadbytes 的签名
- TransactionAction
TransactionAction
|\_Header # []byte -> common.SignatureHeader <= Proposal.Header.SignatureHeader
\_Payload # []byte -> peer.ChaincodeActionPayload ↓
|_ChaincodeActionPayload # peer.ChaincodeActionPayload
|\_ChaincodeProposalPayload # []byte -> peer.ChaincodeProposalPayload <= Proposal.Payload
\_Action # *ChaincodeEndorsedAction
|\_ProposalResponsePayload # []byte -> ProposalResponse.Payload
\_Endorsements # []*Endorsement
|_Endorsement # peer.Endorsement <= ProposalResponse.Endorsement
|\_Endorser # []byte
\_Signature # []byte
Proposal
交易提案,客户端发送给 peer 进行背书的数据结构
Proposal
|\_Header # []byte -> common.Header ↓
| |_Header # common.Header
| |\_ChannelHeader # []byte -> common.ChannelHeader
| \_SignatureHeader # []byte -> common.SignatureHeader
|\_Payload # []byte -> peer.ChaincodeProposalPayload ↓
| |_ChaincodeProposalPayload # peer.ChaincodeProposalPayload
| |\_Input # []byte -> peer.ChaincodeInvocationSpec
| \_TransientMap # map[string][]byte
\_Extension #
配置存储相关结构
存储在配置块中的配置数据结构 (层次关系: Block --> Envelop --> ConfigEnvelop)
orderer 的 genesisblock 就是这样的一个配置块。
Block
Block
|\_Header # BlockHeader
| |\_Number # uint64
| |\_PreviousHash # []byte
| \_DataHash # []byte
|\_Data # *BlockData
| \_Data # [1][]byte -> []Envelope ↓
| |_Envelope # Data 里面是长度为1的配置数据的Envelop数组
\_Metadata #BlockMetadata
Envelop
- Envelop
Envelop
|\Payload # []byte -> Payload ↓
| |_Payload # Payload
| |\_Header # *common.Header <= Proposal.Header
| \_Data # []byte -> common.ConfigEnvelope ↓
| |_ConfigEnvelope # common.ConfigEnvelope
\Signature # []byte 对 payloadbytes 的签名
- ConfigEnvelope
ConfigEnvelope
|\_Config # *Config
| |\_Sequence # uint64
| \_ChannelGroup # *ConfigGroup
| |\_Version # uint64
| |\_Groups # map[string]*ConfigGroup
| |\_Values # map[string]*ConfigValue
| |\_Policies # map[string]*ConfigPolicy
| \_ModPolicy
\_LastUpdate # *Envelope
配置更新相关结构
用于提交配置更新交易的数据结构(客户端提交给 orderer 进行通道配置更新,比如创建channel,更新channel等)
Envelop
- Envelop
Envelop
|\Payload # []byte -> Payload ↓
| |_Payload # Payload
| |\_Header # *common.Header <= Proposal.Header
| \_Data # []byte -> common.ConfigUpdateEnvelope ↓
| |_ConfigUpdateEnvelope # common.ConfigUpdateEnvelope
\Signature # []byte 对 payloadbytes 的签名
- ConfigUpdateEnvelope
ConfigUpdateEnvelope
|\_ConfigUpdate # []byte -> common.ConfigUpdate ↓
| |_ConfigUpdate # common.ConfigUpdate
\_Signatures # []*ConfigSignature
- ConfigUpdate
ConfigUpdate # 通过对新旧 Config 计算差异得到
|\_ChannelId # string
|\_ReadSet # *ConfigGroup
|\_WriteSet # *ConfigGroup
\_IsolatedData # map[string][]byte
部分通用配置结构
- Config
Config
|\_Sequence # uint64
\_ChannelGroup # *ConfigGroup
- ConfigGroup
ConfigGroup
|\_Version # uint64
|\_Groups # map[string]*ConfigGroup
|\_Values # map[string]*ConfigValue
|\_Policies # map[string]*ConfigPolicy
\_ModPolicy
附录
符号说明
-
\_
: 表示子属性 -
->
: 表示[]byte
序列化之前的结构 -
<=
: 表示数据内容填充来源 -
↓
: 表示其具体结构在下一级展开描述 -
|_
: 表示此项是上一级的原数据结构
网友评论