Hyperledger Sawtooth

hyperledger/sawtooth-core

TOC

學習資源

The Linux Foundation 開在 edX 的免費 Hyperledger Sawtooth 開發課程。

Hyperledger Sawtooth for Application Developers

生成 Google Protocol Buffers 文件

pseudomuto/protoc-gen-doc: Documentation generator plugin for Google Protocol Buffers

git clone https://github.com/hyperledger/sawtooth-core.git /tmp/src/sawtooth
bash tc.sh --gen-proto-doc /tmp/src/sawtooth/protos /tmp/output.md

Generated Date:2019-09-11T16:57:31+08:00

Protocol Documentation

Table of Contents

Top

transaction.proto

Transaction

FieldTypeLabelDescription
headerbytesThe serialized version of the TransactionHeader
header_signaturestringThe signature derived from signing the header
payloadbytesThe payload is the encoded family specific information of the transaction. Example cbor({'Verb': verb, 'Name': name,'Value': value})

TransactionHeader

FieldTypeLabelDescription
batcher_public_keystringPublic key for the client who added this transaction to a batch
dependenciesstringrepeatedA list of transaction signatures that describe the transactions that must be processed before this transaction can be valid
family_namestringThe family name correlates to the transaction processor's family name that this transaction can be processed on, for example 'intkey'
family_versionstringThe family version correlates to the transaction processor's family version that this transaction can be processed on, for example "1.0"
inputsstringrepeatedA list of addresses that are given to the context manager and control what addresses the transaction processor is allowed to read from.
noncestringA random string that provides uniqueness for transactions with otherwise identical fields.
outputsstringrepeatedA list of addresses that are given to the context manager and control what addresses the transaction processor is allowed to write to.
payload_sha512stringThe sha512 hash of the encoded payload
signer_public_keystringPublic key for the client that signed the TransactionHeader

TransactionList

A simple list of transactions that needs to be serialized before it can be transmitted to a batcher.

FieldTypeLabelDescription
transactionsTransactionrepeated

Top

client_status.proto

ClientStatusGetRequest

A request to get miscellaneous information about the validator

ClientStatusGetResponse

FieldTypeLabelDescription
statusClientStatusGetResponse.Status
peersClientStatusGetResponse.Peerrepeated
endpointstringThe validator's public network endpoint

ClientStatusGetResponse.Peer

Information about the validator's peers

FieldTypeLabelDescription
endpointstringThe peer's public network endpoint

ClientStatusGetResponse.Status

The status of the response message, not the validator's status

NameNumberDescription
STATUS_UNSET0
OK1
ERROR2

Top

validator.proto

Message

The message passed between the validator and client, containing the header fields and content.

FieldTypeLabelDescription
message_typeMessage.MessageTypeThe type of message, used to determine how to 'route' the message to the appropriate handler as well as how to deserialize the content.
correlation_idstringThe identifier used to correlate response messages to their related request messages. correlation_id should be set to a random string for messages which are not responses to previously sent messages. For response messages, correlation_id should be set to the same string as contained in the request message.
contentbytesThe content of the message, defined by message_type. In many cases, this data has been serialized with Protocol Buffers or CBOR.

MessageList

A list of messages to be transmitted together.

FieldTypeLabelDescription
messagesMessagerepeated

Message.MessageType

NameNumberDescription
DEFAULT0
TP_REGISTER_REQUEST1Registration request from the transaction processor to the validator
TP_REGISTER_RESPONSE2Registration response from the validator to the transaction processor
TP_UNREGISTER_REQUEST3Tell the validator that the transaction processor won't take any more transactions
TP_UNREGISTER_RESPONSE4Response from the validator to the tp that it won't send any more transactions
TP_PROCESS_REQUEST5Process Request from the validator/executor to the transaction processor
TP_PROCESS_RESPONSE6Process response from the transaction processor to the validator/executor
TP_STATE_GET_REQUEST7State get request from the transaction processor to validator/context_manager
TP_STATE_GET_RESPONSE8State get response from the validator/context_manager to the transaction processor
TP_STATE_SET_REQUEST9State set request from the transaction processor to the validator/context_manager
TP_STATE_SET_RESPONSE10State set response from the validator/context_manager to the transaction processor
TP_STATE_DELETE_REQUEST11State delete request from the transaction processor to the validator/context_manager
TP_STATE_DELETE_RESPONSE12State delete response from the validator/context_manager to the transaction processor
TP_RECEIPT_ADD_DATA_REQUEST13Message to append data to a transaction receipt
TP_RECEIPT_ADD_DATA_RESPONSE14Response from validator to tell transaction processor that data has been appended
TP_EVENT_ADD_REQUEST15Message to add event
TP_EVENT_ADD_RESPONSE16Response from validator to tell transaction processor that event has been created
CLIENT_BATCH_SUBMIT_REQUEST100Submission of a batchlist from the web api or another client to the validator
CLIENT_BATCH_SUBMIT_RESPONSE101Response from the validator to the web api/client that the submission was accepted
CLIENT_BLOCK_LIST_REQUEST102A request to list blocks from the web api/client to the validator
CLIENT_BLOCK_LIST_RESPONSE103
CLIENT_BLOCK_GET_BY_ID_REQUEST104
CLIENT_BLOCK_GET_RESPONSE105
CLIENT_BATCH_LIST_REQUEST106
CLIENT_BATCH_LIST_RESPONSE107
CLIENT_BATCH_GET_REQUEST108
CLIENT_BATCH_GET_RESPONSE109
CLIENT_TRANSACTION_LIST_REQUEST110
CLIENT_TRANSACTION_LIST_RESPONSE111
CLIENT_TRANSACTION_GET_REQUEST112
CLIENT_TRANSACTION_GET_RESPONSE113
CLIENT_STATE_CURRENT_REQUEST114Client state request of the current state hash to be retrieved from the journal
CLIENT_STATE_CURRENT_RESPONSE115Response with the current state hash
CLIENT_STATE_LIST_REQUEST116A request of all the addresses under a particular prefix, for a state hash.
CLIENT_STATE_LIST_RESPONSE117The response of the addresses
CLIENT_STATE_GET_REQUEST118Get the address:data entry at a particular address
CLIENT_STATE_GET_RESPONSE119The response with the entry
CLIENT_BATCH_STATUS_REQUEST120A request for the status of a batch or batches
CLIENT_BATCH_STATUS_RESPONSE121A response with the batch statuses
CLIENT_RECEIPT_GET_REQUEST122A request for one or more transaction receipts
CLIENT_RECEIPT_GET_RESPONSE123A response with the receipts
CLIENT_BLOCK_GET_BY_NUM_REQUEST124
CLIENT_PEERS_GET_REQUEST125A request for a validator's peers
CLIENT_PEERS_GET_RESPONSE126A response with the validator's peers
CLIENT_BLOCK_GET_BY_TRANSACTION_ID_REQUEST127
CLIENT_BLOCK_GET_BY_BATCH_ID_REQUEST128
CLIENT_STATUS_GET_REQUEST129A request for a validator's status
CLIENT_STATUS_GET_RESPONSE130A response with the validator's status
CLIENT_EVENTS_SUBSCRIBE_REQUEST500Message types for events
CLIENT_EVENTS_SUBSCRIBE_RESPONSE501
CLIENT_EVENTS_UNSUBSCRIBE_REQUEST502
CLIENT_EVENTS_UNSUBSCRIBE_RESPONSE503
CLIENT_EVENTS504
CLIENT_EVENTS_GET_REQUEST505
CLIENT_EVENTS_GET_RESPONSE506
GOSSIP_MESSAGE200Temp message types until a discussion can be had about gossip msg
GOSSIP_REGISTER201
GOSSIP_UNREGISTER202
GOSSIP_BLOCK_REQUEST205
GOSSIP_BLOCK_RESPONSE206
GOSSIP_BATCH_BY_BATCH_ID_REQUEST207
GOSSIP_BATCH_BY_TRANSACTION_ID_REQUEST208
GOSSIP_BATCH_RESPONSE209
GOSSIP_GET_PEERS_REQUEST210
GOSSIP_GET_PEERS_RESPONSE211
GOSSIP_CONSENSUS_MESSAGE212
NETWORK_ACK300
NETWORK_CONNECT301
NETWORK_DISCONNECT302
AUTHORIZATION_CONNECTION_RESPONSE600Message types for Authorization Types
AUTHORIZATION_VIOLATION601
AUTHORIZATION_TRUST_REQUEST602
AUTHORIZATION_TRUST_RESPONSE603
AUTHORIZATION_CHALLENGE_REQUEST604
AUTHORIZATION_CHALLENGE_RESPONSE605
AUTHORIZATION_CHALLENGE_SUBMIT606
AUTHORIZATION_CHALLENGE_RESULT607
PING_REQUEST700
PING_RESPONSE701
CONSENSUS_REGISTER_REQUEST800Consensus service messages
CONSENSUS_REGISTER_RESPONSE801
CONSENSUS_SEND_TO_REQUEST802
CONSENSUS_SEND_TO_RESPONSE803
CONSENSUS_BROADCAST_REQUEST804
CONSENSUS_BROADCAST_RESPONSE805
CONSENSUS_INITIALIZE_BLOCK_REQUEST806
CONSENSUS_INITIALIZE_BLOCK_RESPONSE807
CONSENSUS_FINALIZE_BLOCK_REQUEST808
CONSENSUS_FINALIZE_BLOCK_RESPONSE809
CONSENSUS_SUMMARIZE_BLOCK_REQUEST828
CONSENSUS_SUMMARIZE_BLOCK_RESPONSE829
CONSENSUS_CANCEL_BLOCK_REQUEST810
CONSENSUS_CANCEL_BLOCK_RESPONSE811
CONSENSUS_CHECK_BLOCKS_REQUEST812
CONSENSUS_CHECK_BLOCKS_RESPONSE813
CONSENSUS_COMMIT_BLOCK_REQUEST814
CONSENSUS_COMMIT_BLOCK_RESPONSE815
CONSENSUS_IGNORE_BLOCK_REQUEST816
CONSENSUS_IGNORE_BLOCK_RESPONSE817
CONSENSUS_FAIL_BLOCK_REQUEST818
CONSENSUS_FAIL_BLOCK_RESPONSE819
CONSENSUS_SETTINGS_GET_REQUEST820
CONSENSUS_SETTINGS_GET_RESPONSE821
CONSENSUS_STATE_GET_REQUEST822
CONSENSUS_STATE_GET_RESPONSE823
CONSENSUS_BLOCKS_GET_REQUEST824
CONSENSUS_BLOCKS_GET_RESPONSE825
CONSENSUS_CHAIN_HEAD_GET_REQUEST826
CONSENSUS_CHAIN_HEAD_GET_RESPONSE827
CONSENSUS_NOTIFY_PEER_CONNECTED900Consensus notification messages
CONSENSUS_NOTIFY_PEER_DISCONNECTED901
CONSENSUS_NOTIFY_PEER_MESSAGE902
CONSENSUS_NOTIFY_BLOCK_NEW903
CONSENSUS_NOTIFY_BLOCK_VALID904
CONSENSUS_NOTIFY_BLOCK_INVALID905
CONSENSUS_NOTIFY_BLOCK_COMMIT906
CONSENSUS_NOTIFY_ENGINE_ACTIVATED907
CONSENSUS_NOTIFY_ENGINE_DEACTIVATED908
CONSENSUS_NOTIFY_ACK999

Top

consensus.proto

ConsensusBlock

All information about a block that is relevant to consensus

FieldTypeLabelDescription
block_idbytes
previous_idbytes
signer_idbytesThe id of peer that signed this block
block_numuint64
payloadbytes
summarybytesA summary of the contents of the block

ConsensusBlocksGetRequest

Retrieve consensus-related information about blocks. If some blocks could not be found, only the blocks that could be found will be returned.

FieldTypeLabelDescription
block_idsbytesrepeated

ConsensusBlocksGetResponse

FieldTypeLabelDescription
statusConsensusBlocksGetResponse.Status
blocksConsensusBlockrepeated

ConsensusBroadcastRequest

Broadcast a consensus message to all peers

FieldTypeLabelDescription
contentbytesPayload to broadcast peers

NOTE: This payload will be wrapped up in a ConsensusPeerMessage struct, which includes computing its SHA-512 digest, inserting this engine's registration info, and the validator's public key, and signing everything with the validator's private key. | | message_type | string | | |

ConsensusBroadcastResponse

FieldTypeLabelDescription
statusConsensusBroadcastResponse.Status

ConsensusCancelBlockRequest

Stop adding batches to the current block and abandon it.

ConsensusCancelBlockResponse

FieldTypeLabelDescription
statusConsensusCancelBlockResponse.Status

ConsensusChainHeadGetRequest

Retrieve consensus-related information about the chain head.

ConsensusChainHeadGetResponse

FieldTypeLabelDescription
statusConsensusChainHeadGetResponse.Status
blockConsensusBlock

