HyperLedger Burrow

TOC

如何生成 Google Protocol Buffers 文件

burrow/protobuf at master · hyperledger/burrow

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

Generated Date:2019-09-12T14:23:17+08:00

Protocol Documentation

Table of Contents

Top

balance.proto

Balance

FieldTypeLabelDescription
Typeuint32
Amountuint64

Top

exec.proto

BeginBlock

FieldTypeLabelDescription
Heightuint64The height of this block
Headertypes.Header

BeginTx

FieldTypeLabelDescription
TxHeaderTxHeader
ResultResultResult of tx execution
Exceptionerrors.ExceptionIf tx execution was an exception

BlockExecution

FieldTypeLabelDescription
Heightuint64The height of this block
Headertypes.Header
TxExecutionsTxExecutionrepeated

CallData

FieldTypeLabelDescription
Callerbytes
Calleebytes
Databytes
Valueuint64
Gasuint64

CallEvent

FieldTypeLabelDescription
CallTypeuint32
CallDataCallData
Originbytes
StackDepthuint64
Returnbytes

EndBlock

FieldTypeLabelDescription
Heightuint64

EndTx

FieldTypeLabelDescription
TxHashbytesThe hash of the transaction that caused this event to be generated

Event

FieldTypeLabelDescription
HeaderHeader
InputInputEvent
OutputOutputEvent
CallCallEvent
LogLogEvent
GovernAccountGovernAccountEvent

GovernAccountEvent

FieldTypeLabelDescription
AccountUpdatespec.TemplateAccount

Header

FieldTypeLabelDescription
TxTypeuint32Transaction type
TxHashbytesThe hash of the transaction that caused this event to be generated
EventTypeuint32The type of event
EventIDstringEventID published with event
Heightuint64The block height at which this event was emitted
Indexuint64The index of this event relative to other events generated by the same transaction
Exceptionerrors.ExceptionIf event is exception

InputEvent

FieldTypeLabelDescription
Addressbytes

LogEvent

FieldTypeLabelDescription
Addressbytes
Databytes
Topicsbytesrepeated

Origin

FieldTypeLabelDescription
ChainIDstringThe original ChainID from for this transaction
Heightuint64The original height at which this transaction was committed
Indexuint64The original index in the block
Timegoogle.protobuf.TimestampThe original block time for this transaction

OutputEvent

FieldTypeLabelDescription
Addressbytes

Result

Could structure this further if needed - sum type of various results relevant to different transaction types

FieldTypeLabelDescription
ReturnbytesEVM execution return
GasUseduint64Gas used in computation
NameEntrynames.EntryName entry created
PermArgspermission.PermArgsPermission update performed

StreamEvent

FieldTypeLabelDescription
BeginBlockBeginBlock
BeginTxBeginTx
Envelopetxs.Envelope
EventEvent
EndTxEndTx
EndBlockEndBlock

StreamEvents

This message exists purely for framing []StreamEvent

FieldTypeLabelDescription
StreamEventsStreamEventrepeated

TxExecution

FieldTypeLabelDescription
HeaderTxHeader
Envelopetxs.EnvelopeSigned Tx that triggered this execution
EventsEventrepeatedExecution events
ResultResultThe execution results
Receipttxs.ReceiptThe transaction receipt
Exceptionerrors.ExceptionIf execution was an exception
TxExecutionsTxExecutionrepeatedA proposal may contain other transactions

TxExecutionKey

FieldTypeLabelDescription
Heightuint64The block height
Offsetuint64The offset of the TxExecution in bytes

TxHeader

FieldTypeLabelDescription
TxTypeuint32Transaction type
TxHashbytesThe hash of the transaction that caused this event to be generated
Heightuint64The block height at which this Tx was included
Indexuint64The index of this transaction within the block
OriginOriginThe origin information from the chain on which this tx was originally committed (if restored or otherwise imported)

Top

names.proto

Entry

NameReg provides a global key value store based on Name, Data pairs that are subject to expiry and ownership by an account.

FieldTypeLabelDescription
Namestringregistered name for the entry
Ownerbytesaddress that created the entry
Datastringdata to store under this name
Expiresuint64block at which this entry expires

Top

encoding.proto

TestMessage

For testing

FieldTypeLabelDescription
Typeuint32
Amountuint64

Top

validator.proto

Validator

FieldTypeLabelDescription
Addressbytes
PublicKeycrypto.PublicKey
Poweruint64

Top

txs.proto

Envelope

An envelope contains both the signable Tx and the signatures for each input (in signatories)

FieldTypeLabelDescription
SignatoriesSignatoryrepeated
TxbytesCanonical bytes of the Tx ready to be signed

Receipt

BroadcastTx or Transaction receipt

FieldTypeLabelDescription
TxTypeuint32Transaction type
TxHashbytesThe hash of the transaction that caused this event to be generated
CreatesContractboolWhether the transaction creates a contract
ContractAddressbytesThe address of the contract being called

Signatory

Signatory contains signature and one or both of Address and PublicKey to identify the signer

FieldTypeLabelDescription
Addressbytes
PublicKeycrypto.PublicKey
Signaturecrypto.Signature

Top

rpctransact.proto

CallCodeParam

FieldTypeLabelDescription
FromAddressbytes
Codebytes
Databytes

TxEnvelope

FieldTypeLabelDescription
Envelopetxs.Envelope

TxEnvelopeParam

FieldTypeLabelDescription
Envelopetxs.EnvelopeAn existing Envelope - either signed or unsigned - if the latter will be signed server-side
Payloadpayload.AnyIf no Envelope provided then one will be generated from the provided payload and signed server-side
Timeoutgoogle.protobuf.DurationThe amount of time to wait for the transaction to be committed and the TxExecution to be returned (server-side). If zero there wait is unbounded. Timed out transactions return SyncInfo state that may be helpful debugging non-committed transactions - this timeout must be less than client timeout to see such information!

Transact

Transaction Service Definition

Method NameRequest TypeResponse TypeDescription
BroadcastTxSyncTxEnvelopeParam.exec.TxExecutionBroadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side and wait for it to be included in block
BroadcastTxAsyncTxEnvelopeParam.txs.ReceiptBroadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side
SignTxTxEnvelopeParamTxEnvelopeSign transaction server-side
FormulateTx.payload.AnyTxEnvelopeFormulate a transaction from a Payload and retrun the envelop with the Tx bytes ready to sign
CallTxSync.payload.CallTx.exec.TxExecutionFormulate and sign a CallTx transaction signed server-side and wait for it to be included in a block, retrieving response
CallTxAsync.payload.CallTx.txs.ReceiptFormulate and sign a CallTx transaction signed server-side
CallTxSim.payload.CallTx.exec.TxExecutionPerform a 'simulated' call of a contract against the current committed EVM state without any changes been saved and wait for the transaction to be included in a block
CallCodeSimCallCodeParam.exec.TxExecutionPerform a 'simulated' execution of provided code against the current committed EVM state without any changes been saved
SendTxSync.payload.SendTx.exec.TxExecutionFormulate a SendTx transaction signed server-side and wait for it to be included in a block, retrieving response
SendTxAsync.payload.SendTx.txs.ReceiptFormulate and SendTx transaction signed server-side
NameTxSync.payload.NameTx.exec.TxExecutionFormualte a NameTx signed server-side and wait for it to be included in a block returning the registered name
NameTxAsync.payload.NameTx.txs.ReceiptFormulate a NameTx signed server-side

Top

github.com/tendermint/tendermint/abci/types/types.proto

BlockGossip

BlockGossip determine consensus critical elements of how blocks are gossiped

FieldTypeLabelDescription
block_part_size_bytesint32Note: must not be 0

BlockID

FieldTypeLabelDescription
hashbytes
parts_headerPartSetHeader

BlockSize

BlockSize contains limits on the block size.

FieldTypeLabelDescription
max_bytesint32
max_gasint64

ConsensusParams

ConsensusParams contains all consensus-relevant parameters that can be adjusted by the abci app

FieldTypeLabelDescription
block_sizeBlockSize
tx_sizeTxSize
block_gossipBlockGossip

Evidence

FieldTypeLabelDescription
typestring
validatorValidator
heightint64
timegoogle.protobuf.Timestamp
total_voting_powerint64

Header

FieldTypeLabelDescription
chain_idstringbasic block info
heightint64
timegoogle.protobuf.Timestamp
num_txsint64
total_txsint64
last_block_idBlockIDprev block info
last_commit_hashbyteshashes of block data

commit from validators from the last block | | data_hash | bytes | | transactions | | validators_hash | bytes | | hashes from the app output from the prev block

validators for the current block | | next_validators_hash | bytes | | validators for the next block | | consensus_hash | bytes | | consensus params for current block | | app_hash | bytes | | state after txs from the previous block | | last_results_hash | bytes | | root hash of all results from the txs from the previous block | | evidence_hash | bytes | | consensus info

