bric-java-sdk.fabric-java-sdk.1.0.source-code.chaincode.proto Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fabric-java-sdk Show documentation
Show all versions of fabric-java-sdk Show documentation
This is a fork of Hyperledger Fabric fabric-sdk-java
/*
Copyright IBM Corp. 2016 All Rights Reserved.
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.
*/
syntax = "proto3";
package protos;
option java_package = "org.hyperledger.protos";
import "chaincodeevent.proto";
import "google/protobuf/timestamp.proto";
// Confidentiality Levels
enum ConfidentialityLevel {
PUBLIC = 0;
CONFIDENTIAL = 1;
}
//ChaincodeID contains the path as specified by the deploy transaction
//that created it as well as the hashCode that is generated by the
//system for the path. From the user level (ie, CLI, REST API and so on)
//deploy transaction is expected to provide the path and other requests
//are expected to provide the hashCode. The other value will be ignored.
//Internally, the structure could contain both values. For instance, the
//hashCode will be set when first generated using the path
message ChaincodeID {
//deploy transaction will use the path
string path = 1;
//all other requests will use the name (really a hashcode) generated by
//the deploy transaction
string name = 2;
}
// Carries the chaincode function and its arguments.
// UnmarshalJSON in transaction.go converts the string-based REST/JSON input to
// the []byte-based current ChaincodeInput structure.
message ChaincodeInput {
repeated bytes args = 1;
}
// Carries the chaincode specification. This is the actual metadata required for
// defining a chaincode.
message ChaincodeSpec {
enum Type {
UNDEFINED = 0;
GOLANG = 1;
NODE = 2;
CAR = 3;
JAVA = 4;
}
Type type = 1;
ChaincodeID chaincodeID = 2;
ChaincodeInput ctorMsg = 3;
int32 timeout = 4;
string secureContext = 5;
ConfidentialityLevel confidentialityLevel = 6;
bytes metadata = 7;
repeated string attributes = 8;
}
// Specify the deployment of a chaincode.
// TODO: Define `codePackage`.
message ChaincodeDeploymentSpec {
enum ExecutionEnvironment {
DOCKER = 0;
SYSTEM = 1;
}
ChaincodeSpec chaincodeSpec = 1;
// Controls when the chaincode becomes executable.
google.protobuf.Timestamp effectiveDate = 2;
bytes codePackage = 3;
ExecutionEnvironment execEnv= 4;
}
// Carries the chaincode function and its arguments.
message ChaincodeInvocationSpec {
ChaincodeSpec chaincodeSpec = 1;
// This field can contain a user-specified ID generation algorithm
// If supplied, this will be used to generate a ID
// If not supplied (left empty), sha256base64 will be used
// The algorithm consists of two parts:
// 1, a hash function
// 2, a decoding used to decode user (string) input to bytes
// Currently, SHA256 with BASE64 is supported (e.g. idGenerationAlg='sha256base64')
string idGenerationAlg = 2;
}
// This structure contain transaction data that we send to the chaincode
// container shim and allow the chaincode to access through the shim interface.
// TODO: Consider remove this message and just pass the transaction object
// to the shim and/or allow the chaincode to query transactions.
message ChaincodeSecurityContext {
bytes callerCert = 1;
bytes callerSign = 2;
bytes payload = 3;
bytes binding = 4;
bytes metadata = 5;
bytes parentMetadata = 6;
google.protobuf.Timestamp txTimestamp = 7; // transaction timestamp
}
message ChaincodeMessage {
enum Type {
UNDEFINED = 0;
REGISTER = 1;
REGISTERED = 2;
INIT = 3;
READY = 4;
TRANSACTION = 5;
COMPLETED = 6;
ERROR = 7;
GET_STATE = 8;
PUT_STATE = 9;
DEL_STATE = 10;
INVOKE_CHAINCODE = 11;
INVOKE_QUERY = 12;
RESPONSE = 13;
QUERY = 14;
QUERY_COMPLETED = 15;
QUERY_ERROR = 16;
RANGE_QUERY_STATE = 17;
RANGE_QUERY_STATE_NEXT = 18;
RANGE_QUERY_STATE_CLOSE = 19;
KEEPALIVE = 20;
}
Type type = 1;
google.protobuf.Timestamp timestamp = 2;
bytes payload = 3;
string txid = 4;
ChaincodeSecurityContext securityContext = 5;
//event emmited by chaincode. Used only with Init or Invoke.
// This event is then stored (currently)
//with Block.NonHashData.TransactionResult
ChaincodeEvent chaincodeEvent = 6;
}
message PutStateInfo {
string key = 1;
bytes value = 2;
}
message RangeQueryState {
string startKey = 1;
string endKey = 2;
}
message RangeQueryStateNext {
string ID = 1;
}
message RangeQueryStateClose {
string ID = 1;
}
message RangeQueryStateKeyValue {
string key = 1;
bytes value = 2;
}
message RangeQueryStateResponse {
repeated RangeQueryStateKeyValue keysAndValues = 1;
bool hasMore = 2;
string ID = 3;
}
// Interface that provides support to chaincode execution. ChaincodeContext
// provides the context necessary for the server to respond appropriately.
service ChaincodeSupport {
rpc Register(stream ChaincodeMessage) returns (stream ChaincodeMessage) {}
}