eth_getTransactionCount
Returns the number of transactions sent from an address.
Parameters
Section titled “Parameters”DATA(20 bytes) — Address.QUANTITY|TAG— Block number, or"latest","earliest","pending".
Returns
Section titled “Returns”QUANTITY — Integer of the number of transactions sent from this address.
Request
Section titled “Request”curl -X POST https://eth-mainnet.blockreq.com/v1/rpc/public \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "method": "eth_getTransactionCount", "params": ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "latest"], "id": 1 }'Response
Section titled “Response”{ "jsonrpc": "2.0", "id": 1, "result": "0x29d"}Code Examples
Section titled “Code Examples”JavaScript (ethers.js v6)
Section titled “JavaScript (ethers.js v6)”import { JsonRpcProvider } from "ethers";const provider = new JsonRpcProvider("https://eth-mainnet.blockreq.com/v1/rpc/YOUR_API_KEY");const nonce = await provider.getTransactionCount("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");console.log("Nonce:", nonce);Python (web3.py)
Section titled “Python (web3.py)”from web3 import Web3w3 = Web3(Web3.HTTPProvider("https://eth-mainnet.blockreq.com/v1/rpc/YOUR_API_KEY"))nonce = w3.eth.get_transaction_count("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")print(f"Nonce: {nonce}")RU Cost
Section titled “RU Cost”| Method | Cost |
|---|---|
| eth_getTransactionCount | 10 RU |