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.

61 lines
1.4 KiB

  1. # Mempool Messages
  2. ## P2P Messages
  3. There is currently only one message that Mempool broadcasts
  4. and receives over the p2p gossip network (via the reactor):
  5. `TxMessage`
  6. ```go
  7. // TxMessage is a MempoolMessage containing a transaction.
  8. type TxMessage struct {
  9. Tx types.Tx
  10. }
  11. ```
  12. TxMessage is go-wire encoded and prepended with `0x1` as a
  13. "type byte". This is followed by a go-wire encoded byte-slice.
  14. Prefix of 40=0x28 byte tx is: `0x010128...` followed by
  15. the actual 40-byte tx. Prefix of 350=0x015e byte tx is:
  16. `0x0102015e...` followed by the actual 350 byte tx.
  17. (Please see the [go-wire repo](https://github.com/tendermint/go-wire#an-interface-example) for more information)
  18. ## RPC Messages
  19. Mempool exposes `CheckTx([]byte)` over the RPC interface.
  20. It can be posted via `broadcast_commit`, `broadcast_sync` or
  21. `broadcast_async`. They all parse a message with one argument,
  22. `"tx": "HEX_ENCODED_BINARY"` and differ in only how long they
  23. wait before returning (sync makes sure CheckTx passes, commit
  24. makes sure it was included in a signed block).
  25. Request (`POST http://gaia.zone:46657/`):
  26. ```json
  27. {
  28. "id": "",
  29. "jsonrpc": "2.0",
  30. "method": "broadcast_sync",
  31. "params": {
  32. "tx": "F012A4BC68..."
  33. }
  34. }
  35. ```
  36. Response:
  37. ```json
  38. {
  39. "error": "",
  40. "result": {
  41. "hash": "E39AAB7A537ABAA237831742DCE1117F187C3C52",
  42. "log": "",
  43. "data": "",
  44. "code": 0
  45. },
  46. "id": "",
  47. "jsonrpc": "2.0"
  48. }
  49. ```