1

I want to get pool(private pool) reward for specific epoch.

I searched blockfrost.io apis, can't find reward api.

How can I get reward by api? Or other solution will be fine like graphql.

2 Answers 2

1

You need to look at the specific pool's history using the pools/{pool_id}/history endpoint.

[
  {
    "epoch": 233,
    "blocks": 22,
    "active_stake": "20485965693569",
    "active_size": 1.2345,
    "delegators_count": 115,
    "rewards": "206936253674159",
    "fees": "1290968354"
  }
]

See docs.blockfrost.io.

3
  • Thank you for your answer. For private pool, reward amount is always 0. It seems all reward value become margin. Is it possible to get margin value in the pool history?
    – Heindrick
    Dec 1, 2022 at 14:52
  • It should not be 0 I think. Are you sure you're not looking at the first epoch of the pool, where it does not participate in staking yet? Dec 1, 2022 at 15:33
  • The historical values of the pool margin value are available in db-sync. Dec 1, 2022 at 21:57
0

As the main dev on db-sync I can tell you how to get it there.

In the simplest manner possible (with randomly chosen pool and epoch):

# select id, view from pool_hash where view =
    'pool19u64770wqp6s95gkajc8udheske5e6ljmpq33awxk326zjaza0q' ; 
 id |                           view                           
----+----------------------------------------------------------
 13 | pool19u64770wqp6s95gkajc8udheske5e6ljmpq33awxk326zjaza0q
(1 row)
# select sum (amount) / 1000000 as ada_reward from reward where earned_epoch = 354 
    and pool_id = 16 and type = 'member' ; 
     ada_reward     
--------------------
 13856.795160000000
(1 row)

This could be made into a single query with a join of the two tables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.