You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

258 lines
5.3 KiB

8 years ago
8 years ago
  1. syntax = "proto3";
  2. package types;
  3. // This file is copied from http://github.com/tendermint/abci
  4. //----------------------------------------
  5. // Message types
  6. // Not being used
  7. // Could be added to request/response
  8. // so we don't have to type switch
  9. // (would be twice as fast, but we're talking about 15ns)
  10. enum MessageType {
  11. NullMessage = 0x00;
  12. Echo = 0x01;
  13. Flush = 0x02;
  14. Info = 0x03;
  15. SetOption = 0x04;
  16. Exception = 0x05;
  17. DeliverTx = 0x11;
  18. CheckTx = 0x12;
  19. Commit = 0x13;
  20. Query = 0x14;
  21. InitChain = 0x15;
  22. BeginBlock = 0x16;
  23. EndBlock = 0x17;
  24. }
  25. //----------------------------------------
  26. // Code types
  27. enum CodeType {
  28. OK = 0;
  29. // General response codes, 0 ~ 99
  30. InternalError = 1;
  31. EncodingError = 2;
  32. BadNonce = 3;
  33. Unauthorized = 4;
  34. InsufficientFunds = 5;
  35. UnknownRequest = 6;
  36. // Reserved for basecoin, 100 ~ 199
  37. BaseDuplicateAddress = 101;
  38. BaseEncodingError = 102;
  39. BaseInsufficientFees = 103;
  40. BaseInsufficientFunds = 104;
  41. BaseInsufficientGasPrice = 105;
  42. BaseInvalidInput = 106;
  43. BaseInvalidOutput = 107;
  44. BaseInvalidPubKey = 108;
  45. BaseInvalidSequence = 109;
  46. BaseInvalidSignature = 110;
  47. BaseUnknownAddress = 111;
  48. BaseUnknownPubKey = 112;
  49. BaseUnknownPlugin = 113;
  50. // Reserved for governance, 200 ~ 299
  51. GovUnknownEntity = 201;
  52. GovUnknownGroup = 202;
  53. GovUnknownProposal = 203;
  54. GovDuplicateGroup = 204;
  55. GovDuplicateMember = 205;
  56. GovDuplicateProposal = 206;
  57. GovDuplicateVote = 207;
  58. GovInvalidMember = 208;
  59. GovInvalidVote = 209;
  60. GovInvalidVotingPower = 210;
  61. }
  62. //----------------------------------------
  63. // Request types
  64. message Request {
  65. oneof value{
  66. RequestEcho echo = 1;
  67. RequestFlush flush = 2;
  68. RequestInfo info = 3;
  69. RequestSetOption set_option = 4;
  70. RequestDeliverTx deliver_tx = 5;
  71. RequestCheckTx check_tx = 6;
  72. RequestCommit commit = 7;
  73. RequestQuery query = 8;
  74. RequestInitChain init_chain = 9;
  75. RequestBeginBlock begin_block = 10;
  76. RequestEndBlock end_block = 11;
  77. }
  78. }
  79. message RequestEcho {
  80. string message = 1;
  81. }
  82. message RequestFlush {
  83. }
  84. message RequestInfo {
  85. }
  86. message RequestSetOption{
  87. string key = 1;
  88. string value = 2;
  89. }
  90. message RequestDeliverTx{
  91. bytes tx = 1;
  92. }
  93. message RequestCheckTx{
  94. bytes tx = 1;
  95. }
  96. message RequestQuery{
  97. bytes query = 1;
  98. }
  99. message RequestCommit{
  100. }
  101. message RequestInitChain{
  102. repeated Validator validators = 1;
  103. }
  104. message RequestBeginBlock{
  105. bytes hash = 1;
  106. Header header = 2;
  107. }
  108. message RequestEndBlock{
  109. uint64 height = 1;
  110. }
  111. //----------------------------------------
  112. // Response types
  113. message Response {
  114. oneof value{
  115. ResponseException exception = 1;
  116. ResponseEcho echo = 2;
  117. ResponseFlush flush = 3;
  118. ResponseInfo info = 4;
  119. ResponseSetOption set_option = 5;
  120. ResponseDeliverTx deliver_tx = 6;
  121. ResponseCheckTx check_tx = 7;
  122. ResponseCommit commit = 8;
  123. ResponseQuery query = 9;
  124. ResponseInitChain init_chain = 10;
  125. ResponseBeginBlock begin_block = 11;
  126. ResponseEndBlock end_block = 12;
  127. }
  128. }
  129. message ResponseException{
  130. string error = 1;
  131. }
  132. message ResponseEcho {
  133. string message = 1;
  134. }
  135. message ResponseFlush{
  136. }
  137. message ResponseInfo {
  138. string data = 1;
  139. string version = 2;
  140. uint64 last_block_height = 3;
  141. bytes last_block_app_hash = 4;
  142. }
  143. message ResponseSetOption{
  144. string log = 1;
  145. }
  146. message ResponseDeliverTx{
  147. CodeType code = 1;
  148. bytes data = 2;
  149. string log = 3;
  150. }
  151. message ResponseCheckTx{
  152. CodeType code = 1;
  153. bytes data = 2;
  154. string log = 3;
  155. }
  156. message ResponseQuery{
  157. CodeType code = 1;
  158. bytes data = 2;
  159. string log = 3;
  160. }
  161. message ResponseCommit{
  162. CodeType code = 1;
  163. bytes data = 2;
  164. string log = 3;
  165. }
  166. message ResponseInitChain{
  167. }
  168. message ResponseBeginBlock{
  169. }
  170. message ResponseEndBlock{
  171. repeated Validator diffs = 4;
  172. }
  173. //----------------------------------------
  174. // Blockchain Types
  175. message Header {
  176. string chain_id = 1;
  177. uint64 height = 2;
  178. uint64 time = 3;
  179. uint64 num_txs = 4;
  180. BlockID last_block_id = 5;
  181. bytes last_commit_hash = 6;
  182. bytes data_hash = 7;
  183. bytes validators_hash = 8;
  184. bytes app_hash = 9;
  185. }
  186. message BlockID {
  187. bytes hash = 1;
  188. PartSetHeader parts = 2;
  189. }
  190. message PartSetHeader {
  191. uint64 total = 1;
  192. bytes hash = 2;
  193. }
  194. message Validator {
  195. bytes pubKey = 1;
  196. uint64 power = 2;
  197. }
  198. //----------------------------------------
  199. // Service Definition
  200. service ABCIApplication {
  201. rpc Echo(RequestEcho) returns (ResponseEcho) ;
  202. rpc Flush(RequestFlush) returns (ResponseFlush);
  203. rpc Info(RequestInfo) returns (ResponseInfo);
  204. rpc SetOption(RequestSetOption) returns (ResponseSetOption);
  205. rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
  206. rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  207. rpc Query(RequestQuery) returns (ResponseQuery);
  208. rpc Commit(RequestCommit) returns (ResponseCommit);
  209. rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  210. rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  211. rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
  212. }