feat(address): optimize tx search with eth_getTransactionBySenderAndNonce#219
Conversation
…once Use reth's eth_getTransactionBySenderAndNonce RPC method for O(N) sent transaction discovery on Ethereum mainnet (chain ID 1), where N is the address nonce. Falls back gracefully to existing binary search if the method is unavailable. - Add dedicated reth provider config with 3 public reth RPCs (race strategy) - Add NonceLookupService for batched nonce-to-tx lookups - Search gaps between sent tx blocks for received/internal txs using adaptive segmentation with exponential narrowing for large gaps - Progressive interleaved delivery: walk newest-to-oldest alternating gap searches and sent tx delivery for correct chronological order - Fix address case normalization for consistent cache hits Closes openscan-explorer#211 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🚀 Preview: https://pr-219--openscan.netlify.app |
|
Performance Report — Clean Cache Test Address tested: 0x072f41AE99F250bD48835a88529309cbc16f59Ef Method: Cleared localStorage, sessionStorage, and IndexedDB on both versions before testing. Used in-app hash navigation from a different route to ensure no cached transactions. Polled DOM every 500ms to track when transactions appeared. Transaction Loading Timeline PR-219 (7adef3c): 0.0s → Searching... 0.0s → Searching...
|
MatiasOS
left a comment
There was a problem hiding this comment.
Tested some directions and it improved the times and UX
Description
Optimize address transaction search on Ethereum mainnet using reth's
eth_getTransactionBySenderAndNonceRPC method. This reduces sent-tx discovery from ~50+ binary search RPC calls to exactly N calls (where N = address nonce). Received/internal transactions are found via gap-based binary search between sent tx blocks.Related Issue
Closes #211
Type of Change
Changes Made
src/config/rethProviders.ts(new): 3 hardcoded reth RPC provider URLs with race strategy,NONCE_LOOKUP_CHAIN_ID = 1, singletongetRethClient()factorysrc/services/NonceLookupService.ts(new): Service wrappingeth_getTransactionBySenderAndNoncewithisAvailable(),fetchSentTransactions(), andfetchRecentSentTransactions()src/services/AddressTransactionSearch.ts:NonceLookupServiceinjection in constructorsearchWithNonceLookup()with 2-phase approach: nonce lookups → gap searchsrc/services/adapters/NetworkAdapter.ts:initTxSearch()accepts optionalNonceLookupServicesrc/services/adapters/EVMAdapter/EVMAdapter.ts: CreatesNonceLookupServicewith reth client for chain ID 1 onlysrc/locales/en/address.json+src/locales/es/address.json: 2 new i18n progress message keysKey design decisions
eth_getTransactionBySenderAndNonceis unavailable or fails, binary search runs unchangedNonceLookupServiceis only injected for chain ID 1onTransactionsFoundcall appends in correct chronological orderChecklist
npm run format:fixandnpm run lint:fixnpm run typecheckwith no errorsnpm run test:runAdditional Notes
Tested manually on Ethereum mainnet addresses with mixed sent/received transactions. Verified correct chronological ordering, progressive table population, and graceful fallback when reth providers are unavailable.
🤖 Generated with Claude Code