evidence included in the block | | proposer_address | bytes | | original proposer of the block |

LastCommitInfo

FieldTypeLabelDescription
roundint32
votesVoteInforepeated

PartSetHeader

FieldTypeLabelDescription
totalint32
hashbytes

PubKey

FieldTypeLabelDescription
typestring
databytes

Request

FieldTypeLabelDescription
echoRequestEcho
flushRequestFlush
infoRequestInfo
set_optionRequestSetOption
init_chainRequestInitChain
queryRequestQuery
begin_blockRequestBeginBlock
check_txRequestCheckTx
deliver_txRequestDeliverTx
end_blockRequestEndBlock
commitRequestCommit

RequestBeginBlock

NOTE: validators here have empty pubkeys.

FieldTypeLabelDescription
hashbytes
headerHeader
last_commit_infoLastCommitInfo
byzantine_validatorsEvidencerepeated

RequestCheckTx

FieldTypeLabelDescription
txbytes

RequestCommit

RequestDeliverTx

FieldTypeLabelDescription
txbytes

RequestEcho

FieldTypeLabelDescription
messagestring

RequestEndBlock

FieldTypeLabelDescription
heightint64

RequestFlush

RequestInfo

FieldTypeLabelDescription
versionstring

RequestInitChain

FieldTypeLabelDescription
timegoogle.protobuf.Timestamp
chain_idstring
consensus_paramsConsensusParams
validatorsValidatorUpdaterepeated
app_state_bytesbytes

RequestQuery

FieldTypeLabelDescription
databytes
pathstring
heightint64
provebool

RequestSetOption

nondeterministic

FieldTypeLabelDescription
keystring
valuestring

Response

FieldTypeLabelDescription
exceptionResponseException
echoResponseEcho
flushResponseFlush
infoResponseInfo
set_optionResponseSetOption
init_chainResponseInitChain
queryResponseQuery
begin_blockResponseBeginBlock
check_txResponseCheckTx
deliver_txResponseDeliverTx
end_blockResponseEndBlock
commitResponseCommit

ResponseBeginBlock

FieldTypeLabelDescription
tagscommon.KVPairrepeated

ResponseCheckTx

FieldTypeLabelDescription
codeuint32
databytes
logstringnondeterministic
infostringnondeterministic
gas_wantedint64
gas_usedint64
tagscommon.KVPairrepeated

ResponseCommit

FieldTypeLabelDescription
databytesreserve 1

ResponseDeliverTx

FieldTypeLabelDescription
codeuint32
databytes
logstringnondeterministic
infostringnondeterministic
gas_wantedint64
gas_usedint64
tagscommon.KVPairrepeated

ResponseEcho

FieldTypeLabelDescription
messagestring

ResponseEndBlock

FieldTypeLabelDescription
validator_updatesValidatorUpdaterepeated
consensus_param_updatesConsensusParams
tagscommon.KVPairrepeated

ResponseException

nondeterministic

FieldTypeLabelDescription
errorstring

ResponseFlush

ResponseInfo

FieldTypeLabelDescription
datastring
versionstring
last_block_heightint64
last_block_app_hashbytes

ResponseInitChain

FieldTypeLabelDescription
consensus_paramsConsensusParams
validatorsValidatorUpdaterepeated

ResponseQuery

FieldTypeLabelDescription
codeuint32
logstringbytes data = 2; // use "value" instead.

nondeterministic | | info | string | | nondeterministic | | index | int64 | | | | key | bytes | | | | value | bytes | | | | proof | bytes | | | | height | int64 | | |

ResponseSetOption

nondeterministic

FieldTypeLabelDescription
codeuint32
logstringbytes data = 2;
infostring

TxSize

TxSize contains limits on the tx size.

FieldTypeLabelDescription
max_bytesint32
max_gasint64

Validator

Validator

FieldTypeLabelDescription
addressbytes
powerint64PubKey pub_key = 2 [(gogoproto.nullable)=false];

ValidatorUpdate

ValidatorUpdate

FieldTypeLabelDescription
pub_keyPubKey
powerint64

VoteInfo

VoteInfo

FieldTypeLabelDescription
validatorValidator
signed_last_blockbool

ABCIApplication

Method NameRequest TypeResponse TypeDescription
EchoRequestEchoResponseEcho
FlushRequestFlushResponseFlush
InfoRequestInfoResponseInfo
SetOptionRequestSetOptionResponseSetOption
DeliverTxRequestDeliverTxResponseDeliverTx
CheckTxRequestCheckTxResponseCheckTx
QueryRequestQueryResponseQuery
CommitRequestCommitResponseCommit
InitChainRequestInitChainResponseInitChain
BeginBlockRequestBeginBlockResponseBeginBlock
EndBlockRequestEndBlockResponseEndBlock

Top

github.com/tendermint/tendermint/libs/common/types.proto

KI64Pair

Define these here for compatibility but use tmlibs/common.KI64Pair.

FieldTypeLabelDescription
keybytes
valueint64

KVPair

Define these here for compatibility but use tmlibs/common.KVPair.

FieldTypeLabelDescription
keybytes
valuebytes

Top

permission.proto

AccountPermissions

FieldTypeLabelDescription
BaseBasePermissionsoptional
Rolesstringrepeated

BasePermissions

FieldTypeLabelDescription
Permsuint64optional
SetBituint64optional

PermArgs

FieldTypeLabelDescription
Actionuint64optionalThe permission function
TargetbytesoptionalThe target of the action
Permissionuint64optionalPossible arguments
Rolestringoptional
Valuebooloptional

Top

acm.proto

Account

FieldTypeLabelDescription
Addressbytes
PublicKeycrypto.PublicKey
Sequenceuint64
Balanceuint64
EVMCodebytes
Permissionspermission.AccountPermissions
WASMCodebytes
CodeHashbytes
ContractMetaContractMetarepeated
ForebearbytesThe metadata is stored in the deployed account. When the deployed account creates new account (from Solidity/EVM), they point to the original deployed account where the metadata is stored. This original account is called the forebear.

ContractMeta

FieldTypeLabelDescription
CodeHashbytes
MetadataHashbytes
MetadatastringIn the dump format we would like the ABI rather than its hash

Top

rpcquery.proto

GetAccountParam

FieldTypeLabelDescription
Addressbytes

GetBlockParam

FieldTypeLabelDescription
Heightuint64

GetMetadataParam

FieldTypeLabelDescription
Addressbytes
MetadataHashbytes

GetNameParam

FieldTypeLabelDescription
Namestring

GetProposalParam

FieldTypeLabelDescription
Hashbytes

GetStatsParam

GetStorageParam

FieldTypeLabelDescription
Addressbytes
Keybytes

GetValidatorSetHistoryParam

FieldTypeLabelDescription
IncludePreviousint64Use -1 for all available history

GetValidatorSetParam

ListAccountsParam

FieldTypeLabelDescription
Querystring

ListNamesParam

FieldTypeLabelDescription
Querystring

ListProposalsParam

FieldTypeLabelDescription
Proposedbool

MetadataResult

FieldTypeLabelDescription
Metadatastring

ProposalResult

FieldTypeLabelDescription
Hashbytes
Ballotpayload.Ballot

Stats

FieldTypeLabelDescription
AccountsWithCodeuint64
AccountsWithoutCodeuint64

StatusParam

FieldTypeLabelDescription
BlockTimeWithinstring
BlockSeenTimeWithinstring

StorageValue

FieldTypeLabelDescription
Valuebytes

ValidatorSet

FieldTypeLabelDescription
heightuint64
Setvalidator.Validatorrepeated

ValidatorSetHistory

FieldTypeLabelDescription
HistoryValidatorSetrepeated

Query

Method NameRequest TypeResponse TypeDescription
StatusStatusParam.rpc.ResultStatus
GetAccountGetAccountParam.acm.Account
GetMetadataGetMetadataParamMetadataResult
GetStorageGetStorageParamStorageValue
ListAccountsListAccountsParam.acm.Account stream
GetNameGetNameParam.names.Entry
ListNamesListNamesParam.names.Entry stream
GetValidatorSetGetValidatorSetParamValidatorSet
GetValidatorSetHistoryGetValidatorSetHistoryParamValidatorSetHistory
GetProposalGetProposalParam.payload.Ballot
ListProposalsListProposalsParamProposalResult stream
GetStatsGetStatsParamStats
GetBlockHeaderGetBlockParam.types.Header

Top

tendermint.proto

Needed to proto2 rather than proto3 to get pointer field for PermArg

NodeInfo

FieldTypeLabelDescription
IDbytes
ListenAddressstring
Networkstring
Versionstring
Channelsbytes
Monikerstring
RPCAddressstring
TxIndexstring

Top

crypto.proto

PrivateKey

