Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 1.67 KB

File metadata and controls

66 lines (46 loc) · 1.67 KB

txpool_status

How to use it

{% tabs %} {% tab title="TypeScript/JavaScript" %} {% code overflow="wrap" lineNumbers="true" %}

// yarn add @tatumio/tatum

import { TatumSDK, Polygon, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<Polygon>({network: Network.POLYGON})

const status = await tatum.rpc.txPoolStatus()

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs

{% endcode %} {% endtab %} {% endtabs %}

Overview

The txpool_status method returns statistics about the current state of the transaction pool. The transaction pool is a queue of pending transactions waiting to be included in the next block by miners.

This method can be useful for monitoring the health of the Polygon network and analysing the behavior of the miners. It can also be used to estimate the time it will take for a transaction to be processed, as well as to determine the gas price necessary to ensure prompt inclusion of a transaction in the next block.

{% embed url="https://codepen.io/tatum-devrel/pen/bGQzOyV" %}

Parameters

This method does not take any parameters.

Return Object

The txpool_status method returns an object with the following fields:

  • pending: Number of pending transactions in the pool
  • queued: Number of queued transactions in the pool

Example Request

{
  "jsonrpc":"2.0",
  "method":"txpool_status",
  "params":[],
  "id":1
}

Example Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "pending": 4,
    "queued": 10
  }
}

In this example response, there are currently 4 pending transactions and 10 queued transactions waiting to be processed by miners.