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.

265 lines
5.4 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 data = 1;
  98. string path = 2;
  99. uint64 height = 3;
  100. bool prove = 4;
  101. }
  102. message RequestCommit{
  103. }
  104. message RequestInitChain{
  105. repeated Validator validators = 1;
  106. }
  107. message RequestBeginBlock{
  108. bytes hash = 1;
  109. Header header = 2;
  110. }
  111. message RequestEndBlock{
  112. uint64 height = 1;
  113. }
  114. //----------------------------------------
  115. // Response types
  116. message Response {
  117. oneof value{
  118. ResponseException exception = 1;
  119. ResponseEcho echo = 2;
  120. ResponseFlush flush = 3;
  121. ResponseInfo info = 4;
  122. ResponseSetOption set_option = 5;
  123. ResponseDeliverTx deliver_tx = 6;
  124. ResponseCheckTx check_tx = 7;
  125. ResponseCommit commit = 8;
  126. ResponseQuery query = 9;
  127. ResponseInitChain init_chain = 10;
  128. ResponseBeginBlock begin_block = 11;
  129. ResponseEndBlock end_block = 12;
  130. }
  131. }
  132. message ResponseException{
  133. string error = 1;
  134. }
  135. message ResponseEcho {
  136. string message = 1;
  137. }
  138. message ResponseFlush{
  139. }
  140. message ResponseInfo {
  141. string data = 1;
  142. string version = 2;
  143. uint64 last_block_height = 3;
  144. bytes last_block_app_hash = 4;
  145. }
  146. message ResponseSetOption{
  147. string log = 1;
  148. }
  149. message ResponseDeliverTx{
  150. CodeType code = 1;
  151. bytes data = 2;
  152. string log = 3;
  153. }
  154. message ResponseCheckTx{
  155. CodeType code = 1;
  156. bytes data = 2;
  157. string log = 3;
  158. }
  159. message ResponseQuery{
  160. CodeType code = 1;
  161. int64 index = 2;
  162. bytes key = 3;
  163. bytes value = 4;
  164. bytes proof = 5;
  165. uint64 height = 6;
  166. string log = 7;
  167. }
  168. message ResponseCommit{
  169. CodeType code = 1;
  170. bytes data = 2;
  171. string log = 3;
  172. }
  173. message ResponseInitChain{
  174. }
  175. message ResponseBeginBlock{
  176. }
  177. message ResponseEndBlock{
  178. repeated Validator diffs = 4;
  179. }
  180. //----------------------------------------
  181. // Blockchain Types
  182. message Header {
  183. string chain_id = 1;
  184. uint64 height = 2;
  185. uint64 time = 3;
  186. uint64 num_txs = 4;
  187. BlockID last_block_id = 5;
  188. bytes last_commit_hash = 6;
  189. bytes data_hash = 7;
  190. bytes validators_hash = 8;
  191. bytes app_hash = 9;
  192. }
  193. message BlockID {
  194. bytes hash = 1;
  195. PartSetHeader parts = 2;
  196. }
  197. message PartSetHeader {
  198. uint64 total = 1;
  199. bytes hash = 2;
  200. }
  201. message Validator {
  202. bytes pubKey = 1;
  203. uint64 power = 2;
  204. }
  205. //----------------------------------------
  206. // Service Definition
  207. service ABCIApplication {
  208. rpc Echo(RequestEcho) returns (ResponseEcho) ;
  209. rpc Flush(RequestFlush) returns (ResponseFlush);
  210. rpc Info(RequestInfo) returns (ResponseInfo);
  211. rpc SetOption(RequestSetOption) returns (ResponseSetOption);
  212. rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
  213. rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  214. rpc Query(RequestQuery) returns (ResponseQuery);
  215. rpc Commit(RequestCommit) returns (ResponseCommit);
  216. rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  217. rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  218. rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
  219. }