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.

273 lines
5.6 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. Proof = 0x18;
  25. }
  26. //----------------------------------------
  27. // Code types
  28. enum CodeType {
  29. OK = 0;
  30. // General response codes, 0 ~ 99
  31. InternalError = 1;
  32. EncodingError = 2;
  33. BadNonce = 3;
  34. Unauthorized = 4;
  35. InsufficientFunds = 5;
  36. UnknownRequest = 6;
  37. // Reserved for basecoin, 100 ~ 199
  38. BaseDuplicateAddress = 101;
  39. BaseEncodingError = 102;
  40. BaseInsufficientFees = 103;
  41. BaseInsufficientFunds = 104;
  42. BaseInsufficientGasPrice = 105;
  43. BaseInvalidInput = 106;
  44. BaseInvalidOutput = 107;
  45. BaseInvalidPubKey = 108;
  46. BaseInvalidSequence = 109;
  47. BaseInvalidSignature = 110;
  48. BaseUnknownAddress = 111;
  49. BaseUnknownPubKey = 112;
  50. BaseUnknownPlugin = 113;
  51. // Reserved for governance, 200 ~ 299
  52. GovUnknownEntity = 201;
  53. GovUnknownGroup = 202;
  54. GovUnknownProposal = 203;
  55. GovDuplicateGroup = 204;
  56. GovDuplicateMember = 205;
  57. GovDuplicateProposal = 206;
  58. GovDuplicateVote = 207;
  59. GovInvalidMember = 208;
  60. GovInvalidVote = 209;
  61. GovInvalidVotingPower = 210;
  62. }
  63. //----------------------------------------
  64. // Request types
  65. message Request {
  66. oneof value{
  67. RequestEcho echo = 1;
  68. RequestFlush flush = 2;
  69. RequestInfo info = 3;
  70. RequestSetOption set_option = 4;
  71. RequestDeliverTx deliver_tx = 5;
  72. RequestCheckTx check_tx = 6;
  73. RequestCommit commit = 7;
  74. RequestQuery query = 8;
  75. RequestInitChain init_chain = 9;
  76. RequestBeginBlock begin_block = 10;
  77. RequestEndBlock end_block = 11;
  78. RequestProof proof = 12;
  79. }
  80. }
  81. message RequestEcho {
  82. string message = 1;
  83. }
  84. message RequestFlush {
  85. }
  86. message RequestInfo {
  87. }
  88. message RequestSetOption{
  89. string key = 1;
  90. string value = 2;
  91. }
  92. message RequestDeliverTx{
  93. bytes tx = 1;
  94. }
  95. message RequestCheckTx{
  96. bytes tx = 1;
  97. }
  98. message RequestQuery{
  99. bytes query = 1;
  100. }
  101. message RequestProof{
  102. bytes key = 1;
  103. int64 height = 2;
  104. }
  105. message RequestCommit{
  106. }
  107. message RequestInitChain{
  108. repeated Validator validators = 1;
  109. }
  110. message RequestBeginBlock{
  111. bytes hash = 1;
  112. Header header = 2;
  113. }
  114. message RequestEndBlock{
  115. uint64 height = 1;
  116. }
  117. //----------------------------------------
  118. // Response types
  119. message Response {
  120. oneof value{
  121. ResponseException exception = 1;
  122. ResponseEcho echo = 2;
  123. ResponseFlush flush = 3;
  124. ResponseInfo info = 4;
  125. ResponseSetOption set_option = 5;
  126. ResponseDeliverTx deliver_tx = 6;
  127. ResponseCheckTx check_tx = 7;
  128. ResponseCommit commit = 8;
  129. ResponseQuery query = 9;
  130. ResponseInitChain init_chain = 10;
  131. ResponseBeginBlock begin_block = 11;
  132. ResponseEndBlock end_block = 12;
  133. ResponseProof proof = 13;
  134. }
  135. }
  136. message ResponseException{
  137. string error = 1;
  138. }
  139. message ResponseEcho {
  140. string message = 1;
  141. }
  142. message ResponseFlush{
  143. }
  144. message ResponseInfo {
  145. string data = 1;
  146. string version = 2;
  147. uint64 last_block_height = 3;
  148. bytes last_block_app_hash = 4;
  149. }
  150. message ResponseSetOption{
  151. string log = 1;
  152. }
  153. message ResponseDeliverTx{
  154. CodeType code = 1;
  155. bytes data = 2;
  156. string log = 3;
  157. }
  158. message ResponseCheckTx{
  159. CodeType code = 1;
  160. bytes data = 2;
  161. string log = 3;
  162. }
  163. message ResponseQuery{
  164. CodeType code = 1;
  165. bytes data = 2;
  166. string log = 3;
  167. }
  168. message ResponseProof{
  169. CodeType code = 1;
  170. bytes data = 2;
  171. string log = 3;
  172. }
  173. message ResponseCommit{
  174. CodeType code = 1;
  175. bytes data = 2;
  176. string log = 3;
  177. }
  178. message ResponseInitChain{
  179. }
  180. message ResponseBeginBlock{
  181. }
  182. message ResponseEndBlock{
  183. repeated Validator diffs = 4;
  184. }
  185. //----------------------------------------
  186. // Blockchain Types
  187. message Header {
  188. string chain_id = 1;
  189. uint64 height = 2;
  190. uint64 time = 3;
  191. uint64 num_txs = 4;
  192. BlockID last_block_id = 5;
  193. bytes last_commit_hash = 6;
  194. bytes data_hash = 7;
  195. bytes validators_hash = 8;
  196. bytes app_hash = 9;
  197. }
  198. message BlockID {
  199. bytes hash = 1;
  200. PartSetHeader parts = 2;
  201. }
  202. message PartSetHeader {
  203. uint64 total = 1;
  204. bytes hash = 2;
  205. }
  206. message Validator {
  207. bytes pubKey = 1;
  208. uint64 power = 2;
  209. }
  210. //----------------------------------------
  211. // Service Definition
  212. service ABCIApplication {
  213. rpc Echo(RequestEcho) returns (ResponseEcho) ;
  214. rpc Flush(RequestFlush) returns (ResponseFlush);
  215. rpc Info(RequestInfo) returns (ResponseInfo);
  216. rpc SetOption(RequestSetOption) returns (ResponseSetOption);
  217. rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
  218. rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
  219. rpc Query(RequestQuery) returns (ResponseQuery);
  220. rpc Proof(RequestProof) returns (ResponseProof);
  221. rpc Commit(RequestCommit) returns (ResponseCommit);
  222. rpc InitChain(RequestInitChain) returns (ResponseInitChain);
  223. rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock);
  224. rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock);
  225. }