Skip to content

Better support for local block explorers #32011

@paulmillr

Description

@paulmillr

I've built esplr - private eth explorer. It's getting more popular, but still can't be ran on geth. The functionality of fetching account data from a node can be useful to wallets and other apps. Especially if we make it cross-chain.

What's needed

This is not a question of making "archive node" support reasonable with Geth. This is more general than that. Looking for:

  • A way to get a full list of historical token transfers for an account.
  • A way to get current token balances for an account

Initial thoughts on how this can be solved:

a. Add additional indexes. Perhaps target next major version if that requires DB change / resync.
b. Implement additional APIs to get list of token balances and token tx histories.
c. Utilize ots_ RPC namespace to replace trace_filter calls
d. Something else? I don't know Geth architecture, the team prob knows better

Esplr uses logic from micro-eth-signer archive.ts to implement exploring:

const res = await this.call('trace_filter', {
fromBlock: undefined,
toBlock: undefined,
toAddress: [address],
fromAddress: [address],
});

// tokenTransfers
this.ethLogs(ERC_TRANSFER.topics({ from: address, to: null, value: null }), opts), // From
this.ethLogs(ERC_TRANSFER.topics({ from: null, to: address, value: null }), opts), // To

// erc1155Transfers
this.ethLogs(
  ERC1155_SINGLE.topics({ operator: null, from: address, to: null, id: null, value: null }),
  opts
),
this.ethLogs(
  ERC1155_SINGLE.topics({ operator: null, from: null, to: address, id: null, value: null }),
  opts
),
// Batch
this.ethLogs(
  ERC1155_BATCH.topics({ operator: null, from: address, to: null, ids: null, values: null }),
  opts
),
this.ethLogs(
  ERC1155_BATCH.topics({ operator: null, from: null, to: address, ids: null, values: null }),
  opts
),

Steps to reproduce

Try using esplr (purely client-side web app) with geth

https://paulmillr.com/apps/esplr/

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions