Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We can first discussed if we want those endpoints or not. The idea comes from this discussion, we currently could have the number of addresses using the rich-list app, but it might not be the more reliable solution to depend on a third-party app, rather than using our explorer-backend.
We know that counting is slow in PG, but we can use our cache and have some long timeout, like 1 to 5min for such data IMO.
The first endpoint
/infos/total-addresses
returns every addresses that have at least 1 tx.The second
/infos/total-holders-estimation
only return addresses with balance > 0. This is an estimation because if we want the real number, we would need to join the Outputs and Inputs, which is too much expensive. Here we only count the addresses with an empty finalized spent output, but to do the finalization time, we can have a difference.The current estimation is 92228, so on our website and explorer, we could definitively show:
More than 92K holders
there are around 90 addresses more when estimate.