Skip to main content
POST
/
eth_getTransactionCount
curl --request POST \
  --url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getTransactionCount",
  "params": [
    "0xa54F56e8Cfff25b17105d6073aB0f0E7DA087225",
    "latest"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}
Monad API method that returns the number of transactions sent from an address. This is also known as the account nonce, which is used to prevent transaction replay and ensure proper transaction ordering.
Get you own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • data — the 20-byte address.
  • quantity or tag — integer block number, or the string latest, earliest, or pending.

Response

  • result — the number of transactions sent from the address, encoded as hexadecimal.

eth_getTransactionCount code examples

const { ethers } = require("ethers");

const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");

async function getTransactionCount() {
  const address = "0xa54F56e8Cfff25b17105d6073aB0f0E7DA087225";
  const nonce = await provider.getTransactionCount(address);
  console.log(`Transaction count: ${nonce}`);
}

getTransactionCount();

Use case

A practical use case for eth_getTransactionCount is obtaining the correct nonce when manually constructing transactions, ensuring they are processed in the correct order.

Body

application/json
id
integer
default:1
jsonrpc
string
default:2.0
method
string
default:eth_getTransactionCount
params
string[]

Response

200 - application/json

The number of transactions sent from the address.

jsonrpc
string
id
integer
result
string