eth_getTransactionCount - Monad

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

This method returns the number of transactions sent from an address (the nonce).

Parameters

Parameter
Type
Required
Description

address

string

Yes

The address to get the transaction count for.

blockNumber

string

No

Block number in hex, or "latest", "earliest", "pending", "safe", "finalized".

Request

curl
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionCount",
    "params": ["0x727752abbf7a9ef2f3c15e322dd43bf642d26eb7", "latest"],
    "id": "getblock.io"
}'

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "0x1a"
}

Response Parameters

Field
Type
Description

result

string

The number of transactions sent from the address in hexadecimal.

Use Case

The eth_getTransactionCount method is essential for:

  • Getting the correct nonce for new transactions

  • Transaction building and signing

  • Detecting pending transactions

  • Wallet transaction management

  • High-frequency trading nonce management

  • Account activity analysis

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN.

-32602

Invalid params

Invalid address format.

-32000

Resource not found

Block not found.

-32601

Failed to parse request

syntax error

Web3 Integration

Last updated

Was this helpful?