4

How I can get notify (like newblockinfo in bitcoin or getlastblock in ethereum or bitcoin) on new ledger in blockchain with go-sdk

5

Just use Client.StreamLedgers method:

client := DefaultPublicNetClient
cursor := Cursor("now")

// Call `cancel()` to stop streaming
ctx, cancel := context.WithCancel(context.Background())

err := client.StreamLedgers(ctx, &cursor, func(l Ledger) {
    fmt.Println(l.Sequence)
})

if err != nil {
    fmt.Println(err)
}

Your Answer

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

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