github.com/inklabsfoundation/inkchain@v0.17.1-0.20181025012015-c3cef8062f19/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/inklabsfoundation/inkchain/protos/peer";
    20  option java_package = "org.inklabsfoundation.inkchain.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  	bytes block_hash = 3; // The hash of the BlockData, by MerkleTree
    58  
    59  	int64 fee = 4;
    60  }
    61  
    62  // The transaction to be sent to the ordering service. A transaction contains
    63  // one or more TransactionAction. Each TransactionAction binds a proposal to
    64  // potentially multiple actions. The transaction is atomic meaning that either
    65  // all actions in the transaction will be committed or none will.  Note that
    66  // while a Transaction might include more than one Header, the Header.creator
    67  // field must be the same in each.
    68  // A single client is free to issue a number of independent Proposal, each with
    69  // their header (Header) and request payload (ChaincodeProposalPayload).  Each
    70  // proposal is independently endorsed generating an action
    71  // (ProposalResponsePayload) with one signature per Endorser. Any number of
    72  // independent proposals (and their action) might be included in a transaction
    73  // to ensure that they are treated atomically.
    74  message Transaction {
    75  
    76  	// The payload is an array of TransactionAction. An array is necessary to
    77  	// accommodate multiple actions per transaction
    78  	repeated TransactionAction actions = 1;
    79  }
    80  
    81  // TransactionAction binds a proposal to its action.  The type field in the
    82  // header dictates the type of action to be applied to the ledger.
    83  message TransactionAction {
    84  
    85  	// The header of the proposal action, which is the proposal header
    86  	bytes header = 1;
    87  
    88  	// The payload of the action as defined by the type in the header For
    89  	// chaincode, it's the bytes of ChaincodeActionPayload
    90  	bytes payload = 2;
    91  }
    92  
    93  //---------- Chaincode Transaction ------------
    94  
    95  // ChaincodeActionPayload is the message to be used for the TransactionAction's
    96  // payload when the Header's type is set to CHAINCODE.  It carries the
    97  // chaincodeProposalPayload and an endorsed action to apply to the ledger.
    98  message ChaincodeActionPayload {
    99  
   100  	// This field contains the bytes of the ChaincodeProposalPayload message from
   101  	// the original invocation (essentially the arguments) after the application
   102  	// of the visibility function. The main visibility modes are "full" (the
   103  	// entire ChaincodeProposalPayload message is included here), "hash" (only
   104  	// the hash of the ChaincodeProposalPayload message is included) or
   105  	// "nothing".  This field will be used to check the consistency of
   106  	// ProposalResponsePayload.proposalHash.  For the CHAINCODE type,
   107  	// ProposalResponsePayload.proposalHash is supposed to be H(ProposalHeader ||
   108  	// f(ChaincodeProposalPayload)) where f is the visibility function.
   109  	bytes chaincode_proposal_payload = 1;
   110  
   111  	// The list of actions to apply to the ledger
   112  	ChaincodeEndorsedAction action = 2;
   113  }
   114  
   115  // ChaincodeEndorsedAction carries information about the endorsement of a
   116  // specific proposal
   117  message ChaincodeEndorsedAction {
   118  
   119  	// This is the bytes of the ProposalResponsePayload message signed by the
   120  	// endorsers.  Recall that for the CHAINCODE type, the
   121  	// ProposalResponsePayload's extenstion field carries a ChaincodeAction
   122  	bytes proposal_response_payload = 1;
   123  
   124  	// The endorsement of the proposal, basically the endorser's signature over
   125  	// proposalResponsePayload
   126  	repeated Endorsement endorsements = 2;
   127  }
   128  
   129  enum TxValidationCode {
   130  	VALID = 0;
   131  	NIL_ENVELOPE = 1;
   132  	BAD_PAYLOAD = 2;
   133  	BAD_COMMON_HEADER = 3;
   134  	BAD_CREATOR_SIGNATURE = 4;
   135  	INVALID_ENDORSER_TRANSACTION = 5;
   136  	INVALID_CONFIG_TRANSACTION = 6;
   137  	UNSUPPORTED_TX_PAYLOAD = 7;
   138  	BAD_PROPOSAL_TXID = 8;
   139  	DUPLICATE_TXID = 9;
   140  	ENDORSEMENT_POLICY_FAILURE = 10;
   141  	MVCC_READ_CONFLICT = 11;
   142  	PHANTOM_READ_CONFLICT = 12;
   143  	UNKNOWN_TX_TYPE = 13;
   144  	TARGET_CHAIN_NOT_FOUND = 14;
   145  	MARSHAL_TX_ERROR = 15;
   146  	NIL_TXACTION = 16;
   147  	EXPIRED_CHAINCODE = 17;
   148  	CHAINCODE_VERSION_CONFLICT = 18;
   149  	BAD_HEADER_EXTENSION = 19;
   150  	BAD_CHANNEL_HEADER = 20;
   151  	BAD_RESPONSE_PAYLOAD = 21;
   152  	BAD_RWSET = 22;
   153  	ILLEGAL_WRITESET = 23;
   154  	TRANSFER_CONFLICT = 100;
   155      BAD_COUNTER = 101;
   156      BAD_SIGNATURE = 102;
   157      BAD_BALANCE = 103;
   158  	EXCEED_BALANCE = 104;
   159  	INVALID_OTHER_REASON = 255;
   160  	BAD_TOKEN_TYPE = 355;
   161  	BAD_TOKEN_ADDR = 356;
   162  }