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.

119 lines
3.8 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. # Tendermint Socket Protocol (TMSP)
  2. Blockchains are a system for creating shared multi-master application state.
  3. **TMSP** is a socket protocol enabling a blockchain consensus engine, running in one process,
  4. to manage a blockchain application state, running in another.
  5. For more information on TMSP, motivations, and tutorials, please visit [our blog post](http://tendermint.com/posts/tendermint-socket-protocol/).
  6. ## Message types
  7. TMSP requests/responses are simple Protobuf messages. Check out the [schema file](https://github.com/tendermint/tmsp/blob/master/types/types.proto).
  8. #### AppendTx
  9. * __Arguments__:
  10. * `Data ([]byte)`: The request transaction bytes
  11. * __Returns__:
  12. * `Code (uint32)`: Response code
  13. * `Data ([]byte)`: Result bytes, if any
  14. * `Log (string)`: Debug or error message
  15. * __Usage__:<br/>
  16. Append and run a transaction. If the transaction is valid, returns CodeType.OK
  17. #### CheckTx
  18. * __Arguments__:
  19. * `Data ([]byte)`: The request transaction bytes
  20. * __Returns__:
  21. * `Code (uint32)`: Response code
  22. * `Data ([]byte)`: Result bytes, if any
  23. * `Log (string)`: Debug or error message
  24. * __Usage__:<br/>
  25. Validate a transaction. This message should not mutate the state.
  26. Transactions are first run through CheckTx before broadcast to peers in the mempool layer.
  27. You can make CheckTx semi-stateful and clear the state upon `Commit` or `BeginBlock`,
  28. to allow for dependent sequences of transactions in the same block.
  29. #### Commit
  30. * __Returns__:
  31. * `Data ([]byte)`: The Merkle root hash
  32. * `Log (string)`: Debug or error message
  33. * __Usage__:<br/>
  34. Return a Merkle root hash of the application state.
  35. #### Query
  36. * __Arguments__:
  37. * `Data ([]byte)`: The query request bytes
  38. * __Returns__:
  39. * `Code (uint32)`: Response code
  40. * `Data ([]byte)`: The query response bytes
  41. * `Log (string)`: Debug or error message
  42. #### Flush
  43. * __Usage__:<br/>
  44. Flush the response queue. Applications that implement `types.Application` need not implement this message -- it's handled by the project.
  45. #### Info
  46. * __Returns__:
  47. * `Data ([]byte)`: The info bytes
  48. * __Usage__:<br/>
  49. Return information about the application state. Application specific.
  50. #### SetOption
  51. * __Arguments__:
  52. * `Key (string)`: Key to set
  53. * `Value (string)`: Value to set for key
  54. * __Returns__:
  55. * `Log (string)`: Debug or error message
  56. * __Usage__:<br/>
  57. Set application options. E.g. Key="mode", Value="mempool" for a mempool connection, or Key="mode", Value="consensus" for a consensus connection.
  58. Other options are application specific.
  59. #### InitChain
  60. * __Arguments__:
  61. * `Validators ([]Validator)`: Initial genesis validators
  62. * __Usage__:<br/>
  63. Called once upon genesis
  64. #### BeginBlock
  65. * __Arguments__:
  66. * `Height (uint64)`: The block height that is starting
  67. * __Usage__:<br/>
  68. Signals the beginning of a new block. Called prior to any AppendTxs.
  69. #### EndBlock
  70. * __Arguments__:
  71. * `Height (uint64)`: The block height that ended
  72. * __Returns__:
  73. * `Validators ([]Validator)`: Changed validators with new voting powers (0 to remove)
  74. * __Usage__:<br/>
  75. Signals the end of a block. Called prior to each Commit after all transactions
  76. ### Changelog
  77. #### Mar 26h, 2016
  78. * Introduce BeginBlock
  79. #### Mar 6th, 2016
  80. * Added InitChain, EndBlock
  81. #### Feb 14th, 2016
  82. * s/GetHash/Commit/g
  83. * Document Protobuf request/response fields
  84. #### Jan 23th, 2016
  85. * Added CheckTx/Query TMSP message types
  86. * Added Result/Log fields to AppendTx/CheckTx/SetOption
  87. * Removed Listener messages
  88. * Removed Code from ResponseSetOption and ResponseGetHash
  89. * Made examples BigEndian
  90. #### Jan 12th, 2016
  91. * Added "RetCodeBadNonce = 0x06" return code
  92. #### Jan 8th, 2016
  93. * Tendermint/TMSP now comes to consensus on the order first before AppendTx.