Skip to content

Optimize eth_getBalance by excluding unnecessary transaction data #4553

@quiet-node

Description

@quiet-node

Problem

The eth_getBalance RPC method currently fetches unnecessary transaction data when querying account information from the Mirror Node. For high-volume accounts, this leads to:

  • Slower response times due to retrieving and processing transaction history that isn't needed
  • Unnecessary load on the Mirror Node database
  • Potential timeouts for accounts with large transaction counts

The Mirror Node /api/v1/accounts/{id} endpoint supports a transactions query parameter that can be set to false to exclude transaction data, but the relay doesn't currently use this optimization.

Solution

Add the transactions=false query parameter when calling the Mirror Node accounts endpoint for balance queries.

Benefits:

  • Faster response times for eth_getBalance calls
  • Reduced Mirror Node database load
  • Better performance for all accounts, especially high-volume ones
  • More efficient resource usage

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions