indexer icon indicating copy to clipboard operation
indexer copied to clipboard

Add ability to search for online accounts

Open urtho opened this issue 1 year ago • 0 comments

Problem

There is no way to quickly fetch all online accounts[^1].

Solution

  • Add is-online boolean filter to account search endpoint
  • Add is-reward-eligible boolean filter to account search endpoint
  • Add expires-in-hours filter that returns only accounts that will expire no later than expires-in-hours
  • Add appropriate optional partial index (for is-online only)

Response model should include:

  • total online stake
  • total eligible online stake
  • avg block time for the last 100 rounds in milliseconds

Notes:

  • is-reward-eligible assumes is-online
  • expires-in-hours should calculate avg block time over last 100 blocks using a query to block_header
  • return only accounts with non-expired keys (as online flag persists past key expiry)
  • expires-in-hours might need a better name like expires-in-hours-or-less but shorter ;)

[^1]: This is a placeholder issue - Nodely is going to do PR for that soon, following tests on light-indexer and fnet

urtho avatar Sep 09 '24 13:09 urtho