stacks-blockchain-api
stacks-blockchain-api copied to clipboard
Add an endpoint to map a PoX Bitcoin address to its stackers
Is your feature request related to a problem? Please describe. I don't believe there is currently an easy way to map from a Bitcoin address to the corresponding stacker(s). This would be especially useful when counting SIP votes that are cast on Bitcoin, because we need to map the Bitcoin address to a Stacks address to determine the voting power of that account. The API's event observer is likely already seeing the events with the necessary information to track this.
Describe the solution you'd like
I would like an endpoint that takes in a Bitcoin address as a parameter and returns a list of Stacks addresses receiving PoX rewards to this address. In the case of a solo-stacker, there will be a one-to-one mapping that can be obtained from the stack-stx event. In the case of a delegated stacker, there may be more than one Stacks address mapping to a PoX Bitcoin address. This info can be extracted from the stack-aggregation-commit-indexed events.
Describe alternatives you've considered The alternative is for anyone who needs this information to either track these events on their own as they come in, or query the API for all of the events from the pox-4 contract and search for the address they need. Tracking it in our API would be more efficient.
If there are better options that you can think of, please let me know.