eth_getTransactionCount

zkLink Nova chain RPC Methods & API Documentation


eth_getTransactionCount RPC method

The eth_getTransactionCount JSON-RPC method on zkLink Nova is used to retrieve the number of transactions sent from the given address.

Returns

Trasaction count - An integer representing the number of transactions sent from this address encoded as hexadecimal.

Parameters

address [required] - String - The address (20 bytes) to check for transaction count.

blockNumber or Tag [required] - Block number as hexadecimal or a Tag ("latest", "earliest", "pending", "safe" or "finalized").

"Safe" and "finalized" are only availible on Ethereum and Arbitrum One chains. Read block parameter description (opens in a new tab).

Need RPC API keys?

Get 12.5M archival requests for free today.

Request

POST https://<network>.chainnodes.org/YOUR-API-KEY

Example

  • HTTPS POST Request with a JSON RPC call in the body
  • Replace YOUR-API-KEY with the API key from your CHAINNODES.ORG Dashboard
  • You can use a different supported network by replacing zklink-nova-mainnet
curl https://zklink-nova-mainnet.chainnodes.org/YOUR-API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0x5F927395213ee6b95dE97bDdCb1b2B1C0F16844F", "latest"],"id":1}'

💡 Confusing?

Ask our experienced blockchain developers in Telegram

Body

{
   "jsonrpc": "2.0",
   "id": 1,
   "result": "0x4490"
}

Possible use cases of eth_getTransactionCount

  1. Transaction Generation: When creating a new transaction, the nonce (which must be included in the transaction) is determined by the number of transactions sent from the sender's address. eth_getTransactionCount is used to retrieve this number.
  2. Address Activity Analysis: This method is often used to track the activity level of an address. For example, a high transaction count might indicate a frequently used address.
  3. Blockchain Explorers: Blockchain explorers use this method to provide information about the number of transactions an address has made.
  4. Security Checks: In some cases, for example, a sudden increase in the transaction count, could indicate a security issue like a hacked account. eth_getTransactionCount could be used as part of a system to monitor and alert for such anomalies.