Skip to content

Conversation

@AugustoL
Copy link
Collaborator

@AugustoL AugustoL commented Jan 20, 2026

Description

Add transaction history search functionality for addresses using a binary search algorithm that works without requiring an indexer. Transactions are found by searching blockchain state changes (nonce/balance) and cached locally for performance.

Related Issue

Closes #154

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring
  • Performance improvement
  • Other (please describe):

Changes Made

New Features

  • Implement binary search on blockchain state (nonce/balance) to find address transactions without requiring an indexer
  • Add streaming support to display transactions as they are found
  • Support internal transaction detection by scanning calldata and logs
  • Add search controls with configurable limits (5, 10, 50, all)
  • Add Load More functionality to fetch older transactions
  • Add progress bar with cancel button during search
  • Cache transactions in localStorage with 1-week expiry
  • Add Search Recent Transactions button to find new txs since cache
  • Add Clear tx cache button to reset cached data
  • Show block range indicating which blocks were searched

Bug Fixes

  • Fix Load More button not triggering new search by adding searchVersion counter
  • Fix progress bar showing wrong numbers by using searchLimit as target
  • Fix table clearing when oldestSearchedBlock updates (race condition)
  • Hide Load More button when search is complete

Refactoring

  • Move transaction search logic to TransactionHistory component
  • Encapsulate all transaction search state and logic within TransactionHistory
  • Replace any types with proper EthTransaction types

Screenshots (if applicable)

N/A

Checklist

  • I have run npm run format:fix and npm run lint:fix
  • I have run npm run typecheck with no errors
  • I have run tests with npm run test:run
  • I have tested my changes locally
  • I have updated documentation if needed
  • My code follows the project's architecture patterns

Additional Notes

The binary search algorithm efficiently finds transactions by detecting state changes (nonce for outgoing, balance for incoming) without needing a blockchain indexer. Results are cached locally to avoid re-searching the same block ranges.

…rithm

- Implement binary search on blockchain state (nonce/balance) to find
  address transactions without requiring an indexer
- Add streaming support to display transactions as they are found
- Support internal transaction detection by scanning calldata and logs
- Add search controls with configurable limits (5, 10, 50, all)
- Add Load More functionality to fetch older transactions
- Add progress bar with cancel button during search
- Display Block column in transaction history table
- Optimize internal tx detection to check calldata first (no RPC calls)
- Add rate limiting with smaller batches to avoid 429 errors
- Fix Load More button not triggering new search by adding searchVersion
  counter to force effect re-run
- Fix progress bar showing wrong numbers by using searchLimit as target
  and capping at 95% while searching
- Show completed progress bar (100%) when search finishes
- Hide Load More button when transactionsResult.isComplete is true
- Use txCount (nonce) as minimum estimate for progress calculation
- Simplify state by removing unnecessary isLoadMore and prevTxCount
…ache

- Cache transactions in localStorage with 1-week expiry
- Add "Search Recent Transactions" button to find new txs since cache
- Add "Clear tx cache" button to reset cached data
- Show block range indicating which blocks were searched
- Fix block range to show "from block 0" when full history searched
- Add fromBlock support in search algorithm for search recent feature
Encapsulate all transaction search state and logic within TransactionHistory
component instead of passing 12+ props from address index. The component
now manages its own:
- Transaction cache (localStorage with 1-week expiry)
- Search state (triggered, searching, limit, version)
- Cache state (hasCachedData, oldestSearchedBlock)
- All handlers (start, cancel, load more, search recent, clear cache)

TransactionHistory now only needs 4 props: networkId, addressHash,
contractAbi (optional), and txCount (optional).
Remove oldestSearchedBlock from useEffect dependency array to fix race
condition where the effect re-runs after search completes, finds refs
already cleared, and incorrectly clears the transaction table.
…ransactions

feat(address): add transaction history search with binary search algorithm
@github-actions
Copy link

🚀 Preview: https://pr-165--openscan.netlify.app
📝 Commit: e563fe4b8281d908820b1d064cdff57263e618b4

@AugustoL AugustoL changed the title Fix/remove package lock json feat(address): add transaction history search with binary search algorithm Jan 20, 2026
@AugustoL
Copy link
Collaborator Author

This PR was already merged to main by mistake on #154

Now we are mergin it to dev branch and also fixing the conflicts by removing the package lock json file.

@AugustoL AugustoL merged commit 780736e into openscan-explorer:dev Jan 20, 2026
2 of 3 checks passed
@AugustoL AugustoL mentioned this pull request Jan 20, 2026
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.

1 participant