Skip to content

Improves the performance of wallet import and address discovery by optimizing rate limiting!#528

Merged
jamespepper81 merged 2 commits into
mainfrom
dev
Jan 29, 2026
Merged

Improves the performance of wallet import and address discovery by optimizing rate limiting!#528
jamespepper81 merged 2 commits into
mainfrom
dev

Conversation

@jamespepper81
Copy link
Copy Markdown
Contributor

This pull request significantly improves the performance of wallet import and address discovery by optimizing rate limiting and parallelizing previously sequential operations. The main changes focus on increasing throughput while still respecting upstream API limits, resulting in much faster wallet imports and address discovery.

Performance and Parallelization Improvements:

  • Updated rate limiting configuration in esplora-service.ts to allow up to 3 concurrent requests with a reduced delay of 350ms, increasing throughput to approximately 8.5 requests per second, which accelerates wallet imports without exceeding API rate limits.
  • Refactored address discovery in discoverUsedAddresses (in wallet-service.ts) to:
    • Discover external and internal chains in parallel, instead of sequentially.
    • Batch address checks are now performed in parallel within each chain, leveraging the improved rate limiting.
  • Optimized wallet data retrieval in getWalletData (in wallet-service.ts) by fetching UTXOs, transactions, and stats for each address in parallel, instead of sequentially, further speeding up wallet data loading.

claude and others added 2 commits January 28, 2026 23:09
- Parallelize per-address API calls (UTXOs, txs, stats) using Promise.all
- Parallelize external/internal chain discovery (both chains fetched concurrently)
- Increase MAX_CONCURRENT_REQUESTS from 1 to 3 (~8.5 req/sec vs ~1 req/sec)
- Reduce RATE_LIMIT_DELAY_MS from 1000ms to 350ms
- Circuit breaker and exponential backoff handle any 429 errors gracefully

These changes reduce wallet import time from ~40-50 seconds to ~5-10 seconds
for a typical wallet with 15 used addresses.

https://claude.ai/code/session_01T8hFWQAwQcbDckqR4zwNfF
…t-61Lnm

perf: optimize wallet import transaction fetching speed
@jamespepper81 jamespepper81 merged commit 9a8ee0f into main Jan 29, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants