eth_getTransactionCount
Last updated:
`eth_getTransactionCount` returns the total number of transactions that have been sent *from* the given account, counted up to the specified block. Because Ethereum assigns each transaction a sequential nonce starting at `0`, this count **is** the account's current nonce.
The single most common use is to obtain the next nonce when building and signing a transaction. Query the address against the `pending` block tag — the result is exactly the nonce you should assign to your next outgoing transaction, accounting for any transactions you have already broadcast but that are not yet mined.
The result is returned as a hex-encoded quantity (e.g. `"0x1f"` for 31). Querying against `latest` counts only mined transactions, while `pending` also includes transactions sitting in the mempool — the two can differ if you have in-flight transactions.
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionCount","params":[]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "eth_getTransactionCount",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"eth_getTransactionCount","params":[],"jsonrpc":"2.0"})
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet.
- Credit cost: 1 per call.
FAQ
- What does eth_getTransactionCount do?
- Returns the number of transactions sent from an address — 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.