FieldTypeLabelDescription
CurveTypeuint32
PublicKeybytesNote may need initialisation
PrivateKeybytes

PublicKey

FieldTypeLabelDescription
CurveTypeuint32
PublicKeybytes

Signature

FieldTypeLabelDescription
CurveTypeuint32
Signaturebytes

Top

storage.proto

CommitID

This is the object that is stored in the leaves of the commitsTree - it captures the sub-tree hashes so that the commitsTree's hash becomes a mixture of the hashes of all the sub-trees.

FieldTypeLabelDescription
Versionint64
Hashbytes

Top

payload.proto

Any

FieldTypeLabelDescription
CallTxCallTx
SendTxSendTx
NameTxNameTx
PermsTxPermsTx
GovTxGovTx
BondTxBondTx
UnbondTxUnbondTx
BatchTxBatchTx
ProposalTxProposalTx

Ballot

FieldTypeLabelDescription
ProposalProposal
FinalizingTxbytes
proposalStateBallot.ProposalState
VotesVoterepeated

BatchTx

FieldTypeLabelDescription
InputsTxInputrepeated
TxsAnyrepeated

BondTx

FieldTypeLabelDescription
InputTxInputInput must be the validator that desires to bond

CallTx

A instruction to run smart contract code in the EVM

FieldTypeLabelDescription
InputTxInputThe caller's input
AddressbytesThe contract address to call or nil if we are creating a contract
GasLimituint64The upper bound on the amount of gas (and therefore EVM execution steps) this CallTx may generate
Feeuint64Fee to offer validators for processing transaction
DatabytesEVM bytecode
WASMbytesWASM bytecode
ContractMetaContractMetarepeatedSet of contracts this code will deploy

ContractMeta

FieldTypeLabelDescription
CodeHashbytes
Metastring

GovTx

FieldTypeLabelDescription
InputsTxInputrepeated
AccountUpdatesspec.TemplateAccountrepeated

NameTx

A request to claim a globally unique name across the entire chain with some optional data storage leased for a fee

FieldTypeLabelDescription
InputTxInputThe name updater
NamestringThe name to update or create
DatastringThe data to store against the name
Feeuint64The fee to provide that will determine the length of the name lease

PermsTx

An update to the on-chain permissions

FieldTypeLabelDescription
InputTxInputThe permission moderator
PermArgspermission.PermArgsThe modified permissions

Proposal

FieldTypeLabelDescription
Namestring
Descriptionstring
BatchTxBatchTx

ProposalTx

FieldTypeLabelDescription
InputTxInput
VotingWeightint64
ProposalHashbytes
ProposalProposal

SendTx

A payment between two sets of parties

FieldTypeLabelDescription
InputsTxInputrepeatedThe payers
OutputsTxOutputrepeatedThe payees

TxInput

An input to a transaction that may carry an Amount as a charge and whose sequence number must be one greater than that associated with the account at Address at the time of being received

