TriportRPC

eth_getTransactionCount

Polygon / https://triport.io/polygon

Minimum tier: Free

Polygon method guide

Last updated:

eth_getTransactionCount returns the nonce of an account: the total number of transactions that address has sent, counted up to and including the block you specify. The value comes back as a hex-encoded quantity (e.g. "0x2a" = 42).

The nonce is the primary input for transaction signing. Every transaction an account sends must carry a strictly increasing nonce; using the count returned for the "pending" block tag gives you the next nonce to assign to a new transaction.

High-throughput callers: if you are sending many transactions in quick succession (e.g. a bot), do not fetch the nonce per transaction. The RPC view lags behind transactions you have already broadcast but that are not yet mined, so you will reuse a nonce and get rejected — and you will burn your RPS budget. Fetch the "pending" count once at startup, then track and increment the nonce locally, reconciling against the RPC only on error.

Parameters

This method takes no parameters.

Returns

eth_getTransactionCount return value
FieldType
resultobject

Examples

curl https://triport.io/polygon \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionCount","params":[]}'
const res = await fetch("https://triport.io/polygon", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getTransactionCount",
  "params": []
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/polygon",
    headers={"Authorization": "Bearer <api-key>"},
    json={"jsonrpc":"2.0","id":1,"method":"eth_getTransactionCount","params":[]},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Chain: Polygon.
  3. Clusters: mainnet.
  4. Credit cost: 1 per call.

FAQ

What does eth_getTransactionCount do?
Returns the number of transactions sent from a Polygon address — i.e. its nonce — at a given block.
How many credits does eth_getTransactionCount cost?
eth_getTransactionCount costs 1 credit(s) per call on Triport by default.
Is eth_getTransactionCount available over WebSocket?
eth_getTransactionCount is an HTTP JSON-RPC method.