-
Notifications
You must be signed in to change notification settings - Fork 29
/
rawblock.go
128 lines (107 loc) · 3.52 KB
/
rawblock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Copyright © 2023 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package utils
import (
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/msp"
"github.com/hyperledger/fabric-protos-go/peer"
)
type RawBlock struct {
Data *BlockData `json:"data"`
Header *common.BlockHeader `json:"header"`
Metadata *common.BlockMetadata `json:"metadata"`
}
type BlockData struct {
Data []*BlockDataEnvelope `json:"data"`
}
type BlockDataEnvelope struct {
Payload *Payload `json:"payload"`
Signature string `json:"signature"`
}
type Payload struct {
Data *PayloadData `json:"data"`
Header *PayloadHeader `json:"header"`
}
type PayloadHeader struct {
ChannelHeader *ChannelHeader `json:"channel_header"`
SignatureHeader *SignatureHeader `json:"signature_header"`
}
type ChannelHeader struct {
ChannelID string `json:"channel_id"`
Epoch string `json:"epoch"`
Timestamp int64 `json:"timestamp"`
TxID string `json:"tx_id"`
Type string `json:"type"`
Version int `json:"version"`
}
type SignatureHeader struct {
Creator *msp.SerializedIdentity `json:"creator"`
Nonce string `json:"nonce"`
}
type PayloadData struct {
// Actions only exists in endorsement transaction blocks
Actions []*Action `json:"actions,omitempty"`
// Config only exists in config and config update blocks
Config *common.Config `json:"config,omitempty"`
}
//
// Types used only in endorsement transaction blocks
//
type Action struct {
Header *SignatureHeader `json:"header"`
Payload *ActionPayload `json:"payload"`
}
type ActionPayload struct {
Action *ActionPayloadAction `json:"action"`
ChaincodeProposalPayload *ChaincodeProposalPayload `json:"chaincode_proposal_payload"`
}
type ActionPayloadAction struct {
// Endorsements are not parsed for now
ProposalResponsePayload *ProposalResponsePayload `json:"proposal_response_payload"`
}
type ProposalResponsePayload struct {
Extension *Extension `json:"extension"`
ProposalHash string `json:"proposal_hash"`
}
type Extension struct {
ChaincodeID *peer.ChaincodeID `json:"chaincode_id"`
Events *ChaincodeEvent `json:"events"`
// Response
// Result
}
type ChaincodeEvent struct {
ChaincodeID string `json:"chaincodeId"`
TxID string `json:"transactionId"`
Timestamp string `json:"timestamp"`
EventName string `json:"eventName"`
Payload interface{} `json:"payload"`
}
type ChaincodeProposalPayload struct {
TransientMap *map[string][]byte `json:"TransientMap"`
Input *ProposalPayloadInput `json:"input"`
}
type ProposalPayloadInput struct {
ChaincodeSpec *ChaincodeSpec `json:"chaincode_spec"`
}
type ChaincodeSpec struct {
ChaincodeID *peer.ChaincodeID `json:"chaincode_id"`
Input *ChaincodeSpecInput `json:"input"`
Type string `json:"type"`
}
type ChaincodeSpecInput struct {
Args []interface{} `json:"args"`
IsInit bool `json:"is_init"`
}