FieldTypeLabelDescription
AddressbytesThe address from which this input flows
Amountuint64The amount of native token to transfer from the input address
Sequenceuint64The sequence number that this transaction will induce (i.e. one greater than the input account's current sequence)

TxOutput

An output from a transaction that may carry an amount as a charge

FieldTypeLabelDescription
AddressbytesThe address to which this output flows
Amountuint64The amount of native token to transfer to the output address

UnbondTx

FieldTypeLabelDescription
InputTxInput
OutputTxOutputAccount to unbond

Vote

FieldTypeLabelDescription
Addressbytes
VotingWeightint64

Ballot.ProposalState

NameNumberDescription
PROPOSED0PROPOSED might be expired, if sequence number of any of the input accounts are out of date
EXECUTED1
FAILED2

Top

dump.proto

AccountStorage

FieldTypeLabelDescription
Addressbytes
StorageStoragerepeated

Dump

FieldTypeLabelDescription
Heightuint64
Accountacm.Account
AccountStorageAccountStorage
EVMEventEVMEvent
Namenames.Entry

EVMEvent

FieldTypeLabelDescription
ChainIDstringThe original ChainID from for this event
Indexuint64The original index for this event
Timegoogle.protobuf.TimestampThe original block time for this transaction
Eventexec.LogEventThe event itself

Storage

FieldTypeLabelDescription
Keybytes
Valuebytes

Top

rpcdump.proto

GetDumpParam

FieldTypeLabelDescription
heightuint64

Dump

Method NameRequest TypeResponse TypeDescription
GetDumpGetDumpParam.dump.Dump stream

Top

keys.proto

AddNameRequest

FieldTypeLabelDescription
Keynamestring
Addressstring

AddNameResponse

ExportRequest

FieldTypeLabelDescription
Passphrasestring
Namestring
Addressstring

ExportResponse

FieldTypeLabelDescription
Publickeybytes
Privatekeybytes
Addressbytes
CurveTypestring

GenRequest

FieldTypeLabelDescription
Passphrasestring
CurveTypestring
KeyNamestring

GenResponse

FieldTypeLabelDescription
Addressstring

HashRequest

FieldTypeLabelDescription
Hashtypestring
Messagebytes

HashResponse

FieldTypeLabelDescription
Hashstring

ImportJSONRequest

FieldTypeLabelDescription
Passphrasestring
JSONstring

ImportRequest

FieldTypeLabelDescription
Passphrasestring
Namestring
CurveTypestring
KeyBytesbytes

ImportResponse

FieldTypeLabelDescription
Addressstring

KeyID

FieldTypeLabelDescription
Addressstring
KeyNamestringrepeated

ListRequest

FieldTypeLabelDescription
KeyNamestring

ListResponse

FieldTypeLabelDescription
keyKeyIDrepeated

PubRequest

FieldTypeLabelDescription
Addressstring
Namestring

PubResponse

FieldTypeLabelDescription
PublicKeybytes
CurveTypestring

RemoveNameRequest

FieldTypeLabelDescription
KeyNamestring

RemoveNameResponse

SignRequest

FieldTypeLabelDescription
Passphrasestring
Addressstring
Namestring
Messagebytes

SignResponse

FieldTypeLabelDescription
Signaturecrypto.Signature

VerifyRequest

FieldTypeLabelDescription
PublicKeybytes
Messagebytes
Signaturecrypto.Signature

VerifyResponse

Keys

Method NameRequest TypeResponse TypeDescription
GenerateKeyGenRequestGenResponse
PublicKeyPubRequestPubResponse
SignSignRequestSignResponse
VerifyVerifyRequestVerifyResponse
ImportImportRequestImportResponse
ImportJSONImportJSONRequestImportResponse
ExportExportRequestExportResponse
HashHashRequestHashResponse
RemoveNameRemoveNameRequestRemoveNameResponse
ListListRequestListResponse
AddNameAddNameRequestAddNameResponse

Top

errors.proto

Exception

FieldTypeLabelDescription
Codeuint32
Exceptionstring

Top

rpc.proto

Needed to proto2 rather than proto3 to get pointer field for PermArg

ResultStatus

FieldTypeLabelDescription
ChainIDstring
RunIDstring
BurrowVersionstring
GenesisHashbytes
NodeInfotendermint.NodeInfo
SyncInfobcm.SyncInfo
CatchingUpboolWhen catching up in fast sync
ValidatorInfovalidator.Validator

Top

rpcevents.proto

BlockRange

An inclusive range of blocks to include in output

FieldTypeLabelDescription
StartBoundBounds can be set to: absolute: block height relative: block height counting back from latest latest: latest block when call is processed stream: for End keep sending new blocks, for start same as latest
EndBound

BlocksRequest

FieldTypeLabelDescription
BlockRangeBlockRange
QuerystringSpecify a query on which to match the tags of events. Tag

For example: EventType = 'LogEvent' AND EventID CONTAINS 'bar' AND TxHash = '020304' AND Height >= 34 AND Index < 3 AND Address = 'DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF' |

Bound

FieldTypeLabelDescription
TypeBound.BoundType
Indexuint64

EventsResponse

FieldTypeLabelDescription
Heightuint64
Eventsexec.Eventrepeated

GetBlockRequest

FieldTypeLabelDescription
Heightuint64Height of block required
WaitboolWhether to wait for the block to become available

GetTxsRequest

FieldTypeLabelDescription
StartHeightuint64
EndHeightuint64
Querystring

GetTxsResponse

FieldTypeLabelDescription
Heightuint64
TxExecutionsexec.TxExecutionrepeated

TxRequest

FieldTypeLabelDescription
TxHashbytesHeight of block required
WaitboolWhether to wait for the block to become available

Bound.BoundType

NameNumberDescription
ABSOLUTE0Index is absolute index of an item
RELATIVE1Index is an offset relative to last item
FIRST2The first block
LATEST3Ignore provided index and evaluate to latest index
STREAM4Ignore provided index and stream new objects as they are generated

ExecutionEvents


Execution events

Method NameRequest TypeResponse TypeDescription
StreamBlocksRequest.exec.StreamEvent streamGet StreamEvents (including transactions) for a range of block heights
TxTxRequest.exec.TxExecutionGet a particular TxExecution by hash
EventsBlocksRequestEventsResponse streamGetEvents provides events streaming one block at a time - that is all events emitted in a particular block are guaranteed to be delivered in each GetEventsResponse

Top

bcm.proto

Needed to proto2 rather than proto3 to get pointer field for PermArg

PersistedState

FieldTypeLabelDescription
AppHashAfterLastBlockbytes
LastBlockTimegoogle.protobuf.Timestamp
LastBlockHeightuint64
GenesisHashbytes

SyncInfo

FieldTypeLabelDescription
LatestBlockHeightuint64
LatestBlockHashbytes
LatestAppHashbytes
LatestBlockTimegoogle.protobuf.TimestampTimestamp of block as set by the block proposer
LatestBlockSeenTimegoogle.protobuf.TimestampTime at which we committed the last block
LatestBlockDurationgoogle.protobuf.DurationTime elapsed since last commit

Top

spec.proto

TemplateAccount

FieldTypeLabelDescription
Namestring
Addressbytes
PublicKeycrypto.PublicKey
Amountsbalance.Balancerepeated
Permissionsstringrepeated
Rolesstringrepeated
Codebytes

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


.
├── acm.proto
├── balance.proto
├── bcm.proto
├── crypto.proto
├── dump.proto
├── encoding.proto
├── errors.proto
├── exec.proto
├── github.com
│   ├── gogo
│   │   └── protobuf
│   │       └── gogoproto
│   │           └── gogo.proto
│   └── tendermint
│       └── tendermint
│           ├── abci
│           │   └── types
│           │       └── types.proto
│           └── libs
│               └── common
│                   └── types.proto
├── google
│   └── protobuf
│       ├── descriptor.proto
│       └── timestamp.proto
├── keys.proto
├── names.proto
├── payload.proto
├── permission.proto
├── rpcdump.proto
├── rpcevents.proto
├── rpc.proto
├── rpcquery.proto
├── rpctransact.proto
├── spec.proto
├── storage.proto
├── tendermint.proto
├── txs.proto
└── validator.proto

12 directories, 27 files

Protobuf sources

src:./balance.proto


syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/acm/balance";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

package balance;

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

message Balance {
    option (gogoproto.goproto_sizecache) = false;
    option (gogoproto.goproto_unkeyed) = false;
    option (gogoproto.goproto_stringer) = false;
    uint32 Type = 1 [(gogoproto.casttype) = "Type"];
    uint64 Amount = 2;
}

src:./exec.proto


syntax = 'proto3';

package exec;

option go_package = "github.com/hyperledger/burrow/execution/exec";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/tendermint/tendermint/abci/types/types.proto";
import "google/protobuf/timestamp.proto";

import "errors.proto";
import "names.proto";
import "txs.proto";
import "permission.proto";
import "spec.proto";

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

// This message exists purely for framing []StreamEvent
message StreamEvents {
    repeated StreamEvent StreamEvents = 1;
}

message StreamEvent {
    option (gogoproto.onlyone) = true;
    BeginBlock BeginBlock = 1;
    BeginTx BeginTx = 2;
    txs.Envelope Envelope = 3 [(gogoproto.customtype) = "github.com/hyperledger/burrow/txs.Envelope"];
    Event Event = 4;
    EndTx EndTx = 5;
    EndBlock EndBlock = 6;
}

message BeginBlock {
    // The height of this block
    uint64 Height = 1;
    types.Header Header = 2;
}

message EndBlock {
    uint64 Height = 1;
}

message BeginTx {
    TxHeader TxHeader = 1;
    // Result of tx execution
    Result Result = 2;
    // If tx execution was an exception
    errors.Exception Exception = 4;
}

message EndTx {
    // The hash of the transaction that caused this event to be generated
    bytes TxHash = 3 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
}

message TxHeader {
    // Transaction type
    uint32 TxType = 1 [(gogoproto.casttype) = "github.com/hyperledger/burrow/txs/payload.Type"];
    // The hash of the transaction that caused this event to be generated
    bytes TxHash = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    // The block height at which this Tx was included
    uint64 Height = 3;
    // The index of this transaction within the block
    uint64 Index = 4;
    // The origin information from the chain on which this tx was originally committed (if restored or otherwise imported)
    Origin Origin = 5;
}

message BlockExecution {
    // The height of this block
    uint64 Height = 1;
    types.Header Header = 2;
    repeated TxExecution TxExecutions = 3;
}

message TxExecutionKey {
    // The block height
    uint64 Height = 1;
    // The offset of the TxExecution in bytes
    uint64 Offset = 2;
}

message TxExecution {
    TxHeader Header = 1 [(gogoproto.embed) = true];
    // Signed Tx that triggered this execution
    txs.Envelope Envelope = 6 [(gogoproto.customtype) = "github.com/hyperledger/burrow/txs.Envelope"];
    // Execution events
    repeated Event Events = 7;
    // The execution results
    Result Result = 8;
    // The transaction receipt
    txs.Receipt Receipt = 9;
    // If execution was an exception
    errors.Exception Exception = 10;
    // A proposal may contain other transactions
    repeated TxExecution TxExecutions = 11;
}

message Origin {
    // The original ChainID from for this transaction
    string ChainID = 1;
    // The original height at which this transaction was committed
    uint64 Height = 2;
    // The original index in the block
    uint64 Index = 3;
    // The original block time for this transaction
    google.protobuf.Timestamp Time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}

message Header {
    option (gogoproto.goproto_stringer) = false;
    // Transaction type
    uint32 TxType = 1 [(gogoproto.casttype) = "github.com/hyperledger/burrow/txs/payload.Type"];
    // The hash of the transaction that caused this event to be generated
    bytes TxHash = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    // The type of event
    uint32 EventType = 3 [(gogoproto.casttype) = "EventType"];
    // EventID published with event
    string EventID = 4;
    // The block height at which this event was emitted
    uint64 Height = 5;
    // The index of this event relative to other events generated by the same transaction
    uint64 Index = 6;
    // If event is exception
    errors.Exception Exception = 7;
}

message Event {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.onlyone) = true;
    Header Header = 1;
    InputEvent Input = 2;
    OutputEvent Output = 3;
    CallEvent Call = 4;
    LogEvent Log = 5;
    GovernAccountEvent GovernAccount = 6;
}

// Could structure this further if needed - sum type of various results relevant to different transaction types
message Result {
    // EVM execution return
    bytes Return = 1;
    // Gas used in computation
    uint64 GasUsed = 2;
    // Name entry created
    names.Entry NameEntry = 3;
    // Permission update performed
    permission.PermArgs PermArgs = 4;
}

message LogEvent {
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    bytes Data = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    repeated bytes Topics = 3 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.Word256", (gogoproto.nullable) = false];
}

message CallEvent {
    uint32 CallType = 5 [(gogoproto.casttype) = "CallType"];
    CallData CallData = 1;
    bytes Origin = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    uint64 StackDepth = 3;
    bytes Return = 4 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
}

message GovernAccountEvent {
    spec.TemplateAccount AccountUpdate = 1;
}

message InputEvent {
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
}

message OutputEvent {
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
}

message CallData {
    bytes Caller = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    bytes Callee = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    bytes Data = 3 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    uint64 Value = 4;
    uint64 Gas = 5;
}

src:./names.proto


syntax = 'proto3';

package names;

option go_package = "github.com/hyperledger/burrow/execution/names";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

option (gogoproto.stable_marshaler_all) = true;
// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
// Enable registration with golang/protobuf for the grpc-gateway.
option (gogoproto.goproto_registration) = true;
// Enable generation of XXX_MessageName methods for grpc-go/status.
option (gogoproto.messagename_all) = true;

// NameReg provides a global key value store based on Name, Data pairs that are subject to expiry and ownership by an
// account.
message Entry {
    option (gogoproto.goproto_stringer) = false;
    // registered name for the entry
    string Name = 1;
    // address that created the entry
    bytes Owner = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    // data to store under this name
    string Data = 3;
    // block at which this entry expires
    uint64 Expires = 4;
}


src:./encoding.proto


syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/encoding";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

package encoding;

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

// For testing
message TestMessage {
    option (gogoproto.goproto_stringer) = false;
    uint32 Type = 1;
    uint64 Amount = 2;
}

src:./validator.proto


syntax = 'proto3';

package validator;

option go_package = "github.com/hyperledger/burrow/acm/validator";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

import "crypto.proto";

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

message Validator {
    option (gogoproto.goproto_stringer) = false;
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address"];
    crypto.PublicKey PublicKey = 2 [(gogoproto.nullable) = false];
    uint64 Power = 3;
}

src:./txs.proto


syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/txs";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

