0

I have list of delegator addresses for one baker. I want to get how many tokens they delegated using tezos api. Could anyone help me to get delegation amount?

1 Answer 1

3

In a previous question you were given a link to TzKT indexer API. This API will likely offer the vast majority of things you need. Please make sure you read/research their documentation, as it is very detailed.

The question you've asked is not as simple as you think. Because delegating on Tezos follows liquid-POS, it means users can have a different amount delegated every cycle (~3 days). This API returns an array of cycle reward details for a given address. The stakingBalance in each object is what the user delegated: https://api.tzkt.io/#operation/Rewards_GetDelegatorRewards

Also note that the first 5 cycles are future cycles, with the 6th being the current in-progress cycle. There are other API's available for cycle info

7
  • Thank you for your answer. Could you please confirm if balance is delegated amount? I think it is account balance.
    – Heindrick
    Nov 24, 2022 at 12:26
  • @Heindrick sorry its "stakingBalance". A user only ever delegates their entire balance, staking balance is a record of what the users balance was at the time the rewards were calculated (6 cycles ahead)
    – Simon McLoughlin
    Nov 24, 2022 at 12:33
  • Ah, it means, user must delegate entire balance in tezos? Is it impossible to delegate partial?
    – Heindrick
    Nov 24, 2022 at 14:13
  • @Heindrick not possible to delegate partial. There is no lock up time, there is no need to partially delegate
    – Simon McLoughlin
    Nov 24, 2022 at 14:18
  • 1
    @Heindrick yes, you would need to create two wallets and split your funds. Delegating each wallet to a different baker
    – Simon McLoughlin
    Nov 25, 2022 at 7:29

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.