For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_getTransactionCount - Flashblocks

Example code for the eth_getTransactionCount Flashblocks method. Complete guide on how to use eth_getTransactionCount Flashblocks in GetBlock Web3 documentation.

This returns the transaction count (nonce) for an address. When called with "pending", the returned nonce already accounts for transactions currently sitting in Flashblocks — preventing nonce collisions when an account submits many transactions in rapid succession.

This is especially valuable for high-frequency trading bots and any application that fires more than one transaction per 2-second block.

Parameters

Parameter
Type
Required
Description

address

DATA (20 bytes)

Yes

Address to check

block

QUANTITY

TAG

Yes

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionCount",
    "params": [
        "0x7a25d0f0Ff6a25f36De0a19C3d5f6dC2C6EAeD6a",
        "pending"
    ],
    "id": "getblock.io"
}'
import axios from 'axios';

const data = JSON.stringify({
    "jsonrpc": "2.0",
    "method": "eth_getTransactionCount",
    "params": [
        "0x7a25d0f0Ff6a25f36De0a19C3d5f6dC2C6EAeD6a",
        "pending"
    ],
    "id": "getblock.io"
});

const config = {
    method: 'post',
    url: 'https://go.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => console.log(JSON.stringify(response.data, null, 2)))
    .catch(error => console.log(error));

Response Example

Response Parameters

Field
Type
Description

result

QUANTITY

Transaction count / next nonce in hex, including transactions in Flashblocks

Use Cases

  • Constructing the next transaction with the correct nonce, even during high-frequency submission

  • Preventing 'nonce too low' errors when submitting multiple transactions per block

  • Trading bot infrastructure — the primary use case for the pending nonce

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32603

Internal error

Server-side error while processing the request

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?