ConsensusCheckBlocksRequest

Request that, for each block block in order, the block is checked to determine whether the block can be committed successfully or not. Blocks may be checked in parallel. If a new request arrives, it overrides the previous request allowing the engine to reprioritize the list of blocks to check.

NOTE: OK does not mean the blocks will all commit successfully, only that the directive was received successfully. The engine must listen for notifications from the consuming component to learn if the blocks would commit or not.

FieldTypeLabelDescription
block_idsbytesrepeated

ConsensusCheckBlocksResponse

FieldTypeLabelDescription
statusConsensusCheckBlocksResponse.Status

ConsensusCommitBlockRequest

Request that the block be committed. This request fails if the block has not already been checked.

NOTE: OK does not mean the block has been committed, only that the directive was received successfully. The engine must listen for notifications from the consuming component to learn when the block commits.

FieldTypeLabelDescription
block_idbytes

ConsensusCommitBlockResponse

FieldTypeLabelDescription
statusConsensusCommitBlockResponse.Status

ConsensusFailBlockRequest

Fail this block and any of its descendants and purge them as needed.

FieldTypeLabelDescription
block_idbytes

ConsensusFailBlockResponse

FieldTypeLabelDescription
statusConsensusFailBlockResponse.Status

ConsensusFinalizeBlockRequest

Insert the given consensus data into the block and sign it. If this call is successful, the consensus engine will receive the block afterwards.

FieldTypeLabelDescription
databytesThe consensus data to include in the finalized block

ConsensusFinalizeBlockResponse

FieldTypeLabelDescription
statusConsensusFinalizeBlockResponse.Status
block_idbytesThe block id of the newly created block

ConsensusIgnoreBlockRequest

Inform the consuming component that this block is no longer being considered and can be held or freed as needed.

FieldTypeLabelDescription
block_idbytes

ConsensusIgnoreBlockResponse

FieldTypeLabelDescription
statusConsensusIgnoreBlockResponse.Status

ConsensusInitializeBlockRequest

Initialize a new block built on the block with the given previous id and begin adding batches to it. If no previous id is specified, the current head will be used.

FieldTypeLabelDescription
previous_idbytes

ConsensusInitializeBlockResponse

FieldTypeLabelDescription
statusConsensusInitializeBlockResponse.Status

ConsensusNotifyAck

Confirm that the notification was received. The validator message correlation id is used to determine which notification this is an ack for.

ConsensusNotifyBlockCommit

This block has been committed

FieldTypeLabelDescription
block_idbytes

ConsensusNotifyBlockInvalid

This block cannot be committed successfully

FieldTypeLabelDescription
block_idbytes

ConsensusNotifyBlockNew

A new block was received and passed initial consensus validation

FieldTypeLabelDescription
blockConsensusBlock

ConsensusNotifyBlockValid

This block can be committed successfully

FieldTypeLabelDescription
block_idbytes

ConsensusNotifyEngineActivated

The engine has been activated

FieldTypeLabelDescription
chain_headConsensusBlockStartup Info
peersConsensusPeerInforepeated
local_peer_infoConsensusPeerInfo

ConsensusNotifyEngineDeactivated

The engine has been deactivated

ConsensusNotifyPeerConnected

A new peer was added

FieldTypeLabelDescription
peer_infoConsensusPeerInfo

ConsensusNotifyPeerDisconnected

An existing peer was dropped

FieldTypeLabelDescription
peer_idbytes

ConsensusNotifyPeerMessage

A new message was received from a peer

FieldTypeLabelDescription
messageConsensusPeerMessageThe message sent
sender_idbytesThe node that sent the message, not necessarily the node that created it

ConsensusPeerInfo

Information about a peer that is relevant to consensus

FieldTypeLabelDescription
peer_idbytesThe unique id for this peer. This can be correlated with the signer id on consensus blocks.

ConsensusPeerMessage

A consensus-related message sent between peers

FieldTypeLabelDescription
headerbytesThe serialized version of the ConsensusPeerMessageHeader
header_signaturebytesThe signature derived from signing the header
contentbytesThe opaque payload to send to other nodes

ConsensusPeerMessageHeader

FieldTypeLabelDescription
signer_idbytesPublic key for the component internal to the validator that signed the message
content_sha512bytesThe sha512 hash of the encoded message
message_typestringInterpretation is left to the consensus engine implementation
namestringUsed to identify the consensus engine that produced this message
versionstring

ConsensusRegisterRequest

Sent to connect with the validator

FieldTypeLabelDescription
namestringThe name of this consensus engine
versionstringThe version of this consensus engine
additional_protocolsConsensusRegisterRequest.ProtocolrepeatedAny additional name/version pairs the consensus engine supports

ConsensusRegisterRequest.Protocol

FieldTypeLabelDescription
namestring
versionstring

ConsensusRegisterResponse

FieldTypeLabelDescription
statusConsensusRegisterResponse.Status
chain_headConsensusBlockStartup Info
peersConsensusPeerInforepeated
local_peer_infoConsensusPeerInfo

ConsensusSendToRequest

Send a consensus message to a specific, connected peer

FieldTypeLabelDescription
contentbytesPayload to send to peer

NOTE: This payload will be wrapped up in a ConsensusPeerMessage struct, which includes computing its SHA-512 digest, inserting this engine's registration info, and the validator's public key, and signing everything with the validator's private key. | | message_type | string | | | | receiver_id | bytes | | Peer that this message is destined for |

ConsensusSendToResponse

FieldTypeLabelDescription
statusConsensusSendToResponse.Status

ConsensusSettingsEntry

A settings key-value pair

FieldTypeLabelDescription
keystring
valuestring

ConsensusSettingsGetRequest

Read the values of these settings from state as of the given block. If some values settings keys cannot be found, the keys that were found will be returned.

FieldTypeLabelDescription
block_idbytes
keysstringrepeated

ConsensusSettingsGetResponse

FieldTypeLabelDescription
statusConsensusSettingsGetResponse.Status
entriesConsensusSettingsEntryrepeated

ConsensusStateEntry

A state key-value pair

FieldTypeLabelDescription
addressstring
databytes

ConsensusStateGetRequest

Read the data at these addresses from state as of the given block. If some addresses cannot be found, state at the addresses that were found will be returned.

FieldTypeLabelDescription
block_idbytes
addressesstringrepeated

ConsensusStateGetResponse

FieldTypeLabelDescription
statusConsensusStateGetResponse.Status
entriesConsensusStateEntryrepeated

ConsensusSummarizeBlockRequest

Stop adding batches to the current block and return a summary of its contents.

ConsensusSummarizeBlockResponse

FieldTypeLabelDescription
statusConsensusSummarizeBlockResponse.Status
summarybytesA summary of the block contents

ConsensusBlocksGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
UNKNOWN_BLOCK5
NOT_ACTIVE_ENGINE6

ConsensusBroadcastResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
NOT_ACTIVE_ENGINE5

ConsensusCancelBlockResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
INVALID_STATE5
NOT_ACTIVE_ENGINE6

ConsensusChainHeadGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
NO_CHAIN_HEAD5
NOT_ACTIVE_ENGINE6

ConsensusCheckBlocksResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
UNKNOWN_BLOCK5
NOT_ACTIVE_ENGINE6

ConsensusCommitBlockResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
UNKNOWN_BLOCK5
NOT_ACTIVE_ENGINE6

ConsensusFailBlockResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
UNKNOWN_BLOCK5
NOT_ACTIVE_ENGINE6

ConsensusFinalizeBlockResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
INVALID_STATE5
BLOCK_NOT_READY6
NOT_ACTIVE_ENGINE7

ConsensusIgnoreBlockResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
UNKNOWN_BLOCK5
NOT_ACTIVE_ENGINE6

ConsensusInitializeBlockResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
INVALID_STATE5
UNKNOWN_BLOCK6
NOT_ACTIVE_ENGINE7

ConsensusRegisterResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4

ConsensusSendToResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
UNKNOWN_PEER5
NOT_ACTIVE_ENGINE6

ConsensusSettingsGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
UNKNOWN_BLOCK5
NOT_ACTIVE_ENGINE6

ConsensusStateGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
UNKNOWN_BLOCK5
NOT_ACTIVE_ENGINE6

ConsensusSummarizeBlockResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
BAD_REQUEST2
SERVICE_ERROR3
NOT_READY4
INVALID_STATE5
BLOCK_NOT_READY6
NOT_ACTIVE_ENGINE7

Top

client_batch_submit.proto

ClientBatchStatus

Information about the status of a batch submitted to the validator.

Attributes: batch_id: The id (header_signature) of the batch status: The committed status of the batch invalid_transactions: Info for transactions that failed, if any

Statuses: COMMITTED - the batch was accepted and has been committed to the chain INVALID - the batch failed validation, it should be resubmitted PENDING - the batch is still being processed UNKNOWN - no status for the batch could be found (possibly invalid)

FieldTypeLabelDescription
batch_idstring
statusClientBatchStatus.Status
invalid_transactionsClientBatchStatus.InvalidTransactionrepeated

ClientBatchStatus.InvalidTransaction

FieldTypeLabelDescription
transaction_idstring
messagestring
extended_databytes

ClientBatchStatusRequest

A request for the status of one or more batches, specified by id. If wait is set to true, the validator will wait to respond until all batches are committed, or until the specified timeout in seconds has elapsed. Defaults to 300.

FieldTypeLabelDescription
batch_idsstringrepeated
waitbool
timeoutuint32

ClientBatchStatusResponse

This is a response to a request for the status of specific batches. Statuses:

  • OK - everything with the request worked as expected
  • INTERNAL_ERROR - general error, such as protobuf failing to deserialize
  • NO_RESOURCE - the response contains no data, likely because no ids were specified in the request
FieldTypeLabelDescription
statusClientBatchStatusResponse.Status
batch_statusesClientBatchStatusrepeated

ClientBatchSubmitRequest

Submits a list of Batches to be added to the blockchain.

FieldTypeLabelDescription
batchesBatchrepeated

ClientBatchSubmitResponse

This is a response to a submission of one or more Batches. Statuses:

  • OK - everything with the request worked as expected
  • INTERNAL_ERROR - general error, such as protobuf failing to deserialize
  • INVALID_BATCH - the batch failed validation, likely due to a bad signature
  • QUEUE_FULL - the batch is unable to be queued for processing, due to a full processing queue. The batch may be submitted again.
FieldTypeLabelDescription
statusClientBatchSubmitResponse.Status

ClientBatchStatus.Status

NameNumberDescription
STATUS_UNSET0
COMMITTED1
INVALID2
PENDING3
UNKNOWN4

ClientBatchStatusResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
NO_RESOURCE5
INVALID_ID8

ClientBatchSubmitResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
INVALID_BATCH3
QUEUE_FULL4

Top

client_block.proto

ClientBlockGetByBatchIdRequest

A request to return a specific block from the validator. The block containing the given batch is returned. If no block on the current chain contains the batch, NO_RESOURCE is returned.

FieldTypeLabelDescription
batch_idstring

ClientBlockGetByIdRequest

A request to return a specific block from the validator. The block must be specified by its unique id, in this case the block's header signature

FieldTypeLabelDescription
block_idstring

ClientBlockGetByNumRequest

A request to return a specific block from the validator. The block must be specified by its block number

FieldTypeLabelDescription
block_numuint64

ClientBlockGetByTransactionIdRequest

A request to return a specific block from the validator. The block containing the given transaction is returned. If no block on the current chain contains the transaction, NO_RESOURCE is returned.

FieldTypeLabelDescription
transaction_idstring

ClientBlockGetResponse

A response that returns the block specified by a ClientBlockGetByIdRequest or ClientBlockGetByNumRequest.

Statuses:

  • OK - everything worked as expected
  • INTERNAL_ERROR - general error, such as protobuf failing to deserialize
  • NO_RESOURCE - no block with the specified id exists
FieldTypeLabelDescription
statusClientBlockGetResponse.Status
blockBlock

ClientBlockListRequest

A request to return a list of blocks from the validator. May include the id of a particular block to be the head of the chain being requested. In that case the list will include that block (if found), and all blocks previous to it on the chain. Can be filtered using specific block_ids.

FieldTypeLabelDescription
head_idstring
block_idsstringrepeated
pagingClientPagingControls
sortingClientSortControlsrepeated

ClientBlockListResponse

A response that lists a chain of blocks with the newest at the beginning, and the oldest (genesis) block at the end.

Statuses:

  • OK - everything worked as expected
  • INTERNAL_ERROR - general error, such as protobuf failing to deserialize
  • NOT_READY - the validator does not yet have a genesis block
  • NO_ROOT - the head block specified was not found
  • NO_RESOURCE - no blocks were found with the parameters specified
  • INVALID_PAGING - the paging controls were malformed or out of range
  • INVALID_SORT - the sorting controls were malformed or invalid
FieldTypeLabelDescription
statusClientBlockListResponse.Status
blocksBlockrepeated
head_idstring
pagingClientPagingResponse

ClientBlockGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
NO_RESOURCE5
INVALID_ID8

ClientBlockListResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
NOT_READY3
NO_ROOT4
NO_RESOURCE5
INVALID_PAGING6
INVALID_SORT7
INVALID_ID8

Top

processor.proto

TpProcessRequest

The request from the validator/executor of the transaction processor to verify a transaction.

FieldTypeLabelDescription
headerTransactionHeaderThe de-serialized transaction header from client request
payloadbytesThe transaction payload
signaturestringThe transaction header_signature
context_idstringThe context_id for state requests.
header_bytesbytesThe serialized header as received by client. Controlled by a flag during transaction processor registration.

TpProcessResponse

The response from the transaction processor to the validator/executor used to respond about the validity of a transaction

FieldTypeLabelDescription
statusTpProcessResponse.Status
messagestringA message to include on responses in the cases where status is either INVALID_TRANSACTION or INTERNAL_ERROR
extended_databytesInformation that may be included with the response. This information is an opaque, application-specific encoded block of data that will be propagated back to the transaction submitter.

TpRegisterRequest

The registration request from the transaction processor to the validator/executor.

The protocol_version field is used to check if the validator supports requested features by a transaction processor. Following are the versions supported: 1 Transaction processor can request for either raw header bytes or deserialized TransactionHeader field in the TpProcessRequest message. The default option is set to send deserialized TransactionHeader.

FieldTypeLabelDescription
familystringA settled upon name for the capabilities of the transaction processor. For example: intkey, xo
versionstringThe version supported. For example: 1.0 for version 1.0 2.1 for version 2.1
namespacesstringrepeatedThe namespaces this transaction processor expects to interact with when processing transactions matching this specification; will be enforced by the state API on the validator.
max_occupancyuint32The maximum number of transactions that this transaction processor can handle at once.
protocol_versionuint32Validator can make use of this field to check if the requested features are supported. Registration requests can be either accepted or rejected based on this field.
request_header_styleTpRegisterRequest.TpProcessRequestHeaderStyleSetting it to RAW, validator would fill in serialized transaction header when sending TpProcessRequest to the transaction processor.

TpRegisterResponse

A response sent from the validator to the transaction processor acknowledging the registration

FieldTypeLabelDescription
statusTpRegisterResponse.Status
protocol_versionuint32Respond back with protocol_version, the value that can be used by SDK to know if validator supports expected feature.

TpUnregisterRequest

The unregistration request from the transaction processor to the validator/executor. The correct handlers are determined from the zeromq identity of the tp, on the validator side.

TpUnregisterResponse

A response sent from the validator to the transaction processor acknowledging the unregistration

FieldTypeLabelDescription
statusTpUnregisterResponse.Status

TpProcessResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INVALID_TRANSACTION2
INTERNAL_ERROR3

TpRegisterRequest.TpProcessRequestHeaderStyle

enum used to fill in transaction header field in TpProcessRequest. This field can be set before transaction processor registers with validator.

NameNumberDescription
HEADER_STYLE_UNSET0
EXPANDED1
RAW2

TpRegisterResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
ERROR2

TpUnregisterResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
ERROR2

Top

client_transaction.proto

ClientTransactionGetRequest

Fetches a specific txn by its id (header_signature) from the blockchain.

FieldTypeLabelDescription
transaction_idstring

ClientTransactionGetResponse

A response that returns the txn specified by a ClientTransactionGetRequest.

Statuses:

  • OK - everything worked as expected, txn has been fetched
  • INTERNAL_ERROR - general error, such as protobuf failing to deserialize
  • NO_RESOURCE - no txn with the specified id exists
FieldTypeLabelDescription
statusClientTransactionGetResponse.Status
transactionTransaction

ClientTransactionListRequest

A request to return a list of txns from the validator. May include the id of a particular block to be the head of the chain being requested. In that case the list will include the txns from that block, and all txns previous to that block on the chain. Filter with specific transaction_ids.

FieldTypeLabelDescription
head_idstring
transaction_idsstringrepeated
pagingClientPagingControls
sortingClientSortControlsrepeated

ClientTransactionListResponse

A response that lists transactions from newest to oldest.

Statuses:

  • OK - everything worked as expected
  • INTERNAL_ERROR - general error, such as protobuf failing to deserialize
  • NOT_READY - the validator does not yet have a genesis block
  • NO_ROOT - the head block specified was not found
  • NO_RESOURCE - no txns were found with the parameters specified
  • INVALID_PAGING - the paging controls were malformed or out of range
  • INVALID_SORT - the sorting controls were malformed or invalid
FieldTypeLabelDescription
statusClientTransactionListResponse.Status
transactionsTransactionrepeated
head_idstring
pagingClientPagingResponse

ClientTransactionGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
NO_RESOURCE5
INVALID_ID8

ClientTransactionListResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
NOT_READY3
NO_ROOT4
NO_RESOURCE5
INVALID_PAGING6
INVALID_SORT7
INVALID_ID8

Top

client_list_control.proto

ClientPagingControls

Paging controls to be sent with List requests. Attributes: start: The id of a resource to start the page with limit: The number of results per page, defaults to 100 and maxes out at 1000

FieldTypeLabelDescription
startstring
limitint32

ClientPagingResponse

Information about the pagination used, sent back with List responses. Attributes: next: The id of the first resource in the next page start: The id of the first resource in the returned page limit: The number of results per page, defaults to 100 and maxes out at 1000

FieldTypeLabelDescription
nextstring
startstring
limitint32

ClientSortControls

Sorting controls to be sent with List requests. More than one can be sent. If so, the first is used, and additional controls are tie-breakers. Attributes: keys: Nested set of keys to sort by (i.e. ['default, block_num']) reverse: Whether or not to reverse the sort (i.e. descending order)

FieldTypeLabelDescription
keysstringrepeated
reversebool

Top

batch.proto

Batch

FieldTypeLabelDescription
headerbytesThe serialized version of the BatchHeader
header_signaturestringThe signature derived from signing the header
transactionsTransactionrepeatedA list of the transactions that match the list of transaction_ids listed in the batch header
traceboolA debugging flag which indicates this batch should be traced through the system, resulting in a higher level of debugging output.

BatchHeader

FieldTypeLabelDescription
signer_public_keystringPublic key for the client that signed the BatchHeader
transaction_idsstringrepeatedList of transaction.header_signatures that match the order of transactions required for the batch

BatchList

FieldTypeLabelDescription
batchesBatchrepeated

Top

events.proto

Event

FieldTypeLabelDescription
event_typestringUsed to subscribe to events and servers as a hint for how to deserialize event_data and what pairs to expect in attributes.
attributesEvent.Attributerepeated
databytesOpaque data defined by the event_type.

Event.Attribute

Transparent data defined by the event_type.

FieldTypeLabelDescription
keystring
valuestring

EventFilter

FieldTypeLabelDescription
keystringEventFilter is used when subscribing to events to limit the events received within a given event type. See validator/server/events/subscription.py for further explanation.
match_stringstring
filter_typeEventFilter.FilterType

EventList

FieldTypeLabelDescription
eventsEventrepeated

EventSubscription

FieldTypeLabelDescription
event_typestringEventSubscription is used when subscribing to events to specify the type of events being subscribed to, along with any additional filters. See validator/server/events/subscription.py for further explanation.
filtersEventFilterrepeated

EventFilter.FilterType

NameNumberDescription
FILTER_TYPE_UNSET0
SIMPLE_ANY1
SIMPLE_ALL2
REGEX_ANY3
REGEX_ALL4

Top

identity.proto

Policy

FieldTypeLabelDescription
namestringname of the policy, this should be unique.
entriesPolicy.Entryrepeatedlist of Entries The entries will be processed in order from first to last.

Policy.Entry

FieldTypeLabelDescription
typePolicy.EntryTypeWhether this is a Permit_KEY or Deny_KEY entry
keystringThis should be a public key or * to refer to all participants.

PolicyList

Policy will be stored in a Policy list to account for state collisions

FieldTypeLabelDescription
policiesPolicyrepeated

Role

FieldTypeLabelDescription
namestringRole name
policy_namestringName of corresponding policy

RoleList

Roles will be stored in a RoleList to account for state collisions

FieldTypeLabelDescription
rolesRolerepeated

Policy.EntryType

NameNumberDescription
ENTRY_TYPE_UNSET0
PERMIT_KEY1
DENY_KEY2

Top

block.proto

Block

FieldTypeLabelDescription
headerbytesThe serialized version of the BlockHeader
header_signaturestringThe signature derived from signing the header
batchesBatchrepeatedA list of batches. The batches may contain new batches that other validators may not have received yet, or they will be all batches needed for block validation when passed to the journal

BlockHeader

FieldTypeLabelDescription
block_numuint64Block number in the chain
previous_block_idstringThe header_signature of the previous block that was added to the chain.
signer_public_keystringPublic key for the component internal to the validator that signed the BlockHeader
batch_idsstringrepeatedList of batch.header_signatures that match the order of batches required for the block
consensusbytesBytes that are set and verified by the consensus algorithm used to create and validate the block
state_root_hashstringThe state_root_hash should match the final state_root after all transactions in the batches have been applied, otherwise the block is not valid

Top

client_state.proto

ClientStateGetRequest

A request from a client for a particular entry in global state. Like State List, it defaults to the newest state, but a state root can be used to specify older data. Unlike State List the request must be provided with a full address that corresponds to a single entry.

FieldTypeLabelDescription
state_rootstring
addressstring

ClientStateGetResponse

The response to a State Get Request from the client. Sends back just the data stored at the entry, not the address. Also sends back the head block id used to facilitate further requests.

Statuses:

  • OK - everything worked as expected
  • INTERNAL_ERROR - general error, such as protobuf failing to deserialize
  • NOT_READY - the validator does not yet have a genesis block
  • NO_ROOT - the state_root specified was not found
  • NO_RESOURCE - the address specified doesn't exist
  • INVALID_ADDRESS - address isn't a valid, i.e. it's a subtree (truncated)
FieldTypeLabelDescription
statusClientStateGetResponse.Status
valuebytes
state_rootstring

ClientStateListRequest

A request to list every entry in global state. Defaults to the most current tree, but can fetch older state by specifying a state root. Results can be further filtered by specifying a subtree with a partial address.

FieldTypeLabelDescription
state_rootstring
addressstring
pagingClientPagingControls
sortingClientSortControlsrepeated

ClientStateListResponse

FieldTypeLabelDescription
statusClientStateListResponse.Status
entriesClientStateListResponse.Entryrepeated
state_rootstring
pagingClientPagingResponse

ClientStateListResponse.Entry

An entry in the State

FieldTypeLabelDescription
addressstring
databytes

ClientStateGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
NOT_READY3
NO_ROOT4
NO_RESOURCE5
INVALID_ADDRESS6
INVALID_ROOT7

ClientStateListResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
NOT_READY3
NO_ROOT4
NO_RESOURCE5
INVALID_PAGING6
INVALID_SORT7
INVALID_ADDRESS8
INVALID_ROOT9

Top

client_event.proto

ClientEventsGetRequest

FieldTypeLabelDescription
subscriptionsEventSubscriptionrepeated
block_idsstringrepeated

ClientEventsGetResponse

FieldTypeLabelDescription
statusClientEventsGetResponse.Status
eventsEventrepeated

ClientEventsSubscribeRequest

FieldTypeLabelDescription
subscriptionsEventSubscriptionrepeated
last_known_block_idsstringrepeatedThe block id (or ids, if trying to walk back a fork) the subscriber last received events on. It can be set to empty if it has not yet received the genesis block.

ClientEventsSubscribeResponse

FieldTypeLabelDescription
statusClientEventsSubscribeResponse.Status
response_messagestringAdditional information about the response status

ClientEventsUnsubscribeRequest

ClientEventsUnsubscribeResponse

FieldTypeLabelDescription
statusClientEventsUnsubscribeResponse.Status

ClientEventsGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
INVALID_FILTER3
UNKNOWN_BLOCK4

ClientEventsSubscribeResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INVALID_FILTER2
UNKNOWN_BLOCK3

ClientEventsUnsubscribeResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2

Top

state_context.proto

TpEventAddRequest

FieldTypeLabelDescription
context_idstring
eventEvent

TpEventAddResponse

FieldTypeLabelDescription
statusTpEventAddResponse.Status

TpReceiptAddDataRequest

The request from the transaction processor to the validator append data to a transaction receipt

FieldTypeLabelDescription
context_idstringThe context id that references a context in the context manager
databytes

TpReceiptAddDataResponse

The response from the validator to the transaction processor to verify that data has been appended to a transaction receipt

FieldTypeLabelDescription
statusTpReceiptAddDataResponse.Status

TpStateDeleteRequest

A request from the handler/tp to delete state entries at an collection of addresses

FieldTypeLabelDescription
context_idstring
addressesstringrepeated