import "crypto.proto";

package txs;

// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
// Enable registration with golang/protobuf for the grpc-gateway.
option (gogoproto.goproto_registration) = true;
// Enable generation of XXX_MessageName methods for grpc-go/status.
option (gogoproto.messagename_all) = true;

// An envelope contains both the signable Tx and the signatures for each input (in signatories)
message Envelope {
    option (gogoproto.goproto_stringer) = false;
    repeated Signatory Signatories = 1 [(gogoproto.nullable) = false];
    // Canonical bytes of the Tx ready to be signed
    bytes Tx = 2 [(gogoproto.customtype) = "Tx"];
}

// Signatory contains signature and one or both of Address and PublicKey to identify the signer
message Signatory {
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address"];
    crypto.PublicKey PublicKey = 2;
    crypto.Signature Signature = 4;
}

// BroadcastTx or Transaction receipt
message Receipt {
    // Transaction type
    uint32 TxType = 1[(gogoproto.casttype) = "github.com/hyperledger/burrow/txs/payload.Type"];
    // The hash of the transaction that caused this event to be generated
    bytes TxHash = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    // Whether the transaction creates a contract
    bool CreatesContract = 3;
    // The address of the contract being called
    bytes ContractAddress = 4 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
}

src:./rpctransact.proto


syntax = 'proto3';

package rpctransact;

option go_package = "github.com/hyperledger/burrow/rpc/rpctransact";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/duration.proto";

import "exec.proto";
import "payload.proto";
import "txs.proto";

// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
// Enable registration with golang/protobuf for the grpc-gateway.
option (gogoproto.goproto_registration) = true;
// Enable generation of XXX_MessageName methods for grpc-go/status.
option (gogoproto.messagename_all) = true;

// Transaction Service Definition
service Transact {
    // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side
    // and wait for it to be included in block
    rpc BroadcastTxSync (TxEnvelopeParam) returns (exec.TxExecution);
    // Broadcast a transaction to the mempool - if the transaction is not signed signing will be attempted server-side
    rpc BroadcastTxAsync (TxEnvelopeParam) returns (txs.Receipt);

    // Sign transaction server-side
    rpc SignTx (TxEnvelopeParam) returns (TxEnvelope);
    // Formulate a transaction from a Payload and retrun the envelop with the Tx bytes ready to sign
    rpc FormulateTx (payload.Any) returns (TxEnvelope);

    // Formulate and sign a CallTx transaction signed server-side and wait for it to be included in a block, retrieving response
    rpc CallTxSync (payload.CallTx) returns (exec.TxExecution);
    // Formulate and sign a CallTx transaction signed server-side
    rpc CallTxAsync (payload.CallTx) returns (txs.Receipt);
    // Perform a 'simulated' call of a contract against the current committed EVM state without any changes been saved
    // and wait for the transaction to be included in a block
    rpc CallTxSim (payload.CallTx) returns (exec.TxExecution);
    // Perform a 'simulated' execution of provided code against the current committed EVM state without any changes been saved
    rpc CallCodeSim (CallCodeParam) returns (exec.TxExecution);

    // Formulate a SendTx transaction signed server-side and wait for it to be included in a block, retrieving response
    rpc SendTxSync (payload.SendTx) returns (exec.TxExecution);
    // Formulate and  SendTx transaction signed server-side
    rpc SendTxAsync (payload.SendTx) returns (txs.Receipt);

    // Formualte a NameTx signed server-side and wait for it to be included in a block returning the registered name
    rpc NameTxSync (payload.NameTx) returns (exec.TxExecution);
    // Formulate a NameTx signed server-side
    rpc NameTxAsync (payload.NameTx) returns (txs.Receipt);
}

message CallCodeParam {
    bytes FromAddress = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    bytes Code = 2;
    bytes Data = 3;
}

message TxEnvelope {
    txs.Envelope Envelope = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/txs.Envelope"];
}

message TxEnvelopeParam {
    // An existing Envelope - either signed or unsigned - if the latter will be signed server-side
    txs.Envelope Envelope = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/txs.Envelope"];
    // If no Envelope provided then one will be generated from the provided payload and signed server-side
    payload.Any Payload = 2;
    // The amount of time to wait for the transaction to be committed and the TxExecution to be returned (server-side).
    // If zero there wait is unbounded. Timed out transactions return SyncInfo state that may be helpful debugging
    // non-committed transactions - this timeout must be less than client timeout to see such information!
    google.protobuf.Duration Timeout = 3 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
}


src:./github.com/tendermint/tendermint/abci/types/types.proto


syntax = "proto3";
package types;

// For more information on gogo.proto, see:
// https://github.com/gogo/protobuf/blob/master/extensions.md
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "github.com/tendermint/tendermint/libs/common/types.proto";

// This file is copied from http://github.com/tendermint/abci
// NOTE: When using custom types, mind the warnings.
// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
// Generate tests
option (gogoproto.populate_all) = true;
option (gogoproto.equal_all) = true;
option (gogoproto.testgen_all) = true;

//----------------------------------------
// Request types

message Request {
  oneof value {
    RequestEcho echo = 2;
    RequestFlush flush = 3;
    RequestInfo info = 4;
    RequestSetOption set_option = 5;
    RequestInitChain init_chain = 6;
    RequestQuery query = 7;
    RequestBeginBlock begin_block = 8;
    RequestCheckTx check_tx = 9;
    RequestDeliverTx deliver_tx = 19;
    RequestEndBlock end_block = 11;
    RequestCommit commit = 12;
  }
}

message RequestEcho {
  string message = 1;
}

message RequestFlush {
}

message RequestInfo {
  string version = 1;
}

// nondeterministic
message RequestSetOption {
  string key = 1;
  string value = 2;
}

message RequestInitChain {
  google.protobuf.Timestamp time = 1  [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  string chain_id = 2;
  ConsensusParams consensus_params = 3;
  repeated ValidatorUpdate validators = 4  [(gogoproto.nullable)=false];
  bytes app_state_bytes = 5;
}

message RequestQuery {
  bytes data = 1;
  string path = 2;
  int64 height = 3;
  bool prove = 4;
}

// NOTE: validators here have empty pubkeys.
message RequestBeginBlock {
  bytes hash = 1;
  Header header = 2 [(gogoproto.nullable)=false];
  LastCommitInfo last_commit_info = 3 [(gogoproto.nullable)=false];
  repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false];
}

message RequestCheckTx {
  bytes tx = 1;
}

message RequestDeliverTx {
  bytes tx = 1;
}

message RequestEndBlock {
  int64 height = 1;
}

message RequestCommit {
}

//----------------------------------------
// Response types

message Response {
  oneof value {
    ResponseException exception = 1;
    ResponseEcho echo = 2;
    ResponseFlush flush = 3;
    ResponseInfo info = 4;
    ResponseSetOption set_option = 5;
    ResponseInitChain init_chain = 6;
    ResponseQuery query = 7;
    ResponseBeginBlock begin_block = 8;
    ResponseCheckTx check_tx = 9;
    ResponseDeliverTx deliver_tx = 10;
    ResponseEndBlock end_block = 11;
    ResponseCommit commit = 12;
  }
}

// nondeterministic
message ResponseException {
  string error = 1;
}

message ResponseEcho {
  string message = 1;
}

message ResponseFlush {
}

message ResponseInfo {
  string data = 1;
  string version = 2;
  int64 last_block_height = 3;
  bytes last_block_app_hash = 4;
}

// nondeterministic
message ResponseSetOption {
  uint32 code = 1;
  // bytes data = 2;
  string log = 3;
  string info = 4;
}

message ResponseInitChain {
  ConsensusParams consensus_params = 1;
  repeated ValidatorUpdate validators = 2 [(gogoproto.nullable)=false];
}

message ResponseQuery {
  uint32 code = 1;
  // bytes data = 2; // use "value" instead.
  string log = 3; // nondeterministic
  string info = 4; // nondeterministic
  int64 index = 5;
  bytes key = 6;
  bytes value = 7;
  bytes proof = 8;
  int64 height = 9;
}

message ResponseBeginBlock {
  repeated common.KVPair tags = 1 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
}

message ResponseCheckTx {
  uint32 code = 1;
  bytes data = 2;
  string log = 3; // nondeterministic
  string info = 4; // nondeterministic
  int64 gas_wanted  = 5;
  int64 gas_used = 6;
  repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
}

message ResponseDeliverTx {
  uint32 code = 1;
  bytes data = 2;
  string log = 3; // nondeterministic
  string info = 4; // nondeterministic
  int64 gas_wanted = 5;
  int64 gas_used = 6;
  repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
}

message ResponseEndBlock {
  repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable)=false];
  ConsensusParams consensus_param_updates = 2;
  repeated common.KVPair tags = 3 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
}

message ResponseCommit {
  // reserve 1
  bytes data = 2;
}

