eth_getTransactionCount

The eth_getTransactionCount method returns the number of transactions sent from an address (the account nonce). This method is essential for creating new transactions as the nonce must be correctly set to ensure proper transaction ordering and prevent replay attacks.


Wallets use this to determine the next nonce value when constructing and signing new transactions. The nonce ensures transactions from an account are processed in order and prevents the same transaction from being executed multiple times. Developers use this when preparing transactions, tracking account activity, and ensuring transaction sequencing. Using 'pending' as the block parameter includes pending transactions in the count, which is important for sending multiple transactions in quick succession.

Parameters

parameter
type
description
address
string (required)
The address to get transaction count for (20-byte hex string with 0x prefix)
blockParameter
string (required)
Block number in hex format (e.g., '0x10d4f') or one of the string tags: 'latest' for confirmed transactions, 'earliest' for all transactions since genesis, or 'pending' to include pending transactions in the mempool
Return Object
field
type
description
result
string
The transaction count (nonce) for the address encoded as a hexadecimal string. This represents the number of transactions sent from this address. For a new account with no transactions, this returns "0x0". Use this value as the nonce for the next transaction from this address.
Request Example
Request
Response Example
Response

Share on
Share on FacebookShare on XShare on LinkedIn
Did you find this page useful?