TpStateDeleteResponse

A response form the contextmanager/validator with the addresses that were deleted

FieldTypeLabelDescription
addressesstringrepeated
statusTpStateDeleteResponse.Status

TpStateEntry

An entry in the State

FieldTypeLabelDescription
addressstring
databytes

TpStateGetRequest

A request from a handler/tp for the values at a series of addresses

FieldTypeLabelDescription
context_idstringThe context id that references a context in the contextmanager
addressesstringrepeated

TpStateGetResponse

A response from the contextmanager/validator with a series of State entries

FieldTypeLabelDescription
entriesTpStateEntryrepeated
statusTpStateGetResponse.Status

TpStateSetRequest

A request from the handler/tp to put entries in the state of a context

FieldTypeLabelDescription
context_idstring
entriesTpStateEntryrepeated

TpStateSetResponse

A response from the contextmanager/validator with the addresses that were set

FieldTypeLabelDescription
addressesstringrepeated
statusTpStateSetResponse.Status

TpEventAddResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
ERROR2

TpReceiptAddDataResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
ERROR2

TpStateDeleteResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
AUTHORIZATION_ERROR2

TpStateGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
AUTHORIZATION_ERROR2

TpStateSetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
AUTHORIZATION_ERROR2

Top

setting.proto

Setting

Setting Container for on-chain configuration key/value pairs

FieldTypeLabelDescription
entriesSetting.EntryrepeatedList of setting entries - more than one implies a state key collision

Setting.Entry

Contains a setting entry (or entries, in the case of collisions).

FieldTypeLabelDescription
keystring
valuestring

Top

block_info.proto

BlockInfo

FieldTypeLabelDescription
block_numuint64Block number in the chain
previous_block_idstringThe header_signature of the previous block that was added to the chain.
signer_public_keystringPublic key for the component internal to the validator that signed the BlockHeader
header_signaturestringThe signature derived from signing the header
timestampuint64Approximately when this block was committed, as a Unix UTC timestamp

BlockInfoConfig

FieldTypeLabelDescription
latest_blockuint64
oldest_blockuint64
target_countuint64
sync_toleranceuint64

BlockInfoTxn

FieldTypeLabelDescription
blockBlockInfoThe new block to add to state
target_countuint64If this is set, the new target number of blocks to store in state
sync_toleranceuint64If set, the new network time synchronization tolerance.

Top

transaction_receipt.proto

StateChange

StateChange objects have the type of SET, which is either an insert or update, or DELETE. Items marked as a DELETE will have no byte value.

FieldTypeLabelDescription
addressstring
valuebytes
typeStateChange.Type

StateChangeList

A collection of state changes.

FieldTypeLabelDescription
state_changesStateChangerepeated

TransactionReceipt

FieldTypeLabelDescription
state_changesStateChangerepeatedState changes made by this transaction StateChange is defined in protos/transaction_receipt.proto
eventsEventrepeatedEvents fired by this transaction
databytesrepeatedTransaction family defined data
transaction_idstring

StateChange.Type

NameNumberDescription
TYPE_UNSET0
SET1
DELETE2

Top

client_batch.proto

ClientBatchGetRequest

Fetches a specific batch by its id (header_signature) from the blockchain.

FieldTypeLabelDescription
batch_idstring

ClientBatchGetResponse

A response that returns the batch specified by a ClientBatchGetRequest.

Statuses:

  • OK - everything worked as expected, batch has been fetched
  • INTERNAL_ERROR - general error, such as protobuf failing to deserialize
  • NO_RESOURCE - no batch with the specified id exists
FieldTypeLabelDescription
statusClientBatchGetResponse.Status
batchBatch

ClientBatchListRequest

A request to return a list of batches from the validator. May include the id of a particular block to be the head of the chain being requested. In that case the list will include the batches from that block, and all batches previous to that block on the chain. Filter with specific batch_ids.

FieldTypeLabelDescription
head_idstring
batch_idsstringrepeated
pagingClientPagingControls
sortingClientSortControlsrepeated

ClientBatchListResponse

A response that lists batches from newest to oldest.

Statuses:

  • OK - everything worked as expected
  • INTERNAL_ERROR - general error, such as protobuf failing to deserialize
  • NOT_READY - the validator does not yet have a genesis block
  • NO_ROOT - the head block specified was not found
  • NO_RESOURCE - no batches were found with the parameters specified
  • INVALID_PAGING - the paging controls were malformed or out of range
  • INVALID_SORT - the sorting controls were malformed or invalid
FieldTypeLabelDescription
statusClientBatchListResponse.Status
batchesBatchrepeated
head_idstring
pagingClientPagingResponse

ClientBatchGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
NO_RESOURCE5
INVALID_ID8

ClientBatchListResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
NOT_READY3
NO_ROOT4
NO_RESOURCE5
INVALID_PAGING6
INVALID_SORT7
INVALID_ID8

Top

authorization.proto

AuthorizationChallengeRequest

Empty message sent to request a payload to sign

AuthorizationChallengeResponse

FieldTypeLabelDescription
payloadbytesRandom payload that the connecting node must sign

AuthorizationChallengeResult

FieldTypeLabelDescription
rolesRoleTyperepeatedThe approved roles for that connection

AuthorizationChallengeSubmit

FieldTypeLabelDescription
public_keystringpublic key of node
signaturestringsignature derived from signing the challenge payload
rolesRoleTyperepeatedA set of requested Roles

AuthorizationTrustRequest

FieldTypeLabelDescription
rolesRoleTyperepeatedA set of requested RoleTypes
public_keystring

AuthorizationTrustResponse

FieldTypeLabelDescription
rolesRoleTyperepeatedThe actual set the requester has access to

AuthorizationViolation

FieldTypeLabelDescription
violationRoleTypeThe Role the requester did not have access to

ConnectionRequest

FieldTypeLabelDescription
endpointstringThis is the first message that must be sent to start off authorization. The endpoint of the connection.

ConnectionResponse

FieldTypeLabelDescription
rolesConnectionResponse.RoleEntryrepeated
statusConnectionResponse.Status

ConnectionResponse.RoleEntry

FieldTypeLabelDescription
roleRoleTypeThe role type for this role entry
auth_typeConnectionResponse.AuthorizationTypeThe Authorization Type required for the above role

ConnectionResponse.AuthorizationType

Authorization Type required for the authorization procedure

NameNumberDescription
AUTHORIZATION_TYPE_UNSET0
TRUST1
CHALLENGE2

ConnectionResponse.Status

Whether the connection can participate in authorization

NameNumberDescription
STATUS_UNSET0
OK1
ERROR2

RoleType

NameNumberDescription
ROLE_TYPE_UNSET0
ALL1A shorthand request for asking for all allowed roles.
NETWORK2Role defining validator to validator communication

Top

genesis.proto

GenesisData

FieldTypeLabelDescription
batchesBatchrepeatedThe list of batches that will be applied during the genesis process

Top

merkle.proto

ChangeLogEntry

An Entry in the change log for a given state root.

FieldTypeLabelDescription
parentbytesA root hash of a merkle trie this tree was based off.
additionsbytesrepeatedThe hashes that were added for this root. These may be deleted during pruning, if this root is being abandoned.
successorsChangeLogEntry.SuccessorrepeatedThe list of successors.

ChangeLogEntry.Successor

A state root that succeed this root.

FieldTypeLabelDescription
successorbytesA root hash of a merkle trie based of off this root.
deletionsbytesrepeatedThe keys (i.e. hashes) that were replaced (i.e. deleted) by this successor. These may be deleted during pruning.

Top

network.proto

DisconnectMessage

The disconnect message from a client to the server

GetPeersRequest

GetPeersResponse

FieldTypeLabelDescription
peer_endpointsstringrepeated

GossipBatchByBatchIdRequest

FieldTypeLabelDescription
idstringThe id of the batch that is being requested
noncestringA random string that provides uniqueness for requests with otherwise identical fields.
time_to_liveuint32

GossipBatchByTransactionIdRequest

FieldTypeLabelDescription
idsstringrepeatedThe id's of the transaction that are in the batches requested
noncestringA random string that provides uniqueness for requests with otherwise identical fields.
time_to_liveuint32

GossipBatchResponse

FieldTypeLabelDescription
contentbytesThe batch

GossipBlockRequest

FieldTypeLabelDescription
block_idstringThe id of the block that is being requested
noncestringA random string that provides uniqueness for requests with otherwise identical fields.
time_to_liveuint32

GossipBlockResponse

FieldTypeLabelDescription
contentbytesThe block

GossipMessage

FieldTypeLabelDescription
contentbytes
content_typeGossipMessage.ContentType
time_to_liveuint32

NetworkAcknowledgement

A response sent from the validator to the peer acknowledging message receipt

FieldTypeLabelDescription
statusNetworkAcknowledgement.Status

PeerRegisterRequest

The registration request from a peer to the validator

FieldTypeLabelDescription
endpointstring
protocol_versionuint32The current version of the network protocol that is being used by the sender. This version is an increasing value.

PeerUnregisterRequest

The unregistration request from a peer to the validator

PingRequest

PingResponse

GossipMessage.ContentType

NameNumberDescription
CONTENT_TYPE_UNSET0
BLOCK1
BATCH2
CONSENSUS3

NetworkAcknowledgement.Status

NameNumberDescription
STATUS_UNSET0
OK1
ERROR2

Top

client_peers.proto

ClientPeersGetRequest

ClientPeersGetResponse

FieldTypeLabelDescription
statusClientPeersGetResponse.Status
peersstringrepeated

ClientPeersGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
ERROR2

Top

client_receipt.proto

ClientReceiptGetRequest

Fetches a specific txn by its id (header_signature) from the blockchain.

FieldTypeLabelDescription
transaction_idsstringrepeated

ClientReceiptGetResponse

A response that returns the txn receipt specified by a ClientTransactionReceiptGetRequest.

Statuses:

  • OK - everything worked as expected, txn receipt has been fetched
  • INTERNAL_ERROR - general error, such as protobuf failing to deserialize
  • NO_RESOURCE - no receipt exists for the transaction id specified
FieldTypeLabelDescription
statusClientReceiptGetResponse.Status
receiptsTransactionReceiptrepeated

ClientReceiptGetResponse.Status

NameNumberDescription
STATUS_UNSET0
OK1
INTERNAL_ERROR2
NO_RESOURCE5
INVALID_ID8

Scalar Value Types

.proto TypeNotesC++ TypeJava TypePython Type
doubledoubledoublefloat
floatfloatfloatfloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intint
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/long
uint32Uses variable-length encoding.uint32intint/long
uint64Uses variable-length encoding.uint64longint/long
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intint
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/long
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intint
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/long
sfixed32Always four bytes.int32intint
sfixed64Always eight bytes.int64longint/long
boolboolbooleanboolean
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicode
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr

Protos File Tree


.
├── authorization.proto
├── batch.proto
├── block_info.proto
├── block.proto
├── client_batch.proto
├── client_batch_submit.proto
├── client_block.proto
├── client_event.proto
├── client_list_control.proto
├── client_peers.proto
├── client_receipt.proto
├── client_state.proto
├── client_status.proto
├── client_transaction.proto
├── consensus.proto
├── events.proto
├── genesis.proto
├── identity.proto
├── merkle.proto
├── network.proto
├── processor.proto
├── setting.proto
├── state_context.proto
├── transaction.proto
├── transaction_receipt.proto
└── validator.proto

0 directories, 26 files

Protobuf sources

src:./transaction.proto


// Copyright 2016 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "transaction_pb2";

message TransactionHeader {
    // Public key for the client who added this transaction to a batch
    string batcher_public_key = 1;

    // A list of transaction signatures that describe the transactions that
    // must be processed before this transaction can be valid
    repeated string dependencies = 2;

    // The family name correlates to the transaction processor's family name
    // that this transaction can be processed on, for example 'intkey'
    string family_name = 3;

    // The family version correlates to the transaction processor's family
    // version that this transaction can be processed on, for example "1.0"
    string family_version = 4;

    // A list of addresses that are given to the context manager and control
    // what addresses the transaction processor is allowed to read from.
    repeated string inputs = 5;

    // A random string that provides uniqueness for transactions with
    // otherwise identical fields.
    string nonce = 6;

    // A list of addresses that are given to the context manager and control
    // what addresses the transaction processor is allowed to write to.
    repeated string outputs = 7;

    //The sha512 hash of the encoded payload
    string payload_sha512 = 9;

    // Public key for the client that signed the TransactionHeader
    string signer_public_key = 10;
}

message Transaction {
    // The serialized version of the TransactionHeader
    bytes header = 1;

    // The signature derived from signing the header
    string header_signature = 2;

    // The payload is the encoded family specific information of the
    // transaction. Example cbor({'Verb': verb, 'Name': name,'Value': value})
    bytes payload = 3;
}

// A simple list of transactions that needs to be serialized before
// it can be transmitted to a batcher.
message TransactionList {
    repeated Transaction transactions = 1;
}

