⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

eth_getTransactionCount

Overview

Returns the number of transactions sent from an address up to a block tag (the account nonce).

Movement-Specific Considerations

  • Same behavior as Ethereum; use this to pick a nonce when constructing transactions.

Parameters

NameTypeRequiredDescription
address0x-hexYesEVM address
blockTagstringYeslatest, pending, or hex block number

Returns

Hex string nonce.

Code Examples

cURL

curl -X POST https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0x0000000000000000000000000000000000000000","latest"],"id":1}'

Ethers.js v6

import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1');
const nonce = await provider.send('eth_getTransactionCount', ['0x0000000000000000000000000000000000000000','latest']);
console.log(nonce);

Web3.js

import Web3 from 'web3';
const web3 = new Web3('https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1');
const nonce = await web3.eth.getTransactionCount('0x0000000000000000000000000000000000000000','latest');
console.log(nonce);

viem

import { createPublicClient, http } from 'viem';

const movement = {
id: 3073,
name: 'Movement',
nativeCurrency: { name: 'MOVE', symbol: 'MOVE', decimals: 18 },
rpcUrls: { default: { http: ['https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1'] } },
} as const;

const client = createPublicClient({ chain: movement, transport: http('https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1') });
const nonce = await client.getTransactionCount({ address: '0x0000000000000000000000000000000000000000', blockTag: 'latest' });
console.log(nonce);