//----------------------------------------
// Misc.

// ConsensusParams contains all consensus-relevant parameters
// that can be adjusted by the abci app
message ConsensusParams {
  BlockSize block_size = 1;
  TxSize tx_size = 2;
  BlockGossip block_gossip = 3;
}

// BlockSize contains limits on the block size.
message BlockSize {
  int32 max_bytes = 1;
  int64 max_gas = 2;
}

// TxSize contains limits on the tx size.
message TxSize {
  int32 max_bytes = 1;
  int64 max_gas = 2;
}

// BlockGossip determine consensus critical
// elements of how blocks are gossiped
message BlockGossip {
  // Note: must not be 0
  int32 block_part_size_bytes = 1;
}

message LastCommitInfo {
  int32 round = 1;
  repeated VoteInfo votes = 2 [(gogoproto.nullable)=false];
}

//----------------------------------------
// Blockchain Types

message Header {
  // basic block info
  string chain_id = 1 [(gogoproto.customname)="ChainID"];
  int64 height = 2;
  google.protobuf.Timestamp time = 3 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  int64 num_txs = 4;
  int64 total_txs = 5;

  // prev block info
  BlockID last_block_id = 6 [(gogoproto.nullable)=false];

  // hashes of block data
  bytes last_commit_hash = 7; // commit from validators from the last block
  bytes data_hash = 8;        // transactions

  // hashes from the app output from the prev block
  bytes validators_hash = 9;   // validators for the current block
  bytes next_validators_hash = 10;   // validators for the next block
  bytes consensus_hash = 11;   // consensus params for current block
  bytes app_hash = 12;         // state after txs from the previous block
  bytes last_results_hash = 13;// root hash of all results from the txs from the previous block

  // consensus info
  bytes evidence_hash = 14;    // evidence included in the block
  bytes proposer_address = 15; // original proposer of the block
}

message BlockID {
  bytes hash = 1;
  PartSetHeader parts_header = 2 [(gogoproto.nullable)=false];
}

message PartSetHeader {
  int32 total = 1;
  bytes hash = 2;
}

// Validator
message Validator {
  bytes address = 1;
  //PubKey pub_key = 2 [(gogoproto.nullable)=false];
  int64 power = 3;
}

// ValidatorUpdate
message ValidatorUpdate {
  PubKey pub_key = 1 [(gogoproto.nullable)=false];
  int64 power = 2;
}

// VoteInfo
message VoteInfo {
  Validator validator = 1 [(gogoproto.nullable)=false];
  bool signed_last_block = 2;
}

message PubKey {
  string type = 1;
  bytes  data = 2;
}

message Evidence {
  string type = 1;
  Validator validator = 2 [(gogoproto.nullable)=false];
  int64 height = 3;
  google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
  int64 total_voting_power = 5;
}

//----------------------------------------
// Service Definition

service ABCIApplication {
  rpc Echo(RequestEcho) returns (ResponseEcho) ;
  rpc Flush(RequestFlush) returns (ResponseFlush);
  rpc Info(RequestInfo) returns (ResponseInfo);
  rpc SetOption(RequestSetOption) returns (ResponseSetOption);
  rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
  rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  rpc Query(RequestQuery) returns (ResponseQuery);
  rpc Commit(RequestCommit) returns (ResponseCommit);
  rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
}

src:./github.com/tendermint/tendermint/libs/common/types.proto


syntax = "proto3";
package common;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
// Generate tests
option (gogoproto.populate_all) = true;
option (gogoproto.equal_all) = true;
option (gogoproto.testgen_all) = true;

//----------------------------------------
// Abstract types

// Define these here for compatibility but use tmlibs/common.KVPair.
message KVPair {
  bytes key = 1;
  bytes value = 2;
}

// Define these here for compatibility but use tmlibs/common.KI64Pair.
message KI64Pair {
  bytes key = 1;
  int64 value = 2;
}

src:./permission.proto


syntax = 'proto2';

package permission;

option go_package = "github.com/hyperledger/burrow/permission";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
// Enable registration with golang/protobuf for the grpc-gateway.
option (gogoproto.goproto_registration) = true;
// Enable generation of XXX_MessageName methods for grpc-go/status.
option (gogoproto.messagename_all) = true;

message AccountPermissions {
    optional BasePermissions Base = 1 [(gogoproto.nullable) = false];
    option (gogoproto.goproto_sizecache) = false;
    option (gogoproto.goproto_unkeyed) = false;

    repeated string Roles = 2;
}

message BasePermissions {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.goproto_sizecache) = false;
    option (gogoproto.goproto_unkeyed) = false;
    optional uint64 Perms = 1 [(gogoproto.casttype) = "PermFlag", (gogoproto.nullable) = false];
    optional uint64 SetBit = 2 [(gogoproto.casttype) = "PermFlag", (gogoproto.nullable) = false];
}

message PermArgs {
    option (gogoproto.goproto_unrecognized) = false;
    option (gogoproto.goproto_stringer) = false;
    // The permission function
    optional uint64 Action = 1 [(gogoproto.casttype) = "PermFlag", (gogoproto.nullable) = false];
    // The target of the action
    optional bytes Target = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address"];
    // Possible arguments
    optional uint64 Permission = 3 [(gogoproto.casttype) = "PermFlag"];
    optional string Role = 4;
    optional bool Value = 5;
}

src:./acm.proto


syntax = 'proto3';

package acm;

option go_package = "github.com/hyperledger/burrow/acm";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

import "permission.proto";
import "crypto.proto";

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

message Account {
    option (gogoproto.goproto_stringer) = false;
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    crypto.PublicKey PublicKey = 2 [(gogoproto.nullable) = false];
    uint64 Sequence = 3;
    uint64 Balance = 4;
    bytes EVMCode = 5 [(gogoproto.customtype) = "Bytecode", (gogoproto.nullable) = false];
    permission.AccountPermissions Permissions = 6 [(gogoproto.nullable) = false];
    bytes WASMCode = 7 [(gogoproto.customtype) = "Bytecode", (gogoproto.jsontag) = ",omitempty", (gogoproto.nullable) = false];
    bytes CodeHash = 8 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false, (gogoproto.jsontag) = "-"];
    repeated ContractMeta ContractMeta = 9;
    // The metadata is stored in the deployed account. When the deployed account creates new account (from Solidity/EVM), they point to the original deployed
    // account where the metadata is stored. This original account is called the forebear.
    bytes Forebear = 10 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address"];
}

message ContractMeta {
    bytes CodeHash = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    bytes MetadataHash = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    // In the dump format we would like the ABI rather than its hash
    string Metadata = 3;
}

src:./rpcquery.proto


syntax = 'proto3';

package rpcquery;

option go_package = "github.com/hyperledger/burrow/rpc/rpcquery";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/tendermint/tendermint/abci/types/types.proto";

import "names.proto";
import "acm.proto";
import "validator.proto";
import "rpc.proto";
import "payload.proto";

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

service Query {
    rpc Status (StatusParam) returns (rpc.ResultStatus);
    rpc GetAccount (GetAccountParam) returns (acm.Account);
    rpc GetMetadata (GetMetadataParam) returns (MetadataResult);
    rpc GetStorage (GetStorageParam) returns (StorageValue);

    rpc ListAccounts (ListAccountsParam) returns (stream acm.Account);

    rpc GetName (GetNameParam) returns (names.Entry);
    rpc ListNames (ListNamesParam) returns (stream names.Entry);

    rpc GetValidatorSet (GetValidatorSetParam) returns (ValidatorSet);
    rpc GetValidatorSetHistory (GetValidatorSetHistoryParam) returns (ValidatorSetHistory);

    rpc GetProposal(GetProposalParam) returns (payload.Ballot);
    rpc ListProposals(ListProposalsParam) returns (stream ProposalResult);

    rpc GetStats(GetStatsParam) returns (Stats);

    rpc GetBlockHeader(GetBlockParam) returns (types.Header);
}

message StatusParam {
    string BlockTimeWithin = 1;
    string BlockSeenTimeWithin = 2;
}

message GetAccountParam {
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
}

message GetMetadataParam {
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address"];
    bytes MetadataHash = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes"];
}

message MetadataResult {
    string Metadata = 1;
}

message GetStorageParam {
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    bytes Key = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.Word256", (gogoproto.nullable) = false];
}

message StorageValue {
    bytes Value = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
}

message ListAccountsParam {
    string Query = 1;
}

message GetNameParam {
    string Name = 1;
}

message ListNamesParam {
    string Query = 1;
}

message GetValidatorSetParam {

}

message GetValidatorSetHistoryParam {
    // Use -1 for all available history
    int64 IncludePrevious = 1;
}

message ValidatorSetHistory {
    repeated ValidatorSet History = 1;
}

message ValidatorSet {
    uint64 height = 1;
    repeated validator.Validator Set = 2;
}

