1. Home
  2. Docs
  3. Matic
  4. Polygon SDK
  5. TX Pool

TX Pool



The TxPool module represents the transaction pool implementation, where transactions are added from different parts of the system. The module also exposes several useful features for node operators, which are covered below.

Operator Commands

Node operators can query these GRPC endpoints, as described in the CLI Commands section.

Processing Transactions

The addImpl method is the bread and butter of the TxPool module. It is the central place where transactions are added in the system, being called from the GRPC service, JSON RPC endpoints, and whenever the client receives a transaction through the gossip protocol.

It takes in as an argument ctx, which just denotes the context from which the transactions are being added (GRPC, JSON RPC…).
The other parameter is the list of transactions to be added to the pool.

The key thing to note here is the check for the From field within the transaction:

  • If the From field is empty, it is regarded as an unencrypted / unsigned transaction. These kinds of transactions are only accepted in development mode
  • If the From field is not empty, that means that it’s a signed transaction, so signature verification takes place

After all these validations, the transactions are considered to be valid.

Data structures

The fields in the TxPool object that can cause confusion are the queue and sorted lists.

  • queue – Heap implementation of a sorted list of account transactions (by nonce)
  • sorted – Sorted list for all the current promoted transactions (all executable transactions). Sorted by gas price

Originally Published @ https://sdk-docs.polygon.technology/docs/reference/modules/txpool

Was this article helpful to you? Yes No

How can we help?