github.com/tenywen/fabric@v1.0.0-beta.0.20170620030522-a5b1ed380643/protos/peer/transaction.proto (about)

     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  option go_package = "github.com/hyperledger/fabric/protos/peer";
    20  option java_package = "org.hyperledger.fabric.protos.peer";
    21  option java_outer_classname = "TransactionPackage";
    22  
    23  package protos;
    24  
    25  import "google/protobuf/timestamp.proto";
    26  import "peer/proposal_response.proto";
    27  import "common/common.proto";
    28  
    29  // This message is necessary to facilitate the verification of the signature
    30  // (in the signature field) over the bytes of the transaction (in the
    31  // transactionBytes field).
    32  message SignedTransaction {
    33  
    34  	// The bytes of the Transaction. NDD
    35  	bytes transaction_bytes = 1;
    36  
    37  	// Signature of the transactionBytes The public key of the signature is in
    38  	// the header field of TransactionAction There might be multiple
    39  	// TransactionAction, so multiple headers, but there should be same
    40  	// transactor identity (cert) in all headers
    41  	bytes signature = 2;
    42  }
    43  
    44  // ProcessedTransaction wraps an Envelope that includes a transaction along with an indication
    45  // of whether the transaction was validated or invalidated by committing peer.
    46  // The use case is that GetTransactionByID API needs to retrieve the transaction Envelope
    47  // from block storage, and return it to a client, and indicate whether the transaction
    48  // was validated or invalidated by committing peer. So that the originally submitted
    49  // transaction Envelope is not modified, the ProcessedTransaction wrapper is returned.
    50  message ProcessedTransaction {
    51      // An Envelope which includes a processed transaction
    52      common.Envelope transactionEnvelope = 1;
    53  
    54      // An indication of whether the transaction was validated or invalidated by committing peer
    55      int32 validationCode = 2;
    56  }
    57  
    58  // The transaction to be sent to the ordering service. A transaction contains
    59  // one or more TransactionAction. Each TransactionAction binds a proposal to
    60  // potentially multiple actions. The transaction is atomic meaning that either
    61  // all actions in the transaction will be committed or none will.  Note that
    62  // while a Transaction might include more than one Header, the Header.creator
    63  // field must be the same in each.
    64  // A single client is free to issue a number of independent Proposal, each with
    65  // their header (Header) and request payload (ChaincodeProposalPayload).  Each
    66  // proposal is independently endorsed generating an action
    67  // (ProposalResponsePayload) with one signature per Endorser. Any number of
    68  // independent proposals (and their action) might be included in a transaction
    69  // to ensure that they are treated atomically.
    70  message Transaction {
    71  
    72  	// The payload is an array of TransactionAction. An array is necessary to
    73  	// accommodate multiple actions per transaction
    74  	repeated TransactionAction actions = 1;
    75  }
    76  
    77  // TransactionAction binds a proposal to its action.  The type field in the
    78  // header dictates the type of action to be applied to the ledger.
    79  message TransactionAction {
    80  
    81  	// The header of the proposal action, which is the proposal header
    82  	bytes header = 1;
    83  
    84  	// The payload of the action as defined by the type in the header For
    85  	// chaincode, it's the bytes of ChaincodeActionPayload
    86  	bytes payload = 2;
    87  }
    88  
    89  //---------- Chaincode Transaction ------------
    90  
    91  // ChaincodeActionPayload is the message to be used for the TransactionAction's
    92  // payload when the Header's type is set to CHAINCODE.  It carries the
    93  // chaincodeProposalPayload and an endorsed action to apply to the ledger.
    94  message ChaincodeActionPayload {
    95  
    96  	// This field contains the bytes of the ChaincodeProposalPayload message from
    97  	// the original invocation (essentially the arguments) after the application
    98  	// of the visibility function. The main visibility modes are "full" (the
    99  	// entire ChaincodeProposalPayload message is included here), "hash" (only
   100  	// the hash of the ChaincodeProposalPayload message is included) or
   101  	// "nothing".  This field will be used to check the consistency of
   102  	// ProposalResponsePayload.proposalHash.  For the CHAINCODE type,
   103  	// ProposalResponsePayload.proposalHash is supposed to be H(ProposalHeader ||
   104  	// f(ChaincodeProposalPayload)) where f is the visibility function.
   105  	bytes chaincode_proposal_payload = 1;
   106  
   107  	// The list of actions to apply to the ledger
   108  	ChaincodeEndorsedAction action = 2;
   109  }
   110  
   111  // ChaincodeEndorsedAction carries information about the endorsement of a
   112  // specific proposal
   113  message ChaincodeEndorsedAction {
   114  
   115  	// This is the bytes of the ProposalResponsePayload message signed by the
   116  	// endorsers.  Recall that for the CHAINCODE type, the
   117  	// ProposalResponsePayload's extenstion field carries a ChaincodeAction
   118  	bytes proposal_response_payload = 1;
   119  
   120  	// The endorsement of the proposal, basically the endorser's signature over
   121  	// proposalResponsePayload
   122  	repeated Endorsement endorsements = 2;
   123  }
   124  
   125  enum TxValidationCode {
   126  	VALID = 0;
   127  	NIL_ENVELOPE = 1;
   128  	BAD_PAYLOAD = 2;
   129  	BAD_COMMON_HEADER = 3;
   130  	BAD_CREATOR_SIGNATURE = 4;
   131  	INVALID_ENDORSER_TRANSACTION = 5;
   132  	INVALID_CONFIG_TRANSACTION = 6;
   133  	UNSUPPORTED_TX_PAYLOAD = 7;
   134  	BAD_PROPOSAL_TXID = 8;
   135  	DUPLICATE_TXID = 9;
   136  	ENDORSEMENT_POLICY_FAILURE = 10;
   137  	MVCC_READ_CONFLICT = 11;
   138  	PHANTOM_READ_CONFLICT = 12;
   139  	UNKNOWN_TX_TYPE = 13;
   140  	TARGET_CHAIN_NOT_FOUND = 14;
   141  	MARSHAL_TX_ERROR = 15;
   142  	NIL_TXACTION = 16;
   143  	EXPIRED_CHAINCODE = 17;
   144  	CHAINCODE_VERSION_CONFLICT = 18;
   145  	BAD_HEADER_EXTENSION = 19;
   146  	BAD_CHANNEL_HEADER = 20;
   147  	BAD_RESPONSE_PAYLOAD = 21;
   148  	BAD_RWSET = 22;
   149  	ILLEGAL_WRITESET = 23;
   150  	INVALID_OTHER_REASON = 255;
   151  }