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.

82 lines
3.0 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
  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. #### AppendTx
  8. * __Arguments__:
  9. * `TxBytes ([]byte)`
  10. * __Returns__:
  11. * `RetCode (int8)`
  12. * __Usage__:<br/>
  13. Append and run a transaction. The transaction may or may not be final.
  14. #### CheckTx
  15. * __Arguments__:
  16. * `TxBytes ([]byte)`
  17. * __Returns__:
  18. * `RetCode (int8)`
  19. * __Usage__:<br/>
  20. Validate a transaction. This message should not mutate the state.
  21. #### GetHash
  22. * __Returns__:
  23. * `RetCode (int8)`
  24. * `Hash ([]byte)`
  25. * __Usage__:<br/>
  26. Return a Merkle root hash of the application state
  27. #### AddListener
  28. * __Arguments__:
  29. * `EventKey (string)`
  30. * __Returns__:
  31. * `RetCode (int8)`
  32. * __Usage__:<br/>
  33. Add event listener callback for events with given key.
  34. #### RemoveListener
  35. * __Arguments__:
  36. * `EventKey (string)`
  37. * __Returns__:
  38. * `RetCode (int8)`
  39. * __Usage__:<br/>
  40. Remove event listener callback for events with given key.
  41. #### Flush
  42. * __Usage__:<br/>
  43. Flush the response queue. Applications that implement `types.Application` need not implement this message -- it's handled by the project.
  44. #### Info
  45. * __Returns__:
  46. * `Data ([]string)`
  47. * __Usage__:<br/>
  48. Return an array of strings about the application state. Application specific.
  49. #### SetOption
  50. * __Arguments__:
  51. * `Key (string)`
  52. * `Value (string)`
  53. * __Returns__:
  54. * `RetCode (int8)`
  55. * __Usage__:<br/>
  56. Set application options. E.g. Key="mode", Value="mempool" for a mempool connection, or Key="mode", Value="consensus" for a consensus connection.
  57. Other options are application specific.
  58. ## Changelog
  59. ### Jan 8th, 2016
  60. Tendermint/TMSP now comes to consensus on the order first before AppendTx.
  61. This means that we no longer need the Commit/Rollback TMSP messages.
  62. Instead, there’s a “CheckTx” message for mempool to check the validity of a message.
  63. One consequence is that txs in blocks now may include invalid txs that are ignored.
  64. In the future, we can include a bitarray or merkle structure in the block so anyone can see which txs were valid.
  65. To prevent spam, applications can implement their “CheckTx” messages to deduct some balance, so at least spam txs will cost something. This isn’t any more work that what we already needed to do, so it’s not any worse.
  66. You can see the new changes in the tendermint/tendermint “order_first” branch, and tendermint/tmsp “order_first” branch. If you your TMSP apps to me I can help with the transition.
  67. Please take a look at how the examples in TMSP changed, e.g. how AppContext was removed, CheckTx was added, how the TMSP msg bytes changed, and how commit/rollback messages were removed.