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

burnchain rewards change over time

Open aulneau opened this issue 4 years ago • 4 comments

Hi there!

I rely pretty heavily on the burnchain rewards endpoints for constructing state for stacking.club, but i've noticed that over time, sometimes the data associated with a given reward can change. Some things I've noticed are this:

  • the reward_index can change
  • the block_hash can change
  • the recipient of the reward can change (very rarely but it happens)

I understand that much of this behavior is likely a symptom of forking or some other chain state changes. I was curious if there would be some kind of information that can be added to each reward item that can be deterministically generated, eg reward_hash that will persist between chain state changes?

Thanks!

aulneau avatar Dec 04 '21 17:12 aulneau

What time periods are you seeing these change? If it's simply re-orgs causing it, then one solution could be only ever using data from blocks that have 3-5 or more confirmations. The app will be a couple hours behind but that's probably okay in this case?

zone117x avatar Dec 06 '21 10:12 zone117x

I don't have detailed enough information to know when this happens, i only learn of it when the data is incorrect after the fact.

The confirmations idea makes sense and is actually something i can probably handle in my own service. I think having both would be useful.

I think ideally the rewards item would contain a confirmations key that would update after X confirmations. Do you think that would be possible? that way folks can choose to use the latest data, or data after X confirmations.

aulneau avatar Dec 06 '21 15:12 aulneau

I think ideally the rewards item would contain a confirmations key that would update after X confirmations. Do you think that would be possible? that way folks can choose to use the latest data, or data after X confirmations.

Yeah I think most payloads could include a confirmations key, it's simply (current block height - block height of item). Would probably be useful to have something like a ?min_confirmations=<number> on a lot of endpoints as well.

zone117x avatar Dec 06 '21 15:12 zone117x

it's simply (current block height - block height of item)

Yeah I'm thinking in the short term i can implement some kind of check for this and watch for duplicates that way

Would probably be useful to have something like a ?min_confirmations= on a lot of endpoints as well.

yeah, agreed!

aulneau avatar Dec 06 '21 16:12 aulneau

Closing this one due to age. Please reopen if still requested.

smcclellan avatar Sep 08 '23 20:09 smcclellan