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.

52 lines
1.0 KiB

  1. # Mempool Messages
  2. ## P2P Messages
  3. There is currently only one message that Mempool broadcasts and receives over
  4. the p2p gossip network (via the reactor): `TxsMessage`
  5. ```go
  6. // TxsMessage is a MempoolMessage containing a list of transactions.
  7. type TxsMessage struct {
  8. Txs []types.Tx
  9. }
  10. ```
  11. ## RPC Messages
  12. Mempool exposes `CheckTx([]byte)` over the RPC interface.
  13. It can be posted via `broadcast_commit`, `broadcast_sync` or
  14. `broadcast_async`. They all parse a message with one argument,
  15. `"tx": "HEX_ENCODED_BINARY"` and differ in only how long they
  16. wait before returning (sync makes sure CheckTx passes, commit
  17. makes sure it was included in a signed block).
  18. Request (`POST http://gaia.zone:26657/`):
  19. ```json
  20. {
  21. "id": "",
  22. "jsonrpc": "2.0",
  23. "method": "broadcast_sync",
  24. "params": {
  25. "tx": "F012A4BC68..."
  26. }
  27. }
  28. ```
  29. Response:
  30. ```json
  31. {
  32. "error": "",
  33. "result": {
  34. "hash": "E39AAB7A537ABAA237831742DCE1117F187C3C52",
  35. "log": "",
  36. "data": "",
  37. "code": 0
  38. },
  39. "id": "",
  40. "jsonrpc": "2.0"
  41. }
  42. ```