message GetProposalParam {
    bytes Hash = 1;
}

message ListProposalsParam {
    bool Proposed = 1;
}

message ProposalResult {
    bytes Hash = 1;
    payload.Ballot Ballot = 2;
}

message GetStatsParam {

}

message Stats {
    uint64 AccountsWithCode = 1;
    uint64 AccountsWithoutCode = 2;
}

message GetBlockParam {
    uint64 Height = 1;
}

src:./tendermint.proto


// Needed to proto2 rather than proto3 to get pointer field for PermArg
syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/consensus/tendermint";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

package tendermint;

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

message NodeInfo {
    bytes ID = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    string ListenAddress = 2;
    string Network = 3;
    string Version = 4;
    bytes Channels = 5 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    string Moniker = 6;
    string RPCAddress = 7;
    string TxIndex = 8;
}

src:./crypto.proto


syntax = 'proto3';

package crypto;

option go_package = "github.com/hyperledger/burrow/crypto";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

message PublicKey {
    option (gogoproto.goproto_stringer) = false;
    uint32 CurveType = 1 [(gogoproto.casttype) = "CurveType"];
    bytes PublicKey = 2[(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
}

message PrivateKey {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.goproto_getters) = false;
    uint32 CurveType = 1 [(gogoproto.casttype) = "CurveType"];
    // Note may need initialisation
    bytes PublicKey = 2;
    bytes PrivateKey = 3;
}

message Signature {
    option (gogoproto.goproto_stringer) = false;
    uint32 CurveType = 1 [(gogoproto.casttype) = "CurveType"];
    bytes Signature = 2;
}

src:./storage.proto


syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/storage";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

package storage;

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

// This is the object that is stored in the leaves of the commitsTree - it captures the sub-tree hashes so that the
// commitsTree's hash becomes a mixture of the hashes of all the sub-trees.
message CommitID {
    option (gogoproto.goproto_stringer) = false;
    int64 Version = 1;
    bytes Hash = 2;
}

src:./payload.proto


syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/txs/payload";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

import "permission.proto";
import "spec.proto";

package payload;

// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
// Enable registration with golang/protobuf for the grpc-gateway.
option (gogoproto.goproto_registration) = true;
// Enable generation of XXX_MessageName methods for grpc-go/status.
option (gogoproto.messagename_all) = true;

message Any {
    option (gogoproto.onlyone) = true;

    CallTx CallTx = 1;
    SendTx SendTx = 2;
    NameTx NameTx = 3;
    PermsTx PermsTx = 4;
    GovTx GovTx = 5;
    BondTx BondTx = 6;
    UnbondTx UnbondTx = 7;
    BatchTx BatchTx = 8;
    ProposalTx ProposalTx = 9;
}

// An input to a transaction that may carry an Amount as a charge and whose sequence number must be one greater than
// that associated with the account at Address at the time of being received
message TxInput {
    option (gogoproto.goproto_stringer) = false;
    // The address from which this input flows
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    // The amount of native token to transfer from the input address
    uint64 Amount = 2;
    // The sequence number that this transaction will induce (i.e. one greater than the input account's current sequence)
    uint64 Sequence = 3;
}

// An output from a transaction that may carry an amount as a charge
message TxOutput {
    option (gogoproto.goproto_stringer) = false;
    // The address to which this output flows
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    // The amount of native token to transfer to the output address
    uint64 Amount = 2;
}

// A instruction to run smart contract code in the EVM
message CallTx {
    option (gogoproto.goproto_stringer) = false;
    // The caller's input
    TxInput Input = 1;
    // The contract address to call or nil if we are creating a contract
    bytes Address = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address"];
    // The upper bound on the amount of gas (and therefore EVM execution steps) this CallTx may generate
    uint64 GasLimit = 3;
    // Fee to offer validators for processing transaction
    uint64 Fee = 4;
    // EVM bytecode
    bytes Data = 5 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    // WASM bytecode
    bytes WASM = 6 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false, (gogoproto.jsontag)="tags,omitempty"];
    // Set of contracts this code will deploy
    repeated ContractMeta ContractMeta = 7;
}

message ContractMeta {
    bytes CodeHash = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    string Meta = 2;
}

// A payment between two sets of parties
message SendTx {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.goproto_getters) = false;
    // The payers
    repeated TxInput Inputs = 1;
    // The payees
    repeated TxOutput Outputs = 2;
}

// An update to the on-chain permissions
message PermsTx {
    option (gogoproto.goproto_stringer) = false;
    // The permission moderator
    TxInput Input = 1;
    // The modified permissions
    permission.PermArgs PermArgs = 2 [(gogoproto.nullable) = false];
}

// A request to claim a globally unique name across the entire chain with some optional data storage leased for a fee
message NameTx {
    option (gogoproto.goproto_stringer) = false;
    // The name updater
    TxInput Input = 1;
    // The name to update or create
    string Name = 2;
    // The data to store against the name
    string Data = 3;
    // The fee to provide that will determine the length of the name lease
    uint64 Fee = 4;
}

message BondTx {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.goproto_getters) = false;

    // Input must be the validator that desires to bond
    TxInput Input = 1;
}

message UnbondTx {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.goproto_getters) = false;

    TxInput Input = 1;
    // Account to unbond
    TxOutput Output = 2;
}

message GovTx {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.goproto_getters) = false;

    repeated TxInput Inputs = 1;
    repeated spec.TemplateAccount AccountUpdates = 2 [(gogoproto.nullable) = true];
}

message ProposalTx {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.goproto_getters) = false;

    TxInput Input = 1;
    int64 VotingWeight = 2;
    bytes ProposalHash = 3 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes"];
    Proposal Proposal = 4;
}

message BatchTx {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.goproto_getters) = false;

    repeated TxInput Inputs = 1;
    repeated Any Txs = 2;
}

message Vote {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.goproto_getters) = false;

    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    int64 VotingWeight = 2;
}

message Proposal {
    option (gogoproto.goproto_stringer) = false;
    option (gogoproto.goproto_getters) = false;

    string Name = 1;
    string Description = 2;
    BatchTx BatchTx = 3;
}

message Ballot {
    Proposal Proposal = 1;
    bytes FinalizingTx = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes"];
    enum ProposalState {
        // PROPOSED might be expired, if sequence number of any of the input accounts are out of date
        PROPOSED = 0;
        EXECUTED = 1;
        FAILED = 2;
    }
    ProposalState proposalState = 4;
    repeated Vote Votes = 5;
}

src:./dump.proto


syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/dump";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

import "acm.proto";
import "exec.proto";
import "names.proto";

package dump;

option (gogoproto.stable_marshaler_all) = true;
// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
// Enable registration with golang/protobuf for the grpc-gateway.
option (gogoproto.goproto_registration) = true;
// Enable generation of XXX_MessageName methods for grpc-go/status.
option (gogoproto.messagename_all) = true;

message Storage {
    bytes Key = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.Word256", (gogoproto.nullable) = false];
    bytes Value = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
}

message AccountStorage {
    bytes Address = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.nullable) = false];
    repeated Storage Storage = 2;
}

message EVMEvent {
    // The original ChainID from for this event
    string ChainID = 1;
    // The original index for this event
    uint64 Index = 4;
    // The original block time for this transaction
    google.protobuf.Timestamp Time = 2 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
    // The event itself
    exec.LogEvent Event = 3;
}

message Dump {
    uint64 Height = 1;

    acm.Account Account = 2;
    AccountStorage AccountStorage = 3;
    EVMEvent EVMEvent = 4;
    names.Entry Name = 5;
}

src:./rpcdump.proto


syntax = 'proto3';

package rpcdump;

option go_package = "github.com/hyperledger/burrow/rpc/rpcdump";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

import "dump.proto";

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

service Dump {
    rpc GetDump(GetDumpParam) returns (stream dump.Dump);
}

message GetDumpParam {
    uint64 height = 1;
}

src:./keys.proto


syntax = "proto3";

option go_package = "github.com/hyperledger/burrow/keys";

package keys;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "crypto.proto";

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

service Keys {
    rpc GenerateKey(GenRequest) returns (GenResponse);
    rpc PublicKey(PubRequest) returns (PubResponse);
    rpc Sign(SignRequest) returns (SignResponse);
    rpc Verify(VerifyRequest) returns (VerifyResponse);
    rpc Import(ImportRequest) returns (ImportResponse);
    rpc ImportJSON(ImportJSONRequest) returns (ImportResponse);
    rpc Export(ExportRequest) returns (ExportResponse);
    rpc Hash(HashRequest) returns (HashResponse);
    rpc RemoveName(RemoveNameRequest) returns (RemoveNameResponse);
    rpc List(ListRequest) returns (ListResponse);
    rpc AddName(AddNameRequest) returns (AddNameResponse);
}

// Some empty types we may define later

