hirosystems / stacks-blockchain-api

API for the Stacks blockchain
https://stacks-blockchain-api.vercel.app
GNU General Public License v3.0
170 stars 108 forks source link

Obtain number of BNS names registered against a namespace. #1622

Open bilalanees98 opened 1 year ago

bilalanees98 commented 1 year ago

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:

smcclellan commented 1 year ago

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

bilalanees98 commented 1 year ago

@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.

rafaelcr commented 1 year ago

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.