tendermint/types/types.proto

259 lines
5.3 KiB
Protocol Buffer
Raw Normal View History

2016-01-30 19:36:33 -08:00
syntax = "proto3";
package types;
2016-01-31 19:56:02 -08:00
// This file is copied from http://github.com/tendermint/tmsp
2016-01-30 19:36:33 -08:00
//----------------------------------------
// Message types
2016-05-17 17:06:24 -07:00
// Not being used
// Could be added to request/response
// so we don't have to type switch
// (would be twice as fast, but we're talking about 15ns)
2016-01-31 19:56:02 -08:00
enum MessageType {
NullMessage = 0x00;
2016-02-28 18:53:24 -08:00
Echo = 0x01;
Flush = 0x02;
Info = 0x03;
SetOption = 0x04;
Exception = 0x05;
AppendTx = 0x11;
CheckTx = 0x12;
Commit = 0x13;
Query = 0x14;
InitChain = 0x15;
2016-03-26 22:35:23 -07:00
BeginBlock = 0x16;
EndBlock = 0x17;
2016-01-31 19:56:02 -08:00
}
2016-01-30 19:36:33 -08:00
//----------------------------------------
// Code types
enum CodeType {
OK = 0;
// General response codes, 0 ~ 99
InternalError = 1;
EncodingError = 2;
BadNonce = 3;
Unauthorized = 4;
InsufficientFunds = 5;
UnknownRequest = 6;
// Reserved for basecoin, 100 ~ 199
BaseDuplicateAddress = 101;
BaseEncodingError = 102;
BaseInsufficientFees = 103;
BaseInsufficientFunds = 104;
BaseInsufficientGasPrice = 105;
BaseInvalidInput = 106;
BaseInvalidOutput = 107;
BaseInvalidPubKey = 108;
BaseInvalidSequence = 109;
BaseInvalidSignature = 110;
2016-03-24 11:12:16 -07:00
BaseUnknownAddress = 111;
BaseUnknownPubKey = 112;
2016-03-24 14:17:48 -07:00
BaseUnknownPlugin = 113;
// Reserved for governance, 200 ~ 299
GovUnknownEntity = 201;
GovUnknownGroup = 202;
2016-03-15 11:36:05 -07:00
GovUnknownProposal = 203;
GovDuplicateGroup = 204;
GovDuplicateMember = 205;
GovDuplicateProposal = 206;
GovDuplicateVote = 207;
GovInvalidMember = 208;
GovInvalidVote = 209;
GovInvalidVotingPower = 210;
}
2016-01-30 19:36:33 -08:00
//----------------------------------------
// Request types
message Request {
2016-05-17 17:06:24 -07:00
oneof value{
2016-05-13 23:22:32 -07:00
RequestEcho echo = 1;
RequestFlush flush = 2;
RequestInfo info = 3;
RequestSetOption set_option = 4;
RequestAppendTx append_tx = 5;
RequestCheckTx check_tx = 6;
RequestCommit commit = 7;
RequestQuery query = 8;
RequestInitChain init_chain = 9;
RequestBeginBlock begin_block = 10;
RequestEndBlock end_block = 11;
}
}
message RequestEcho {
string message = 1;
}
message RequestFlush {
}
message RequestInfo {
}
message RequestSetOption{
string key = 1;
string value = 2;
}
message RequestAppendTx{
bytes tx = 1;
}
message RequestCheckTx{
bytes tx = 1;
}
message RequestQuery{
bytes query = 1;
}
message RequestCommit{
}
message RequestInitChain{
repeated Validator validators = 1;
}
message RequestBeginBlock{
2016-09-09 20:01:53 -07:00
bytes hash = 1;
Header header = 2;
2016-05-13 23:22:32 -07:00
}
message RequestEndBlock{
uint64 height = 1;
2016-01-30 19:36:33 -08:00
}
//----------------------------------------
// Response types
2016-05-13 23:22:32 -07:00
2016-01-30 19:36:33 -08:00
message Response {
2016-05-17 17:06:24 -07:00
oneof value{
2016-05-13 23:22:32 -07:00
ResponseException exception = 1;
ResponseEcho echo = 2;
ResponseFlush flush = 3;
ResponseInfo info = 4;
ResponseSetOption set_option = 5;
ResponseAppendTx append_tx = 6;
ResponseCheckTx check_tx = 7;
ResponseCommit commit = 8;
ResponseQuery query = 9;
ResponseInitChain init_chain = 10;
ResponseBeginBlock begin_block = 11;
ResponseEndBlock end_block = 12;
}
}
message ResponseException{
string error = 1;
}
message ResponseEcho {
string message = 1;
}
message ResponseFlush{
}
message ResponseInfo {
2016-12-26 17:44:36 -08:00
string data = 1;
2016-12-26 16:49:29 -08:00
string version = 2;
uint64 last_block_height = 3;
bytes last_block_app_hash = 4;
2016-05-13 23:22:32 -07:00
}
message ResponseSetOption{
string log = 1;
}
message ResponseAppendTx{
CodeType code = 1;
bytes data = 2;
string log = 3;
}
message ResponseCheckTx{
CodeType code = 1;
bytes data = 2;
string log = 3;
}
message ResponseQuery{
CodeType code = 1;
bytes data = 2;
string log = 3;
}
message ResponseCommit{
CodeType code = 1;
bytes data = 2;
string log = 3;
}
message ResponseInitChain{
}
message ResponseBeginBlock{
}
message ResponseEndBlock{
repeated Validator diffs = 4;
2016-01-30 19:36:33 -08:00
}
2016-01-31 19:56:02 -08:00
//----------------------------------------
// Blockchain Types
message Header {
string chain_id = 1;
2016-11-22 10:59:27 -08:00
uint64 height = 2;
uint64 time = 3;
uint64 num_txs = 4;
2016-11-16 13:11:36 -08:00
BlockID last_block_id = 5;
bytes last_commit_hash = 6;
bytes data_hash = 7;
bytes validators_hash = 8;
bytes app_hash = 9;
}
message BlockID {
bytes hash = 1;
PartSetHeader parts = 2;
}
message PartSetHeader {
uint64 total = 1;
bytes hash = 2;
}
2016-02-28 18:53:24 -08:00
message Validator {
bytes pubKey = 1;
uint64 power = 2;
}
2016-05-17 21:54:32 -07:00
//----------------------------------------
// Service Definition
service TMSPApplication {
rpc Echo(RequestEcho) returns (ResponseEcho) ;
rpc Flush(RequestFlush) returns (ResponseFlush);
rpc Info(RequestInfo) returns (ResponseInfo);
rpc SetOption(RequestSetOption) returns (ResponseSetOption);
rpc AppendTx(RequestAppendTx) returns (ResponseAppendTx);
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);
}