num_unconfirmed_txs - Cosmos

Example code for the num_unconfirmed_txs JSON-RPC method. Complete guide on how to use num_unconfirmed_txs JSON-RPC in GetBlock Web3 documentation.

Returns the count and size of transactions in the mempool, without returning the transactions themselves. Cheap alternative to unconfirmed_txs for monitoring.

Parameters

  • None

Request Example

# JSON-RPC over HTTP POST (canonical)
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "num_unconfirmed_txs",
    "params": [],
    "id": "getblock.io"
}'

# URI over HTTP GET (alternate, for simple methods)
curl --location --request GET 'https://go.getblock.io/<ACCESS-TOKEN>/num_unconfirmed_txs'

Response Example

Response Parameters

Field
Type
Description

result.n_txs

string

Number of transactions in the mempool

result.total

string

Total transaction count (alias for n_txs)

result.total_bytes

string

Total mempool size in bytes

Use Cases

  • Lightweight mempool size monitoring

  • Detecting network congestion

  • Alerting on abnormal mempool growth

Error Handling

Status Code
Error Message
Cause

404

Not Found

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32603

Internal error

Server-side error while processing the request

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?