src:./client_status.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_status";

// A request to get miscellaneous information about the validator
message ClientStatusGetRequest{
}

message ClientStatusGetResponse {
  // The status of the response message, not the validator's status
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    ERROR = 2;
  }

  // Information about the validator's peers
  message Peer {
    // The peer's public network endpoint
    string endpoint = 1;
  }

  Status status = 1;
  repeated Peer peers = 2;
  // The validator's public network endpoint
  string endpoint = 3;
}

src:./validator.proto


// Copyright 2016, 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "validator_pb2";

// A list of messages to be transmitted together.
message MessageList {
    repeated Message messages = 1;
}

// The message passed between the validator and client, containing the
// header fields and content.
message Message {

    enum MessageType {
        DEFAULT = 0;
        // Registration request from the transaction processor to the validator
        TP_REGISTER_REQUEST = 1;
        // Registration response from the validator to the
        // transaction processor
        TP_REGISTER_RESPONSE = 2;
        // Tell the validator that the transaction processor
        // won't take any more transactions
        TP_UNREGISTER_REQUEST = 3;
        // Response from the validator to the tp that it won't
        // send any more transactions
        TP_UNREGISTER_RESPONSE = 4;
        // Process Request from the validator/executor to the
        // transaction processor
        TP_PROCESS_REQUEST = 5;
        // Process response from the transaction processor to the validator/executor
        TP_PROCESS_RESPONSE = 6;
        // State get request from the transaction processor to validator/context_manager
        TP_STATE_GET_REQUEST = 7;
        // State get response from the validator/context_manager to the transaction processor
        TP_STATE_GET_RESPONSE = 8;
        // State set request from the transaction processor to the validator/context_manager
        TP_STATE_SET_REQUEST = 9;
        // State set response from the validator/context_manager to the transaction processor
        TP_STATE_SET_RESPONSE = 10;
        // State delete request from the transaction processor to the validator/context_manager
        TP_STATE_DELETE_REQUEST = 11;
        // State delete response from the validator/context_manager to the transaction processor
        TP_STATE_DELETE_RESPONSE = 12;
        // Message to append data to a transaction receipt
        TP_RECEIPT_ADD_DATA_REQUEST = 13;
        // Response from validator to tell transaction processor that data has been appended
        TP_RECEIPT_ADD_DATA_RESPONSE = 14;
        // Message to add event
        TP_EVENT_ADD_REQUEST = 15;
        // Response from validator to tell transaction processor that event has been created
        TP_EVENT_ADD_RESPONSE = 16;

        // Submission of a batchlist from the web api or another client to the validator
        CLIENT_BATCH_SUBMIT_REQUEST = 100;
        // Response from the validator to the web api/client that the submission was accepted
        CLIENT_BATCH_SUBMIT_RESPONSE = 101;
        // A request to list blocks from the web api/client to the validator
        CLIENT_BLOCK_LIST_REQUEST = 102;
        CLIENT_BLOCK_LIST_RESPONSE = 103;
        CLIENT_BLOCK_GET_BY_ID_REQUEST = 104;
        CLIENT_BLOCK_GET_RESPONSE = 105;
        CLIENT_BATCH_LIST_REQUEST = 106;
        CLIENT_BATCH_LIST_RESPONSE = 107;
        CLIENT_BATCH_GET_REQUEST = 108;
        CLIENT_BATCH_GET_RESPONSE = 109;
        CLIENT_TRANSACTION_LIST_REQUEST = 110;
        CLIENT_TRANSACTION_LIST_RESPONSE = 111;
        CLIENT_TRANSACTION_GET_REQUEST = 112;
        CLIENT_TRANSACTION_GET_RESPONSE = 113;
        // Client state request of the current state hash to be retrieved from the journal
        CLIENT_STATE_CURRENT_REQUEST = 114;
        // Response with the current state hash
        CLIENT_STATE_CURRENT_RESPONSE = 115;
        // A request of all the addresses under a particular prefix, for a state hash.
        CLIENT_STATE_LIST_REQUEST = 116;
        // The response of the addresses
        CLIENT_STATE_LIST_RESPONSE = 117;
        // Get the address:data entry at a particular address
        CLIENT_STATE_GET_REQUEST = 118;
        // The response with the entry
        CLIENT_STATE_GET_RESPONSE = 119;
        // A request for the status of a batch or batches
        CLIENT_BATCH_STATUS_REQUEST = 120;
        // A response with the batch statuses
        CLIENT_BATCH_STATUS_RESPONSE = 121;
        // A request for one or more transaction receipts
        CLIENT_RECEIPT_GET_REQUEST = 122;
        // A response with the receipts
        CLIENT_RECEIPT_GET_RESPONSE = 123;
        CLIENT_BLOCK_GET_BY_NUM_REQUEST = 124;
        // A request for a validator's peers
        CLIENT_PEERS_GET_REQUEST = 125;
        // A response with the validator's peers
        CLIENT_PEERS_GET_RESPONSE = 126;
        CLIENT_BLOCK_GET_BY_TRANSACTION_ID_REQUEST = 127;
        CLIENT_BLOCK_GET_BY_BATCH_ID_REQUEST = 128;
        // A request for a validator's status
        CLIENT_STATUS_GET_REQUEST = 129;
        // A response with the validator's status
        CLIENT_STATUS_GET_RESPONSE = 130;

        // Message types for events
        CLIENT_EVENTS_SUBSCRIBE_REQUEST = 500;
        CLIENT_EVENTS_SUBSCRIBE_RESPONSE = 501;
        CLIENT_EVENTS_UNSUBSCRIBE_REQUEST = 502;
        CLIENT_EVENTS_UNSUBSCRIBE_RESPONSE = 503;
        CLIENT_EVENTS = 504;
        CLIENT_EVENTS_GET_REQUEST = 505;
        CLIENT_EVENTS_GET_RESPONSE = 506;

        // Temp message types until a discussion can be had about gossip msg
        GOSSIP_MESSAGE = 200;
        GOSSIP_REGISTER = 201;
        GOSSIP_UNREGISTER = 202;
        GOSSIP_BLOCK_REQUEST = 205;
        GOSSIP_BLOCK_RESPONSE = 206;
        GOSSIP_BATCH_BY_BATCH_ID_REQUEST = 207;
        GOSSIP_BATCH_BY_TRANSACTION_ID_REQUEST = 208;
        GOSSIP_BATCH_RESPONSE = 209;
        GOSSIP_GET_PEERS_REQUEST = 210;
        GOSSIP_GET_PEERS_RESPONSE = 211;
        GOSSIP_CONSENSUS_MESSAGE = 212;

        NETWORK_ACK = 300;
        NETWORK_CONNECT = 301;
        NETWORK_DISCONNECT = 302;

        // Message types for Authorization Types
        AUTHORIZATION_CONNECTION_RESPONSE = 600;
        AUTHORIZATION_VIOLATION = 601;
        AUTHORIZATION_TRUST_REQUEST = 602;
        AUTHORIZATION_TRUST_RESPONSE = 603;
        AUTHORIZATION_CHALLENGE_REQUEST = 604;
        AUTHORIZATION_CHALLENGE_RESPONSE = 605;
        AUTHORIZATION_CHALLENGE_SUBMIT = 606;
        AUTHORIZATION_CHALLENGE_RESULT = 607;

        PING_REQUEST = 700;
        PING_RESPONSE = 701;

        // Consensus service messages
        CONSENSUS_REGISTER_REQUEST = 800;
        CONSENSUS_REGISTER_RESPONSE = 801;

        CONSENSUS_SEND_TO_REQUEST = 802;
        CONSENSUS_SEND_TO_RESPONSE = 803;
        CONSENSUS_BROADCAST_REQUEST = 804;
        CONSENSUS_BROADCAST_RESPONSE = 805;

        CONSENSUS_INITIALIZE_BLOCK_REQUEST = 806;
        CONSENSUS_INITIALIZE_BLOCK_RESPONSE = 807;
        CONSENSUS_FINALIZE_BLOCK_REQUEST = 808;
        CONSENSUS_FINALIZE_BLOCK_RESPONSE = 809;
        CONSENSUS_SUMMARIZE_BLOCK_REQUEST = 828;
        CONSENSUS_SUMMARIZE_BLOCK_RESPONSE = 829;
        CONSENSUS_CANCEL_BLOCK_REQUEST = 810;
        CONSENSUS_CANCEL_BLOCK_RESPONSE = 811;

        CONSENSUS_CHECK_BLOCKS_REQUEST = 812;
        CONSENSUS_CHECK_BLOCKS_RESPONSE = 813;
        CONSENSUS_COMMIT_BLOCK_REQUEST = 814;
        CONSENSUS_COMMIT_BLOCK_RESPONSE = 815;
        CONSENSUS_IGNORE_BLOCK_REQUEST = 816;
        CONSENSUS_IGNORE_BLOCK_RESPONSE = 817;
        CONSENSUS_FAIL_BLOCK_REQUEST = 818;
        CONSENSUS_FAIL_BLOCK_RESPONSE = 819;

        CONSENSUS_SETTINGS_GET_REQUEST = 820;
        CONSENSUS_SETTINGS_GET_RESPONSE = 821;
        CONSENSUS_STATE_GET_REQUEST = 822;
        CONSENSUS_STATE_GET_RESPONSE = 823;
        CONSENSUS_BLOCKS_GET_REQUEST = 824;
        CONSENSUS_BLOCKS_GET_RESPONSE = 825;
        CONSENSUS_CHAIN_HEAD_GET_REQUEST = 826;
        CONSENSUS_CHAIN_HEAD_GET_RESPONSE = 827;

        // Consensus notification messages
        CONSENSUS_NOTIFY_PEER_CONNECTED = 900;
        CONSENSUS_NOTIFY_PEER_DISCONNECTED = 901;
        CONSENSUS_NOTIFY_PEER_MESSAGE = 902;

        CONSENSUS_NOTIFY_BLOCK_NEW = 903;
        CONSENSUS_NOTIFY_BLOCK_VALID = 904;
        CONSENSUS_NOTIFY_BLOCK_INVALID = 905;
        CONSENSUS_NOTIFY_BLOCK_COMMIT = 906;

        CONSENSUS_NOTIFY_ENGINE_ACTIVATED = 907;
        CONSENSUS_NOTIFY_ENGINE_DEACTIVATED = 908;

        CONSENSUS_NOTIFY_ACK = 999;
    }
    // The type of message, used to determine how to 'route' the message
    // to the appropriate handler as well as how to deserialize the
    // content.
    MessageType message_type = 1;

    // The identifier used to correlate response messages to their related
    // request messages.  correlation_id should be set to a random string
    // for messages which are not responses to previously sent messages.  For
    // response messages, correlation_id should be set to the same string as
    // contained in the request message.
    string correlation_id = 2;

    // The content of the message, defined by message_type.  In many
    // cases, this data has been serialized with Protocol Buffers or
    // CBOR.
    bytes content = 3;

}

src:./consensus.proto


// Copyright 2018 Intel Corporation
//
// 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";

// --== Data Structures ==--

message ConsensusPeerMessageHeader {
  // Public key for the component internal to the validator that
  // signed the message
  bytes signer_id = 1;

  // The sha512 hash of the encoded message
  bytes content_sha512 = 2;
  // Interpretation is left to the consensus engine implementation
  string message_type = 5;

  // Used to identify the consensus engine that produced this message
  string name = 3;
  string version = 4;
}

// A consensus-related message sent between peers
message ConsensusPeerMessage {
  // The serialized version of the ConsensusPeerMessageHeader
  bytes header = 1;

  // The signature derived from signing the header
  bytes header_signature = 3;

  // The opaque payload to send to other nodes
  bytes content = 2;
}

// All information about a block that is relevant to consensus
message ConsensusBlock {
  bytes block_id = 1;
  bytes previous_id = 2;
  // The id of peer that signed this block
  bytes signer_id = 3;
  uint64 block_num = 4;
  bytes payload = 5;
  // A summary of the contents of the block
  bytes summary = 6;
}

// Information about a peer that is relevant to consensus
message ConsensusPeerInfo {
  // The unique id for this peer. This can be correlated with the signer id
  // on consensus blocks.
  bytes peer_id = 1;
}

// A settings key-value pair
message ConsensusSettingsEntry {
  string key = 1;
  string value = 2;
}

// A state key-value pair
message ConsensusStateEntry {
  string address = 1;
  bytes data = 2;
}

// --== Registration ==--

// Sent to connect with the validator
message ConsensusRegisterRequest {
  message Protocol {
    string name = 1;
    string version = 2;
  }

  // The name of this consensus engine
  string name = 1;
  // The version of this consensus engine
  string version = 2;
  // Any additional name/version pairs the consensus engine supports
  repeated Protocol additional_protocols = 3;
}

message ConsensusRegisterResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;
  }

  Status status = 1;

  // Startup Info
  ConsensusBlock chain_head = 2;
  repeated ConsensusPeerInfo peers = 3;
  ConsensusPeerInfo local_peer_info = 4;
}

// --== Notifications ==--

// The following are notifications provided by the validator to the consensus
// engine. An ack should be sent in response to all notifications.

// - P2P -

// A new peer was added
message ConsensusNotifyPeerConnected {
  ConsensusPeerInfo peer_info = 1;
}

// An existing peer was dropped
message ConsensusNotifyPeerDisconnected {
  bytes peer_id = 1;
}

// A new message was received from a peer
message ConsensusNotifyPeerMessage {
  // The message sent
  ConsensusPeerMessage message = 1;
  // The node that sent the message, not necessarily the node that created it
  bytes sender_id = 2;
}

// - Blocks -

// A new block was received and passed initial consensus validation
message ConsensusNotifyBlockNew {
  ConsensusBlock block = 1;
}

// This block can be committed successfully
message ConsensusNotifyBlockValid {
  bytes block_id = 1;
}

// This block cannot be committed successfully
message ConsensusNotifyBlockInvalid {
  bytes block_id = 1;
}

// This block has been committed
message ConsensusNotifyBlockCommit {
  bytes block_id = 1;
}

// The engine has been activated
message ConsensusNotifyEngineActivated {
  // Startup Info
  ConsensusBlock chain_head = 1;
  repeated ConsensusPeerInfo peers = 2;
  ConsensusPeerInfo local_peer_info = 3;
}

// The engine has been deactivated
message ConsensusNotifyEngineDeactivated {}

// Confirm that the notification was received. The validator message
// correlation id is used to determine which notification this is an ack for.
message ConsensusNotifyAck {}

// --== Services Provided ==--

// The following are services provided by the validator to the consensus
// engine. All service messages have at a minimum the following possible return
// statuses:
//
//    STATUS_UNSET
//        No status was set by the validator, this should never happen
//    OK
//        The request was completed successfully
//    BAD_REQUEST
//        The request was malformed in some way
//    SERVICE_ERROR
//        The validator failed to perform the request
//    NOT_READY
//        The validator is not accepting requests, usually because it is still
//        starting up
//    NOT_ACTIVE_ENGINE
//        The consensus engine making the request is not the active engine
//
// Additionally, messages may have the following additional return statuses:
//
//    INVALID_STATE
//        The request is not valid given the current state of the validator
//    UNKNOWN_BLOCK
//        No block with the given id could be found
//    UNKNOWN_PEER
//        No peer with the given id could be found

// - P2P Messaging -

// Send a consensus message to a specific, connected peer
message ConsensusSendToRequest {
  // Payload to send to peer
  //
  // NOTE: This payload will be wrapped up in a ConsensusPeerMessage struct,
  // which includes computing its SHA-512 digest, inserting this engine's
  // registration info, and the validator's public key, and signing everything
  // with the validator's private key.
  bytes content = 1;
  string message_type = 3;

  // Peer that this message is destined for
  bytes receiver_id = 2;
}

message ConsensusSendToResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    UNKNOWN_PEER = 5;

    NOT_ACTIVE_ENGINE = 6;
  }
  Status status = 1;
}

// Broadcast a consensus message to all peers
message ConsensusBroadcastRequest {
  // Payload to broadcast peers
  //
  // NOTE: This payload will be wrapped up in a ConsensusPeerMessage struct,
  // which includes computing its SHA-512 digest, inserting this engine's
  // registration info, and the validator's public key, and signing everything
  // with the validator's private key.
  bytes content = 1;
  string message_type = 2;
}

message ConsensusBroadcastResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;
    NOT_ACTIVE_ENGINE = 5;
  }
  Status status = 1;
}

// - Block Creation -

// Initialize a new block built on the block with the given previous id and
// begin adding batches to it. If no previous id is specified, the current
// head will be used.
message ConsensusInitializeBlockRequest {
  bytes previous_id = 1;
}

message ConsensusInitializeBlockResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    INVALID_STATE = 5;
    UNKNOWN_BLOCK = 6;

    NOT_ACTIVE_ENGINE = 7;
  }
  Status status = 1;
}

// Stop adding batches to the current block and return a summary of its
// contents.
message ConsensusSummarizeBlockRequest {}

message ConsensusSummarizeBlockResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    INVALID_STATE = 5;
    BLOCK_NOT_READY = 6;

    NOT_ACTIVE_ENGINE = 7;
  }
  Status status = 1;

  // A summary of the block contents
  bytes summary = 2;
}

// Insert the given consensus data into the block and sign it. If this call is
// successful, the consensus engine will receive the block afterwards.
message ConsensusFinalizeBlockRequest {
  // The consensus data to include in the finalized block
  bytes data = 1;
}

message ConsensusFinalizeBlockResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    INVALID_STATE = 5;
    BLOCK_NOT_READY = 6;

    NOT_ACTIVE_ENGINE = 7;
  }
  Status status = 1;

  // The block id of the newly created block
  bytes block_id = 2;
}

// Stop adding batches to the current block and abandon it.
message ConsensusCancelBlockRequest {}

message ConsensusCancelBlockResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    INVALID_STATE = 5;

    NOT_ACTIVE_ENGINE = 6;
  }

  Status status = 1;
}

// - Block Directives -

// Request that, for each block block in order, the block is checked to
// determine whether the block can be committed successfully or not. Blocks
// may be checked in parallel. If a new request arrives, it overrides the
// previous request allowing the engine to reprioritize the list of blocks to
// check.
//
// NOTE: OK does not mean the blocks will all commit successfully, only that
// the directive was received successfully. The engine must listen for
// notifications from the consuming component to learn if the blocks would
// commit or not.
message ConsensusCheckBlocksRequest {
  repeated bytes block_ids = 1;
}

message ConsensusCheckBlocksResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    UNKNOWN_BLOCK = 5;

    NOT_ACTIVE_ENGINE = 6;
  }

  Status status = 1;
}

// Request that the block be committed. This request fails if the block has
// not already been checked.
//
// NOTE: OK does not mean the block has been committed, only that the directive
// was received successfully. The engine must listen for notifications from the
// consuming component to learn when the block commits.
message ConsensusCommitBlockRequest {
  bytes block_id = 1;
}

message ConsensusCommitBlockResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    UNKNOWN_BLOCK = 5;

    NOT_ACTIVE_ENGINE = 6;
  }

  Status status = 1;
}

// Inform the consuming component that this block is no longer being considered
// and can be held or freed as needed.
message ConsensusIgnoreBlockRequest {
  bytes block_id = 1;
}

message ConsensusIgnoreBlockResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    UNKNOWN_BLOCK = 5;

    NOT_ACTIVE_ENGINE = 6;
  }

  Status status = 1;
}

// Fail this block and any of its descendants and purge them as needed.
message ConsensusFailBlockRequest {
  bytes block_id = 1;
}

message ConsensusFailBlockResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    UNKNOWN_BLOCK = 5;

    NOT_ACTIVE_ENGINE = 6;
  }

  Status status = 1;
}

// - Queries -

// Retrieve consensus-related information about blocks. If some blocks could
// not be found, only the blocks that could be found will be returned.
message ConsensusBlocksGetRequest {
  repeated bytes block_ids = 1;
}

message ConsensusBlocksGetResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    UNKNOWN_BLOCK = 5;

    NOT_ACTIVE_ENGINE = 6;
  }

  Status status = 1;
  repeated ConsensusBlock blocks = 2;
}

// Retrieve consensus-related information about the chain head.
message ConsensusChainHeadGetRequest {}

message ConsensusChainHeadGetResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    NO_CHAIN_HEAD = 5;

    NOT_ACTIVE_ENGINE = 6;
  }

  Status status = 1;
  ConsensusBlock block = 2;
}

// Read the values of these settings from state as of the given block. If some
// values settings keys cannot be found, the keys that were found will be
// returned.
message ConsensusSettingsGetRequest {
  bytes block_id = 1;
  repeated string keys = 2;
}

message ConsensusSettingsGetResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    UNKNOWN_BLOCK = 5;

    NOT_ACTIVE_ENGINE = 6;
  }

  Status status = 1;
  repeated ConsensusSettingsEntry entries = 2;
}

// Read the data at these addresses from state as of the given block. If some
// addresses cannot be found, state at the addresses that were found will be
// returned.
message ConsensusStateGetRequest {
  bytes block_id = 1;
  repeated string addresses = 2;
}

message ConsensusStateGetResponse {
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    BAD_REQUEST = 2;
    SERVICE_ERROR = 3;
    NOT_READY = 4;

    UNKNOWN_BLOCK = 5;

    NOT_ACTIVE_ENGINE = 6;
  }

  Status status = 1;
  repeated ConsensusStateEntry entries = 2;
}

src:./client_batch_submit.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_batch_submit_pb2";

import "batch.proto";


// Information about the status of a batch submitted to the validator.
//
// Attributes:
//     batch_id: The id (header_signature) of the batch
//     status: The committed status of the batch
//     invalid_transactions: Info for transactions that failed, if any
//
// Statuses:
//     COMMITTED - the batch was accepted and has been committed to the chain
//     INVALID - the batch failed validation, it should be resubmitted
//     PENDING - the batch is still being processed
//     UNKNOWN - no status for the batch could be found (possibly invalid)
message ClientBatchStatus {
    enum Status {
        STATUS_UNSET = 0;
        COMMITTED = 1;
        INVALID = 2;
        PENDING = 3;
        UNKNOWN = 4;
    }
    message InvalidTransaction {
        string transaction_id = 1;
        string message = 2;
        bytes extended_data = 3;
    }
    string batch_id = 1;
    Status status = 2;
    repeated InvalidTransaction invalid_transactions = 3;
}

// Submits a list of Batches to be added to the blockchain.
message ClientBatchSubmitRequest {
    repeated Batch batches = 1;
}

// This is a response to a submission of one or more Batches.
// Statuses:
//   * OK - everything with the request worked as expected
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * INVALID_BATCH - the batch failed validation, likely due to a bad signature
//   * QUEUE_FULL - the batch is unable to be queued for processing, due to
//        a full processing queue.  The batch may be submitted again.
message ClientBatchSubmitResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        INVALID_BATCH = 3;
        QUEUE_FULL = 4;
    }
    Status status = 1;
}

// A request for the status of one or more batches, specified by id.
// If `wait` is set to true, the validator will wait to respond until all
// batches are committed, or until the specified `timeout` in seconds has
// elapsed. Defaults to 300.
message ClientBatchStatusRequest {
    repeated string batch_ids = 1;
    bool wait = 2;
    uint32 timeout = 3;
}

// This is a response to a request for the status of specific batches.
// Statuses:
//   * OK - everything with the request worked as expected
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * NO_RESOURCE - the response contains no data, likely because
//     no ids were specified in the request
message ClientBatchStatusResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        NO_RESOURCE = 5;
        INVALID_ID = 8;
    }
    Status status = 1;
    repeated ClientBatchStatus batch_statuses = 2;
}

src:./client_block.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_block_pb2";

import "block.proto";
import "client_list_control.proto";


// A request to return a list of blocks from the validator. May include the id
// of a particular block to be the `head` of the chain being requested. In that
// case the list will include that block (if found), and all blocks previous
// to it on the chain. Can be filtered using specific `block_ids`.
message ClientBlockListRequest {
    string head_id = 1;
    repeated string block_ids = 2;
    ClientPagingControls paging = 3;
    repeated ClientSortControls sorting = 4;
}

// A response that lists a chain of blocks with the newest at the beginning,
// and the oldest (genesis) block at the end.
//
// Statuses:
//   * OK - everything worked as expected
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * NOT_READY - the validator does not yet have a genesis block
//   * NO_ROOT - the head block specified was not found
//   * NO_RESOURCE - no blocks were found with the parameters specified
//   * INVALID_PAGING - the paging controls were malformed or out of range
//   * INVALID_SORT - the sorting controls were malformed or invalid
message ClientBlockListResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        NOT_READY = 3;
        NO_ROOT = 4;
        NO_RESOURCE = 5;
        INVALID_PAGING = 6;
        INVALID_SORT = 7;
        INVALID_ID = 8;
    }
    Status status = 1;
    repeated Block blocks = 2;
    string head_id = 3;
    ClientPagingResponse paging = 4;
}

// A request to return a specific block from the validator. The block must be
// specified by its unique id, in this case the block's header signature
message ClientBlockGetByIdRequest {
    string block_id = 1;
}

// A request to return a specific block from the validator. The block must be
// specified by its block number
message ClientBlockGetByNumRequest {
    uint64 block_num = 1;
}

// A request to return a specific block from the validator. The block
// containing the given transaction is returned. If no block on the current
// chain contains the transaction, NO_RESOURCE is returned.
message ClientBlockGetByTransactionIdRequest {
    string transaction_id = 1;
}

