Mempool Messages

P2P Messages

There is currently only one message that Mempool broadcasts and receives over the p2p gossip network (via the reactor): TxMessage

  1. // TxMessage is a MempoolMessage containing a transaction.
  2. type TxMessage struct {
  3. Tx types.Tx
  4. }

TxMessage is go-wire encoded and prepended with 0x1 as a “type byte”. This is followed by a go-wire encoded byte-slice. Prefix of 40=0x28 byte tx is: 0x010128... followed by the actual 40-byte tx. Prefix of 350=0x015e byte tx is: 0x0102015e... followed by the actual 350 byte tx.

(Please see the go-wire repo for more information)

RPC Messages

Mempool exposes CheckTx([]byte) over the RPC interface.

It can be posted via broadcast_commit, broadcast_sync or broadcast_async. They all parse a message with one argument, "tx": "HEX_ENCODED_BINARY" and differ in only how long they wait before returning (sync makes sure CheckTx passes, commit makes sure it was included in a signed block).

Request (POST http://gaia.zone:26657/):

  1. {
  2. "id": "",
  3. "jsonrpc": "2.0",
  4. "method": "broadcast_sync",
  5. "params": {
  6. "tx": "F012A4BC68..."
  7. }
  8. }

Response:

  1. {
  2. "error": "",
  3. "result": {
  4. "hash": "E39AAB7A537ABAA237831742DCE1117F187C3C52",
  5. "log": "",
  6. "data": "",
  7. "code": 0
  8. },
  9. "id": "",
  10. "jsonrpc": "2.0"
  11. }