Quick copy paste snippets for Mevlink's streamer-go
Make sure to replace the <api-key-id> and <api-key-secret> in these examples with your own credentials after signing up and purchasing a plan on mevlink.com.
Go Streamer
// mevlink/stream.gopackagemainimport ("encoding/hex""log""time" mlstreamer "github.com/mevlink/streamer-go""golang.org/x/crypto/sha3")funcmain() {// create streamervar str = mlstreamer.NewStreamer("<api-key-id>", "<api-key-secret>", 1)// transaction callback str.OnTransaction(func(txb []byte, hash mlstreamergo.NullableHash, noticed time.Time, propagated time.Time) {//Getting the transaction hash and printing the relevant timesvar hasher = sha3.NewLegacyKeccak256() hasher.Write(txb)var tx_hash = hasher.Sum(nil) log.Println("Got tx '" + hex.EncodeToString(tx_hash) + "'! Was noticed on ", noticed, "and sent on", propagated)
}) log.Fatal(str.Stream())}