// A request to return a specific block from the validator. The block
// containing the given batch is returned. If no block on the current chain
// contains the batch, NO_RESOURCE is returned.
message ClientBlockGetByBatchIdRequest {
    string batch_id = 1;
}

// A response that returns the block specified by a ClientBlockGetByIdRequest
// or  ClientBlockGetByNumRequest.
//
// Statuses:
//   * OK - everything worked as expected
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * NO_RESOURCE - no block with the specified id exists
message ClientBlockGetResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        NO_RESOURCE = 5;
        INVALID_ID = 8;
    }
    Status status = 1;
    Block block = 2;
}

src:./processor.proto


// Copyright 2016 Intel Corporation
//
// 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";
option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "processor_pb2";

import "transaction.proto";


// The registration request from the transaction processor to the
// validator/executor.
//
// The protocol_version field is used to check if the validator supports
// requested features by a transaction processor.
// Following are the versions supported:
//     1    Transaction processor can request for either raw header bytes or
//          deserialized TransactionHeader field in the TpProcessRequest
//          message. The default option is set to send deserialized
//          TransactionHeader.
message TpRegisterRequest {
    // enum used to fill in transaction header field in TpProcessRequest.
    // This field can be set before transaction processor registers with
    // validator.
    enum TpProcessRequestHeaderStyle {
        HEADER_STYLE_UNSET = 0;
        EXPANDED = 1;
        RAW = 2;
    }

    // A settled upon name for the capabilities of the transaction processor.
    // For example: intkey, xo
    string family = 1;

    // The version supported.  For example:
    //      1.0  for version 1.0
    //      2.1  for version 2.1
    string version = 2;

    // The namespaces this transaction processor expects to interact with
    // when processing transactions matching this specification; will be
    // enforced by the state API on the validator.
    repeated string namespaces = 4;

    // The maximum number of transactions that this transaction processor can
    // handle at once.
    uint32 max_occupancy = 5;

    // Validator can make use of this field to check if the requested features
    // are supported. Registration requests can be either accepted or rejected
    // based on this field.
    uint32 protocol_version = 6;

    // Setting it to RAW, validator would fill in serialized transaction header
    // when sending TpProcessRequest to the transaction processor.
    TpProcessRequestHeaderStyle request_header_style = 7;
}

// A response sent from the validator to the transaction processor
// acknowledging the registration
message TpRegisterResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        ERROR = 2;
    }

    Status status = 1;

    // Respond back with protocol_version, the value that can be used by SDK to
    // know if validator supports expected feature.
    uint32 protocol_version = 2;
}

// The unregistration request from the transaction processor to the
// validator/executor. The correct handlers are determined from the
// zeromq identity of the tp, on the validator side.
message TpUnregisterRequest {

}

// A response sent from the validator to the transaction processor
// acknowledging the unregistration
message TpUnregisterResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        ERROR = 2;
    }

    Status status = 1;
}


// The request from the validator/executor of the transaction processor
// to verify a transaction.
message TpProcessRequest {
    // The de-serialized transaction header from client request
    TransactionHeader header = 1;

    // The transaction payload
    bytes payload = 2;

    // The transaction header_signature
    string signature = 3;

    // The context_id for state requests.
    string context_id = 4;

    // The serialized header as received by client.
    // Controlled by a flag during transaction processor registration.
    bytes header_bytes = 5;
}


// The response from the transaction processor to the validator/executor
// used to respond about the validity of a transaction
message TpProcessResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INVALID_TRANSACTION = 2;
        INTERNAL_ERROR = 3;
    }

    Status status = 1;

    // A message to include on responses in the cases where
    // status is either INVALID_TRANSACTION or INTERNAL_ERROR
    string message = 2;

    // Information that may be included with the response.
    // This information is an opaque, application-specific encoded block of
    // data that will be propagated back to the transaction submitter.
    bytes extended_data = 3;
}

src:./client_transaction.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_transaction_pb2";

import "transaction.proto";
import "client_list_control.proto";


// A request to return a list of txns from the validator. May include the id
// of a particular block to be the `head` of the chain being requested. In that
// case the list will include the txns from that block, and all txns
// previous to that block on the chain. Filter with specific `transaction_ids`.
message ClientTransactionListRequest {
    string head_id = 1;
    repeated string transaction_ids = 2;
    ClientPagingControls paging = 3;
    repeated ClientSortControls sorting = 4;
}

// A response that lists transactions from newest to oldest.
//
// Statuses:
//   * OK - everything worked as expected
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * NOT_READY - the validator does not yet have a genesis block
//   * NO_ROOT - the head block specified was not found
//   * NO_RESOURCE - no txns were found with the parameters specified
//   * INVALID_PAGING - the paging controls were malformed or out of range
//   * INVALID_SORT - the sorting controls were malformed or invalid
message ClientTransactionListResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        NOT_READY = 3;
        NO_ROOT = 4;
        NO_RESOURCE = 5;
        INVALID_PAGING = 6;
        INVALID_SORT = 7;
        INVALID_ID = 8;
    }
    Status status = 1;
    repeated Transaction transactions = 2;
    string head_id = 3;
    ClientPagingResponse paging = 4;
}

// Fetches a specific txn by its id (header_signature) from the blockchain.
message ClientTransactionGetRequest {
    string transaction_id = 1;
}

// A response that returns the txn specified by a ClientTransactionGetRequest.
//
// Statuses:
//   * OK - everything worked as expected, txn has been fetched
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * NO_RESOURCE - no txn with the specified id exists
message ClientTransactionGetResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        NO_RESOURCE = 5;
        INVALID_ID = 8;
    }
    Status status = 1;
    Transaction transaction = 2;
}

src:./client_list_control.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_list_control_pb2";

// Paging controls to be sent with List requests.
// Attributes:
//     start: The id of a resource to start the page with
//     limit: The number of results per page, defaults to 100 and maxes out at 1000
message ClientPagingControls {
    string start = 1;
    int32 limit = 2;
}

// Information about the pagination used, sent back with List responses.
// Attributes:
//     next: The id of the first resource in the next page
//     start: The id of the first resource in the returned page
//     limit: The number of results per page, defaults to 100 and maxes out at 1000
message ClientPagingResponse {
    string next = 1;
    string start = 2;
    int32 limit = 3;

}

// Sorting controls to be sent with List requests. More than one can be sent.
// If so, the first is used, and additional controls are tie-breakers.
// Attributes:
//     keys: Nested set of keys to sort by (i.e. ['default, block_num'])
//     reverse: Whether or not to reverse the sort (i.e. descending order)
message ClientSortControls {
    repeated string keys = 1;
    bool reverse = 2;
}

src:./batch.proto


// Copyright 2016 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "batch_pb2";

import "transaction.proto";

message BatchHeader {
    // Public key for the client that signed the BatchHeader
    string signer_public_key = 1;

    // List of transaction.header_signatures that match the order of
    // transactions required for the batch
    repeated string transaction_ids = 2;
}

message Batch {
    // The serialized version of the BatchHeader
    bytes header = 1;

    // The signature derived from signing the header
    string header_signature = 2;

    // A list of the transactions that match the list of
    // transaction_ids listed in the batch header
    repeated Transaction transactions = 3;

    // A debugging flag which indicates this batch should be traced through the
    // system, resulting in a higher level of debugging output.
    bool trace = 4;
}

message BatchList {
    repeated Batch batches = 1;
}

src:./events.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "events_pb2";


message Event {
  // Used to subscribe to events and servers as a hint for how to deserialize
  // event_data and what pairs to expect in attributes.
  string event_type = 1;

  // Transparent data defined by the event_type.
  message Attribute {
    string key = 1;
    string value = 2;
  }
  repeated Attribute attributes = 2;

  // Opaque data defined by the event_type.
  bytes  data = 3;
}

message EventList {
    repeated Event events = 1;
}

message EventFilter {
    // EventFilter is used when subscribing to events to limit the events
    // received within a given event type. See
    // validator/server/events/subscription.py for further explanation.
    string key = 1;
    string match_string = 2;

    enum FilterType {
      FILTER_TYPE_UNSET = 0;
      SIMPLE_ANY = 1;
      SIMPLE_ALL = 2;
      REGEX_ANY  = 3;
      REGEX_ALL  = 4;
    }
    FilterType filter_type = 3;
}

message EventSubscription {
    // EventSubscription is used when subscribing to events to specify the type
    // of events being subscribed to, along with any additional filters. See
    // validator/server/events/subscription.py for further explanation.
    string event_type = 1;
    repeated EventFilter filters = 2;
}

src:./identity.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.identity.protobuf";

message Policy {

  enum EntryType {
    ENTRY_TYPE_UNSET = 0;
    PERMIT_KEY = 1;
    DENY_KEY = 2;
  }

  message Entry {
    // Whether this is a Permit_KEY or Deny_KEY entry
    EntryType type = 1;

    // This should be a public key or * to refer to all participants.
    string  key = 2;
  }

  // name of the policy, this should be unique.
  string name = 1;

  // list of Entries
  // The entries will be processed in order from first to last.
  repeated Entry entries = 2;
}

// Policy will be stored in a Policy list to account for state collisions
message PolicyList {
  repeated Policy policies = 1;
}


message Role {
  // Role name
  string name = 1;

  // Name of corresponding policy
  string policy_name = 2;
}

// Roles will be stored in a RoleList to account for state collisions
message RoleList {
  repeated Role roles = 1;
}

src:./block.proto


// Copyright 2016 Intel Corporation
//
// 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";
option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "block_pb2";

import "batch.proto";

message BlockHeader {
    // Block number in the chain
    uint64 block_num = 1;

    // The header_signature of the previous block that was added to the chain.
    string previous_block_id = 2;

    // Public key for the component internal to the validator that
    // signed the BlockHeader
    string signer_public_key = 3;

    // List of batch.header_signatures that match the order of batches
    // required for the block
    repeated string batch_ids = 4;

    // Bytes that are set and verified by the consensus algorithm used to
    // create and validate the block
    bytes consensus = 5;

    // The state_root_hash should match the final state_root after all
    // transactions in the batches have been applied, otherwise the block
    // is not valid
    string state_root_hash = 6;
}

message Block {
    // The serialized version of the BlockHeader
    bytes header = 1;

    // The signature derived from signing the header
    string header_signature = 2;

    // A list of batches. The batches may contain new batches that other
    // validators may not have received yet, or they will be all batches needed
    // for block validation when passed to the journal
    repeated Batch batches = 3;
}

src:./client_state.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_state_pb2";

import "client_list_control.proto";


// A request to list every entry in global state. Defaults to the most current
// tree, but can fetch older state by specifying a state root. Results can be
// further filtered by specifying a subtree with a partial address.
message ClientStateListRequest {
    string state_root = 1;
    string address = 3;
    ClientPagingControls paging = 4;
    repeated ClientSortControls sorting = 5;
}

// A response that lists the data Entries from global state, filtered by state
// root or subtree address according to the request. Returns the state root
// used to facilitate future requests.
//
// Statuses:
//   * OK - everything worked as expected
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * NOT_READY - the validator does not yet have a genesis block
//   * NO_ROOT - the head block or merkle_root specified was not found
//   * NO_RESOURCE - the head/root specified is valid, but contains no data
//   * INVALID_PAGING - the paging controls were malformed or out of range
//   * INVALID_SORT - the sorting controls were malformed or invalid

message ClientStateListResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        NOT_READY = 3;
        NO_ROOT = 4;
        NO_RESOURCE = 5;
        INVALID_PAGING = 6;
        INVALID_SORT = 7;
        INVALID_ADDRESS = 8;
        INVALID_ROOT = 9;
    }

    // An entry in the State
    message Entry {
        string address = 1;
        bytes data = 2;
    }

    Status status = 1;
    repeated Entry entries = 2;
    string state_root = 3;
    ClientPagingResponse paging = 4;
}

// A request from a client for a particular entry in global state.
// Like State List, it defaults to the newest state, but a state root
// can be used to specify older data. Unlike State List the request must be
// provided with a full address that corresponds to a single entry.
message ClientStateGetRequest {
    string state_root = 1;
    string address = 3;
}

// The response to a State Get Request from the client. Sends back just
// the data stored at the entry, not the address. Also sends back the
// head block id used to facilitate further requests.
//
// Statuses:
//   * OK - everything worked as expected
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * NOT_READY - the validator does not yet have a genesis block
//   * NO_ROOT - the state_root specified was not found
//   * NO_RESOURCE - the address specified doesn't exist
//   * INVALID_ADDRESS - address isn't a valid, i.e. it's a subtree (truncated)
message ClientStateGetResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        NOT_READY = 3;
        NO_ROOT = 4;
        NO_RESOURCE = 5;
        INVALID_ADDRESS = 6;
        INVALID_ROOT = 7;
    }
    Status status = 1;
    bytes value = 2;
    string state_root = 3;
}

src:./client_event.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_event_pb2";

import "events.proto";


