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.

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