Skip to main content
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.