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.

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