stacks-blockchain-api icon indicating copy to clipboard operation
stacks-blockchain-api copied to clipboard

Obtain number of BNS names registered against a namespace.

Open bilalanees98 opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. A way to figure out how many BNS Names have been registered overall and for a particular namespace.

Describe the solution you'd like There already are APIs that return paginated responses of the names that are registered. An additional field of the total number of names known to the node would really help with BNS/Namespace analytics.

Describe alternatives you've considered A way of figuring out these numbers is to run a binary search algo for figuring out the last valid value of the query param "page". Its a janky solution but it works.

Additional context API doc links:

  • https://hirosystems.github.io/stacks-blockchain-api/#tag/Names/operation/get_all_names
  • https://hirosystems.github.io/stacks-blockchain-api/#tag/Names/operation/get_namespace_names

bilalanees98 avatar Apr 19 '23 09:04 bilalanees98

@bilalanees98 Could you share more about your use case here, so we can better understand the impact of completing this?

smcclellan avatar Apr 20 '23 15:04 smcclellan

@smcclellan I am trying to collect and display the number of BNS names against each namespace on a website. The idea is to share 'realtime' data with users.

bilalanees98 avatar Apr 21 '23 05:04 bilalanees98

Thanks @bilalanees98 ... as far as technical implementation @smcclellan this would involve creating a new PG materialized view that keeps total domain count for each available namespace. I have set the priority and size accordingly.

rafaelcr avatar Apr 24 '23 20:04 rafaelcr