message ClientEventsSubscribeRequest {
    repeated EventSubscription subscriptions = 1;
    // The block id (or ids, if trying to walk back a fork) the subscriber last
    // received events on. It can be set to empty if it has not yet received the
    // genesis block.
    repeated string last_known_block_ids = 2;
}

message ClientEventsSubscribeResponse {
    enum Status {
         STATUS_UNSET = 0;
         OK = 1;
         INVALID_FILTER = 2;
         UNKNOWN_BLOCK = 3;
    }
    Status status = 1;
    // Additional information about the response status
    string response_message = 2;
}

message ClientEventsUnsubscribeRequest {}

message ClientEventsUnsubscribeResponse {
    enum Status {
         STATUS_UNSET = 0;
         OK = 1;
         INTERNAL_ERROR = 2;
    }
    Status status = 1;
}

message ClientEventsGetRequest {
    repeated EventSubscription subscriptions = 1;
    repeated string block_ids = 2;
}

message ClientEventsGetResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        INVALID_FILTER = 3;
        UNKNOWN_BLOCK = 4;
    }
    Status status = 1;
    repeated Event events = 2;

}

src:./state_context.proto


// Copyright 2016 Intel Corporation
//
// 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";
option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "state_context_pb2";

import "events.proto";

// An entry in the State
message TpStateEntry {
    string address = 1;
    bytes data = 2;
}

// A request from a handler/tp for the values at a series of addresses
message TpStateGetRequest {
    // The context id that references a context in the contextmanager
    string context_id = 1;
    repeated string addresses = 2;
}

// A response from the contextmanager/validator with a series of State entries
message TpStateGetResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        AUTHORIZATION_ERROR = 2;
    }

    repeated TpStateEntry entries = 1;
    Status status = 2;
}

// A request from the handler/tp to put entries in the state of a context
message TpStateSetRequest {
    string context_id = 1;
    repeated TpStateEntry entries = 2;
}

// A response from the contextmanager/validator with the addresses that were set
message TpStateSetResponse {
  enum Status {
      STATUS_UNSET = 0;
      OK = 1;
      AUTHORIZATION_ERROR = 2;
  }

    repeated string addresses = 1;
    Status status = 2;
}

// A request from the handler/tp to delete state entries at an collection of addresses
message TpStateDeleteRequest {
    string context_id = 1;
    repeated string addresses = 2;
}

// A response form the contextmanager/validator with the addresses that were deleted
message TpStateDeleteResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        AUTHORIZATION_ERROR = 2;
    }

    repeated string addresses = 1;
    Status status = 2;
}

// The request from the transaction processor to the validator append data
// to a transaction receipt
message TpReceiptAddDataRequest {
    // The context id that references a context in the context manager
    string context_id = 1;
    bytes data = 3;
}

// The response from the validator to the transaction processor to verify that
// data has been appended to a transaction receipt
message TpReceiptAddDataResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        ERROR = 2;
    }

    Status status = 2;
}

message TpEventAddRequest {
    string context_id = 1;
    Event event = 2;
}

message TpEventAddResponse {
    enum Status {
      STATUS_UNSET = 0;
      OK = 1;
      ERROR = 2;
    }
    Status status = 2;
}

src:./setting.proto


// Copyright 2017 Intel Corporation
//
// 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";
option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "setting_pb2";


// Setting Container for on-chain configuration key/value pairs
message Setting {
    // Contains a setting entry (or entries, in the case of collisions).
    message Entry {
        string key = 1;
        string value = 2;
    }

    // List of setting entries - more than one implies a state key collision
    repeated Entry entries = 1;
}

src:./block_info.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.block_info.protobuf";
option go_package = "block_info_pb2";

message BlockInfoConfig {
    uint64 latest_block = 1;
    uint64 oldest_block = 2;
    uint64 target_count = 3;
    uint64 sync_tolerance = 4;
}

message BlockInfo {
    // Block number in the chain
    uint64 block_num = 1;
    // The header_signature of the previous block that was added to the chain.
    string previous_block_id = 2;
    // Public key for the component internal to the validator that
    // signed the BlockHeader
    string signer_public_key = 3;
    // The signature derived from signing the header
    string header_signature = 4;
    // Approximately when this block was committed, as a Unix UTC timestamp
    uint64 timestamp = 5;
}

message BlockInfoTxn {
    // The new block to add to state
    BlockInfo block = 1;
    // If this is set, the new target number of blocks to store in state
    uint64 target_count = 2;
    // If set, the new network time synchronization tolerance.
    uint64 sync_tolerance = 3;
}

src:./transaction_receipt.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "txn_receipt_pb2";

import "events.proto";


message TransactionReceipt {
  // State changes made by this transaction
  // StateChange is defined in protos/transaction_receipt.proto
  repeated StateChange state_changes = 1;
  // Events fired by this transaction
  repeated Event events = 2;
  // Transaction family defined data
  repeated bytes data = 3;

  string transaction_id = 4;
}

//  StateChange objects have the type of SET, which is either an insert or
//  update, or DELETE. Items marked as a DELETE will have no byte value.
message StateChange {
    enum Type {
        TYPE_UNSET = 0;
        SET = 1;
        DELETE = 2;
    }
    string address = 1;
    bytes value = 2;
    Type type = 3;
}

// A collection of state changes.
message StateChangeList {
    repeated StateChange state_changes = 1;
}

src:./client_batch.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_batch_pb2";

import "batch.proto";
import "client_list_control.proto";


// A request to return a list of batches from the validator. May include the id
// of a particular block to be the `head` of the chain being requested. In that
// case the list will include the batches from that block, and all batches
// previous to that block on the chain. Filter with specific `batch_ids`.
message ClientBatchListRequest {
    string head_id = 1;
    repeated string batch_ids = 2;
    ClientPagingControls paging = 3;
    repeated ClientSortControls sorting = 4;
}

// A response that lists batches from newest to oldest.
//
// Statuses:
//   * OK - everything worked as expected
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * NOT_READY - the validator does not yet have a genesis block
//   * NO_ROOT - the head block specified was not found
//   * NO_RESOURCE - no batches were found with the parameters specified
//   * INVALID_PAGING - the paging controls were malformed or out of range
//   * INVALID_SORT - the sorting controls were malformed or invalid
message ClientBatchListResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        NOT_READY = 3;
        NO_ROOT = 4;
        NO_RESOURCE = 5;
        INVALID_PAGING = 6;
        INVALID_SORT = 7;
        INVALID_ID = 8;
    }
    Status status = 1;
    repeated Batch batches = 2;
    string head_id = 3;
    ClientPagingResponse paging = 4;
}

// Fetches a specific batch by its id (header_signature) from the blockchain.
message ClientBatchGetRequest {
    string batch_id = 1;
}

// A response that returns the batch specified by a ClientBatchGetRequest.
//
// Statuses:
//   * OK - everything worked as expected, batch has been fetched
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * NO_RESOURCE - no batch with the specified id exists
message ClientBatchGetResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        NO_RESOURCE = 5;
        INVALID_ID = 8;
    }
    Status status = 1;
    Batch batch = 2;
}

src:./authorization.proto


// Copyright 2017 Intel Corporation
//
// 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";
option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "authorization_pb2";

message ConnectionRequest {
  // This is the first message that must be sent to start off authorization.
  // The endpoint of the connection.
  string endpoint = 1;
}

enum RoleType {
  ROLE_TYPE_UNSET = 0;

  // A shorthand request for asking for all allowed roles.
  ALL = 1;

  // Role defining validator to validator communication
  NETWORK = 2;
}

message ConnectionResponse {
  // Whether the connection can participate in authorization
  enum Status {
    STATUS_UNSET = 0;
    OK = 1;
    ERROR = 2;
  }

  //Authorization Type required for the authorization procedure
  enum AuthorizationType {
    AUTHORIZATION_TYPE_UNSET = 0;
    TRUST = 1;
    CHALLENGE = 2;
  }

  message RoleEntry {
    // The role type for this role entry
    RoleType role = 1;

    // The Authorization Type required for the above role
    AuthorizationType auth_type = 2;
  }

  repeated RoleEntry roles = 1;
  Status status = 2;
}

message AuthorizationTrustRequest {
  // A set of requested RoleTypes
  repeated RoleType roles = 1;
  string public_key = 2;
}

message AuthorizationTrustResponse {
  // The actual set the requester has access to
  repeated RoleType roles = 1;
}

message AuthorizationViolation {
  // The Role the requester did not have access to
  RoleType violation = 1;
}

message AuthorizationChallengeRequest {
  // Empty message sent to request a payload to sign
}

message AuthorizationChallengeResponse {
  // Random payload that the connecting node must sign
  bytes payload = 1;
}

message AuthorizationChallengeSubmit {
  // public key of node
  string public_key = 1;

  // signature derived from signing the challenge payload
  string signature = 3;

  // A set of requested Roles
  repeated RoleType roles = 4;
}

message AuthorizationChallengeResult {
  // The approved roles for that connection
  repeated RoleType roles = 1;
}

src:./genesis.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "genesis_pb2";

import "batch.proto";

message GenesisData {
    // The list of batches that will be applied during the genesis process
    repeated Batch batches = 1;
}

src:./merkle.proto


// Copyright 2018 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "merkle_pb2";

// An Entry in the change log for a given state root.
message ChangeLogEntry {
    // A state root that succeed this root.
    message Successor {
        // A root hash of a merkle trie based of off this root.
        bytes successor = 1;

        // The keys (i.e. hashes) that were replaced (i.e. deleted) by this
        // successor.  These may be deleted during pruning.
        repeated bytes deletions = 2;
    }

    // A root hash of a merkle trie this tree was based off.
    bytes parent = 1;

    // The hashes that were added for this root. These may be deleted during
    // pruning, if this root is being abandoned.
    repeated bytes additions = 2;

    // The list of successors.
    repeated Successor successors = 3;
}

src:./network.proto


// Copyright 2016, 2017 Intel Corporation
//
// 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";
option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "network_pb2";

// The disconnect message from a client to the server
message DisconnectMessage {
}

// The registration request from a peer to the validator
message PeerRegisterRequest {
    string endpoint = 1;
    // The current version of the network protocol that is being used by the
    // sender.  This version is an increasing value.
    uint32 protocol_version = 2;
}

// The unregistration request from a peer to the validator
message PeerUnregisterRequest {
}

message GetPeersRequest {
}

message GetPeersResponse {
    repeated string peer_endpoints = 1;
}

message PingRequest {
}

message PingResponse{
}

message GossipMessage {
    enum ContentType{
        CONTENT_TYPE_UNSET = 0;
        BLOCK = 1;
        BATCH = 2;
        CONSENSUS = 3;
    }
    bytes content = 1;
    ContentType content_type = 2;
    uint32 time_to_live = 3;
}

// A response sent from the validator to the peer acknowledging message
// receipt
message NetworkAcknowledgement {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        ERROR = 2;
    }

    Status status = 1;
}

message GossipBlockRequest {
    // The id of the block that is being requested
    string block_id = 1;

    // A random string that provides uniqueness for requests with
    // otherwise identical fields.
    string nonce = 2;
    uint32 time_to_live = 3;

}

message GossipBlockResponse {
    // The block
    bytes content = 1;
}

message GossipBatchResponse {
    //The batch
    bytes content = 1;
}

message GossipBatchByBatchIdRequest {
    // The id of the batch that is being requested
    string id = 1;

    // A random string that provides uniqueness for requests with
    // otherwise identical fields.
    string nonce = 2;
    uint32 time_to_live = 3;

}

message GossipBatchByTransactionIdRequest {
    // The id's of the transaction that are in the batches requested
    repeated string ids = 1;

    // A random string that provides uniqueness for requests with
    // otherwise identical fields.
    string nonce = 2;
    uint32 time_to_live = 3;

}

src:./client_peers.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_peer";

message ClientPeersGetRequest{
}

message ClientPeersGetResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        ERROR = 2;
    }
    Status status = 1;
    repeated string peers = 2;
}

src:./client_receipt.proto


// Copyright 2017 Intel Corporation
//
// 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";

option java_multiple_files = true;
option java_package = "sawtooth.sdk.protobuf";
option go_package = "client_receipt_pb2";

import "transaction_receipt.proto";

// Fetches a specific txn by its id (header_signature) from the blockchain.
message ClientReceiptGetRequest {
    repeated string transaction_ids = 1;
}

// A response that returns the txn receipt specified by a
// ClientTransactionReceiptGetRequest.
//
// Statuses:
//   * OK - everything worked as expected, txn receipt has been fetched
//   * INTERNAL_ERROR - general error, such as protobuf failing to deserialize
//   * NO_RESOURCE - no receipt exists for the transaction id specified
message ClientReceiptGetResponse {
    enum Status {
        STATUS_UNSET = 0;
        OK = 1;
        INTERNAL_ERROR = 2;
        NO_RESOURCE = 5;
        INVALID_ID = 8;
    }
    Status status = 1;
    repeated TransactionReceipt receipts = 2;
}