Skip to content

Commit 04dab62

Browse files
committed
Fabric Protobuf Messages v1
This change-set contains the protobuf messages for the next fabric architecture (v1) as decribed here: https://hyperledgerproject.slack.com/files/adc/F2JKXGXEU/protobufmessagesandflow.pdf and incoporates the feedback received from the community in a change-set previously. This change-set comes in the context of https://jira.hyperledger.org/browse/FAB-489. Change-Id: Ia602a14292696f6295fcd6b70cdafdae54d3606e Signed-off-by: Angelo De Caro <[email protected]>
1 parent db22cdc commit 04dab62

8 files changed

+411
-0
lines changed

protos/next/chaincode_proposal.proto

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
Copyright IBM Corp. 2016 All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
syntax = "proto3";
18+
19+
package protos;
20+
21+
message ChaincodeTransactionHeaderExtension {
22+
23+
bytes payloadVisibility = 1;
24+
25+
bytes chaincodeID = 2;
26+
}
27+
28+
message ChaincodeProposalPayload {
29+
ChaincodeProposalInputs inputs = 1;
30+
ChaincodeProposalSimulation simulation = 2;
31+
}
32+
33+
message ChaincodeProposalInputs {
34+
bytes Input = 1;
35+
36+
bytes Transient = 2;
37+
}
38+
39+
message ChaincodeProposalSimulation {
40+
bytes simulationResults = 1;
41+
42+
bytes events = 2;
43+
}
44+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Copyright IBM Corp. 2016 All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
syntax = "proto3";
18+
19+
package protos;
20+
21+
message ChaincodeProposalResponsePayload {
22+
23+
bytes simulationResults = 1;
24+
25+
bytes events = 2;
26+
}
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
Copyright IBM Corp. 2016 All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
syntax = "proto3";
18+
19+
package protos;
20+
21+
import "fabric_proposal_response.proto";
22+
23+
message ChaincodeActionsPayload {
24+
25+
// ChaincodeProposalPayload is present in the transaction
26+
// depending on the payloadVisibility field in the
27+
// ChaincodeTransactionHeaderExtension.
28+
// (it could be there in its entirety, it could be hashed or it
29+
// could be totally absent)
30+
bytes chaincodeProposalPayload = 1;
31+
32+
repeated ChaincodeEndorsedAction actions = 2;
33+
34+
}
35+
36+
message ChaincodeEndorsedAction {
37+
38+
ProposalResponsePayload responsePayload = 1;
39+
40+
repeated Endorsement endorsements = 2;
41+
42+
}

protos/next/fabric.proto

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
Copyright IBM Corp. 2016 All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
syntax = "proto3";
18+
19+
package protos;
20+
21+
22+
// A Message encapsulates a payload of the indicated type in this message.
23+
message Message {
24+
25+
enum Type {
26+
27+
// Undefined exists to prevent invalid message construction.
28+
UNDEFINED = 0;
29+
30+
// Handshake messages.
31+
DISCOVERY = 1;
32+
33+
// Sent to catch up with existing peers.
34+
SYNC = 2;
35+
}
36+
37+
// Type of this message.
38+
Type type = 1;
39+
40+
// Version indicates message protocol version.
41+
int32 version = 2;
42+
43+
// The payload in this message.
44+
bytes payload = 3;
45+
46+
}

