1

I want to poll the TzKT REST API for new delegation operations on the Tezos network (GetDelegations API) but after reading this article I also want to be efficient in this goal.

As stated in the article, some data only changes at the pace of new blocks being created, but as a beginner in this domain I am not sure if that is the same for delegation operations.

Should I rely on the timeBetweenBlocks constant of the protocol and update only after each block creation?

1 Answer 1

1

Delegation is an on-chain operation, therefore it can't happen outside of a block. So yes it doesn't make any sense to poll more frequently than once per block. Depending on your usecase of course, even polling once per block could be very excessive, as users usually delegate once and then leave their baker selection in place for many weeks, months or years. Only during protocol upgrades, like the one currently taking place, would you see a high amount of delegation events in a short period of time

TzKT also includes a websocket interface relying on the C# technology, SingalR. You could use this to listen to delegation events, and if you require more info, do a new tzkt request at the point that you are told there has been an event

e.g. https://api.tzkt.io/#section/SubscribeToOperations

Your Answer

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

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