Appearance
eth_getTransactionCount
served · same as reth
Returns the nonce of an account at a block. This is the number of transactions that the account sent.
When to use
Use it to find the nonce for the next transaction of an account.
Example
bash
curl -s -X POST -H 'Content-Type: application/json' \
--data '{"jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionCount", "params": ["0xc917c3fa468f2c4b9c84c72caa46420eb9825249", "0x18facad"]}' \
http://127.0.0.1:8547json
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getTransactionCount",
"params": [
"0xc917c3fa468f2c4b9c84c72caa46420eb9825249",
"0x18facad"
]
}Response
Live mainnet, block 26193069, 2026-10-14. Checked against reth 2.7: equal.
json
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x25c31"
}Parameters
| Name | Type | Required | Meaning |
|---|---|---|---|
address | address (20 bytes, hex) | yes | The account. |
block | block number in hex, or a tag, see Block parameter | no | The block whose state to read. The head or one of the 128 blocks before it. Default: latest. |
Returns
The nonce as a hex string. An account that does not exist returns 0x0.
Notes and limits
- With
pending, the result starts from the nonce in the state after the pending block, as reth. A contract that the pending block creates has nonce 1. The result then adds the transactions of the account in the pool with the next nonces in sequence, as reth.cinder --servehas no pool and gives the nonce after its pending block, which has no transactions. - A block can wait to be written. For each sender in it, the node then keeps the nonce after its last pool transaction in the block. The result at
pendingstarts from that nonce, so it does not go back. A reorg that removes the block also removes the value.
Errors
| Code | Message | When |
|---|---|---|
| -32602 | Invalid params | A parameter is missing or does not parse. data has the text of reth, with the position. |
| -32001 | block not found: 0x... | The block is above the head or the hash is unknown. |
| 4444 | pruned history unavailable: requested N, earliest available M | The block is more than 128 blocks below the head. |
Compared with reth
With pending, reth and Cinder both add the transactions of the account in the pool.
The live example above gives the same answer on Cinder and on reth 2.7.
Related methods
eth_getBalance, eth_getTransactionBySenderAndNonce, eth_sendRawTransaction.
Schema (OpenRPC)
The official specification: eth_getTransactionCount in ethereum/execution-apis.
Parameter Address: string
json
{
"pattern": "^0x[0-9a-fA-F]{40}$",
"title": "hex encoded address",
"type": "string"
}Parameter Block: Block number or Block tag or Block hash
json
{
"anyOf": [
{
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "Block number",
"type": "string"
},
{
"description": "`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error",
"enum": [
"earliest",
"finalized",
"safe",
"latest",
"pending"
],
"title": "Block tag",
"type": "string"
},
{
"pattern": "^0x[0-9a-f]{64}$",
"title": "Block hash",
"type": "string"
}
],
"title": "Block number, tag, or block hash"
}Result: string
json
{
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "hex encoded unsigned integer",
"type": "string"
}