I want to stream all payments from stellar so I can see when I receive a payments for public keys stored in db (could be hundreds).

It works fine, but when there are a lot of operations, it starts to get a lot of delay (that only get resolved when there a less operations). Here is my piece of code:

func main() {
    client := horizonclient.DefaultPublicNetClient
    opRequest := horizonclient.OperationRequest{Cursor: "now"}

    ctx, _ := context.WithCancel(context.Background())

    printHandler := func(op operations.Operation) {
        go func() {
            // Do something here
    err := client.StreamPayments(ctx, opRequest, printHandler)
    if err != nil {

Am I doing something wrong?

Thank you! :)

  • Could you add some numbers? How many operations and how much delay? – ire_and_curses Aug 19 at 16:27
  • This was a month ago I don't have exact numbers, but it was when more than 200 operations per second, I would get more and more delay (could be dozen of minutes). It actually works fine right now, so I can't give an exact number. But with the JS SDK, for a similar piece of code, if I start my script now I'll get 10mn delay after 2mn running, and it gets worse and worse. – Arvi89 Aug 20 at 7:38
  • I meant ledger btw. – Arvi89 Aug 20 at 14:55
  • 1
    which Horizon server are you pointing at? You may be hitting rate limiting if you are using SDF servers. – ire_and_curses Aug 20 at 18:39
  • Oh that might be the case then, I was pointing on SDF servers. Thank you! :) – Arvi89 Aug 21 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.