message ListRequest {
    string KeyName = 1;
}

message VerifyResponse {

}

message RemoveNameResponse {

}

message AddNameResponse {

}

message RemoveNameRequest {
    string KeyName = 1;
}


message GenRequest {
    string Passphrase = 1;
    string CurveType = 2;
    string KeyName = 3;
}

message GenResponse {
    string Address = 1;
}

message PubRequest {
    string Address = 1;
    string Name = 2;
}

message PubResponse {
    bytes PublicKey = 1;
    string CurveType = 2;
}

message ImportJSONRequest {
    string Passphrase = 1;
    string JSON = 2;
}

message ImportResponse {
    string Address = 1;
}

message ImportRequest {
    string Passphrase = 1;
    string Name = 2;
    string CurveType = 3;
    bytes KeyBytes = 4;
}

message ExportRequest {
    string Passphrase = 1;
    string Name = 2;
    string Address = 3;
}

message ExportResponse {
    bytes Publickey = 1;
    bytes Privatekey = 2;
    bytes Address = 3;
    string CurveType = 4;
}

message SignRequest {
    string Passphrase = 1;
    string Address = 2;
    string Name = 3;
    bytes Message = 4;
}

message SignResponse {
    crypto.Signature Signature = 3;
}

message VerifyRequest {
    bytes PublicKey = 2;
    bytes Message = 3;
    crypto.Signature Signature = 5;
}

message HashRequest {
    string Hashtype = 1;
    bytes Message = 2;
}

message HashResponse {
    string Hash = 1;
}

message KeyID {
    string Address = 1;
    repeated string KeyName = 2;
}

message ListResponse {
    repeated KeyID key = 1;
}

message AddNameRequest {
    string Keyname = 1;
    string Address = 2;
}

src:./errors.proto


syntax = "proto3";

package errors;

option go_package = "github.com/hyperledger/burrow/execution/errors";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

option (gogoproto.stable_marshaler_all) = true;
// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
// Enable registration with golang/protobuf for the grpc-gateway.
option (gogoproto.goproto_registration) = true;
// Enable generation of XXX_MessageName methods for grpc-go/status.
option (gogoproto.messagename_all) = true;

message Exception {
    option (gogoproto.goproto_stringer) = false;
    uint32 Code = 1 [(gogoproto.casttype) = "Code"];
    string Exception = 2;
}

src:./rpc.proto


// Needed to proto2 rather than proto3 to get pointer field for PermArg
syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/rpc";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "tendermint.proto";
import "validator.proto";
import "bcm.proto";

package rpc;

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

message ResultStatus {
    string ChainID = 1;
    string RunID = 2;
    string BurrowVersion = 3;
    bytes GenesisHash = 4 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    tendermint.NodeInfo NodeInfo = 5;
    bcm.SyncInfo SyncInfo = 6;
    // When catching up in fast sync
    bool CatchingUp = 8 [(gogoproto.jsontag) = ""];
    validator.Validator ValidatorInfo = 7;
}

src:./rpcevents.proto


syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/rpc/rpcevents";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "exec.proto";

package rpcevents;

// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
// Enable registration with golang/protobuf for the grpc-gateway.
option (gogoproto.goproto_registration) = true;
// Enable generation of XXX_MessageName methods for grpc-go/status.
option (gogoproto.messagename_all) = true;

//--------------------------------------------------
// Execution events
service ExecutionEvents {
    // Get StreamEvents (including transactions) for a range of block heights
    rpc Stream (BlocksRequest) returns (stream exec.StreamEvent);
    // Get a particular TxExecution by hash
    rpc Tx (TxRequest) returns (exec.TxExecution);
    // GetEvents provides events streaming one block at a time - that is all events emitted in a particular block
    // are guaranteed to be delivered in each GetEventsResponse
    rpc Events (BlocksRequest) returns (stream EventsResponse);
}

message GetBlockRequest {
    // Height of block required
    uint64 Height = 1;
    // Whether to wait for the block to become available
    bool Wait = 2;
}

message TxRequest {
    // Height of block required
    bytes TxHash = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    // Whether to wait for the block to become available
    bool Wait = 2;
}

message BlocksRequest {
    BlockRange BlockRange = 1;
    // Specify a query on which to match the tags of events.
    // Tag        | Match type | Values
    // -----------------------------------------
    //   All events
    // -----------------------------------------
    // TxType       | String     | "UnknownTx", "SendTx", "CallTx", "NameTx", "BondTx", "UnbondTx", "PermissionsTx", "GovernanceTx"
    // TxHash       | String     | bytes
    // EventType    | String     | "CallEvent", "LogEvent", "AccountInputEvent", "AccountOutputEvent"
    // EventID      | String     | string
    // Height       | Integer    | uint64
    // Index        | Integer    | uint64
    // MessageType  | String     | Go type name
    // -----------------------------------------
    //   Log event
    // -----------------------------------------
    // Address      | String     | Address (hex)
    // Log<0-4>     | String     | Word256 (hex)
    // Log<0-4>Text | String     | string (trimmed)
    // -----------------------------------------
    //   Call event
    // -----------------------------------------
    // Origin       | String     | Address (hex)
    // Callee       | String     | Address (hex)
    // Caller       | String     | Address (hex)
    // Value        | Integer    | uint64
    // Gas          | Integer    | uint64
    // StackDepth   | Integer    | uint64
    // Exception    | String     | string
    // -----------------------------------------
    //   Tx event (input/output)
    // -----------------------------------------
    // Exception  | String     | string
    //
    // For example:
    // EventType = 'LogEvent' AND EventID CONTAINS 'bar' AND TxHash = '020304' AND Height >= 34 AND Index < 3 AND Address = 'DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF'
    string Query = 2;
}

message EventsResponse {
    uint64 Height = 1;
    repeated exec.Event Events = 2;
}

message GetTxsRequest {
    uint64 StartHeight = 1;
    uint64 EndHeight = 2;
    string Query = 3;
}

message GetTxsResponse {
    uint64 Height = 1;
    repeated exec.TxExecution TxExecutions = 2;
}

message Bound {
    BoundType Type = 1;
    uint64 Index = 2;
    enum BoundType {
        // Index is absolute index of an item
        ABSOLUTE = 0;
        // Index is an offset relative to last item
        RELATIVE = 1;
        // The first block
        FIRST = 2;
        // Ignore provided index and evaluate to latest index
        LATEST = 3;
        // Ignore provided index and stream new objects as they are generated
        STREAM = 4;
    }
}

// An inclusive range of blocks to include in output
message BlockRange {
    // Bounds can be set to:
    // absolute: block height
    // relative: block height counting back from latest
    // latest: latest block when call is processed
    // stream: for End keep sending new blocks, for start same as latest
    Bound Start = 1;
    Bound End = 2;
}


src:./bcm.proto


// Needed to proto2 rather than proto3 to get pointer field for PermArg
syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/bcm";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";

package bcm;

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

message SyncInfo {
    uint64 LatestBlockHeight = 1 [(gogoproto.jsontag) = ""];
    bytes LatestBlockHash = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    bytes LatestAppHash = 3 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    // Timestamp of block as set by the block proposer
    google.protobuf.Timestamp LatestBlockTime = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
    // Time at which we committed the last block
    google.protobuf.Timestamp LatestBlockSeenTime = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
    // Time elapsed since last commit
    google.protobuf.Duration LatestBlockDuration = 6 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
}

message PersistedState {
    bytes AppHashAfterLastBlock = 1 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
    google.protobuf.Timestamp LastBlockTime = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
    uint64 LastBlockHeight = 3;
    bytes GenesisHash = 4 [(gogoproto.customtype) = "github.com/hyperledger/burrow/binary.HexBytes", (gogoproto.nullable) = false];
}

src:./spec.proto


syntax = 'proto3';

option go_package = "github.com/hyperledger/burrow/genesis/spec";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

import "crypto.proto";
import "balance.proto";

package spec;

option (gogoproto.stable_marshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true;
option (gogoproto.messagename_all) = true;

message TemplateAccount {
    option (gogoproto.goproto_sizecache) = false;
    option (gogoproto.goproto_unkeyed) = false;

    string Name = 1;
    bytes Address = 2 [(gogoproto.customtype) = "github.com/hyperledger/burrow/crypto.Address", (gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "toml:\",omitempty\""];
    crypto.PublicKey PublicKey = 3 [(gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "toml:\",omitempty\""];
    repeated balance.Balance Amounts = 4 [(gogoproto.nullable) = false, (gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "toml:\",omitempty\""];
    repeated string Permissions = 5 [(gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "toml:\",omitempty\""];
    repeated string Roles = 6 [(gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "toml:\",omitempty\""];
    bytes Code = 7 [(gogoproto.nullable) = true, (gogoproto.customtype) = "github.com/hyperledger/burrow/acm.Bytecode"];
}