protos/next/fabric_proposal.proto

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Copyright IBM Corp. 2016 All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
syntax = "proto3";
18+
19+
package protos;
20+
21+
import "fabric_transaction_header.proto";
22+
23+
// This structure is necessary to sign over the proposal which contains
24+
// the header and the payload. Without this structure, we would have to
25+
// concatenate the header and the payload to verify the signature, which
26+
// could be expensive with large payload
27+
message SignedProposal {
28+
// The bytes of Proposal
29+
// Allow ProposalResponse to easily hash over the bytes
30+
bytes proposalBytes = 1;
31+
32+
// Signaure over proposalBytes
33+
bytes signature = 2;
34+
}
35+
36+
// A Proposal is sent to an endorser for endorsement.
37+
// The proposal contains:
38+
// 1. A header which has fields common to all proposals and specifies
39+
// a type field for customization
40+
// 2. A payload whose type depends on the header's type field.
41+
message Proposal {
42+
43+
// The header of the proposal
44+
TransactionHeader header = 1;
45+
46+
// The payload of the proposal as defined by the type in the proposal
47+
// header. For chaincode, it's bytes of ChaincodeProposalPayload
48+
bytes payload = 2;
49+
}
+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
Copyright IBM Corp. 2016 All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
syntax = "proto3";
18+
19+
package protos;
20+
21+
import "google/protobuf/timestamp.proto";
22+
23+
// A ProposalResponse is returned from an endorser to the proposal submitter
24+
message ProposalResponse {
25+
// Version indicates message protocol version
26+
int32 version = 1;
27+
28+
// Timestamp is the time that the message
29+
// was created as defined by the sender
30+
google.protobuf.Timestamp timestamp = 2;
31+
32+
// A response message indicating whether the
33+
// endorsement of the action was successful
34+
Response response = 4;
35+
36+
// The payload of response, which is the bytes of ProposalResponsePayload
37+
bytes payload = 5;
38+
39+
// The endorsement of the proposal
40+
Endorsement endorsement = 6;
41+
}
42+
43+
// A response with a representation similar to an HTTP response that can
44+
// be used within another message.
45+
message Response {
46+
47+
// A status code that should follow the HTTP status codes.
48+
int32 status = 1;
49+
50+
// A message associated with the response code.
51+
string message = 2;
52+
53+
// A payload that can be used to include metadata with this response.
54+
bytes payload = 3;
55+
56+
}
57+
58+
// ProposalResponsePayload is the payload of ProposalResponse.
59+
// It links the proposal and add support for replay-attack protection.
60+
// It can include also type-dependant fields by using the
61+
// 'extensions' field. The type here refers to type specified in the proposal
62+
// header.
63+
message ProposalResponsePayload {
64+
// Hash of the proposal that the endorser acts on
65+
bytes proposalHash = 1;
66+
67+
// Epoch in which the response has been generated
68+
bytes epoch = 2;
69+
70+
// Extension depends on type in proposal indexed by proposalHash.
71+
// For chaincode, it's bytes of ChaincodeProposalResponsePayload
72+
bytes extension = 3;
73+
74+
}
75+
76+
// Endorsement represents the will of an endorse to endorse a proposal.
77+
message Endorsement {
78+
// Identifier of the endorser (eg ecert)
79+
bytes endorser = 1;
80+
81+
// Signature of the payload included in ProposalResponse concatenate with
82+
// the endorser's certificate; ie, sign(ProposalResponse.payload + endorser)
83+
bytes signature = 2;
84+
}

protos/next/fabric_transaction.proto

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
Copyright IBM Corp. 2016 All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
syntax = "proto3";
18+
19+
package protos;
20+
21+
import "google/protobuf/timestamp.proto";
22+
import "fabric_transaction_header.proto";
23+
24+
message SignedTransaction {
25+
26+
// The bytes of the Transaction. NDD
27+
bytes transactionBytes = 1;
28+
29+
// Signature of the transactionBytes
30+
// The public key of the signature is in the header field of TransactionActions
31+
// There might be multiple TransactionActions, so multiple headers,
32+
// but there should be same transactor identity (cert) in all headers
33+
bytes signature = 2;
34+
}
35+
36+
// The transaction to be sent to the ordering service. A transaction contains
37+
// one or more TransactionActions. Each TransactionActions binds a proposal
38+
// to potentially multiple actions.
39+
// The transaction is atomic meaning that either
40+
// all actions in the transaction will be committed or none will be committed.
41+
message Transaction {
42+
// Version indicates message protocol version.
43+
int32 version = 1;
44+
45+
// Timestamp is the local time that the
46+
// message was created by the sender
47+
google.protobuf.Timestamp timestamp = 2;
48+
49+
// The payload is an array of TransactionActions. An array is neccessary
50+
// accommodate multiple proposals per transaction
51+
repeated TransactionActions TransactionActions = 3;
52+
}
53+
54+
// TransactionActions binds a proposal to one of more actions.
55+
// The type field in the header dictecates the type actions
56+
// to be applied to the ledger.
57+
message TransactionActions {
58+
59+
// The header of the proposal action, which is the proposal header
60+
TransactionHeader header = 1;
61+
62+
// The payload of the action as defined by the type in the header
63+
// For chaincode, it's the bytes of ChaincodeActionsPayload
64+
bytes payload = 2;
65+
}

0 commit comments

Comments
 (0)