Skip to content

Go

Yellowstone publishes no Go client of its own, so generate one from its geyser.proto with protoc-gen-go and protoc-gen-go-grpc, then call it like any gRPC service: TLS to your region's endpoint on port 443, with your API key as the x-token metadata.

conn, err := grpc.NewClient(
    "your-region-endpoint:443",
    grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),
)
if err != nil {
    log.Fatal(err)
}
ctx := metadata.AppendToOutgoingContext(context.Background(), "x-token", os.Getenv("SLIPSTREAM_KEY"))

stream, err := pb.NewGeyserClient(conn).Subscribe(ctx)
if err != nil {
    log.Fatal(err)
}
processed := pb.CommitmentLevel_PROCESSED
err = stream.Send(&pb.SubscribeRequest{
    Slots:      map[string]*pb.SubscribeRequestFilterSlots{"slots": {}},
    Commitment: &processed,
})
for err == nil {
    var update *pb.SubscribeUpdate
    if update, err = stream.Recv(); err == nil {
        log.Println(update.GetFilters(), update.GetSlot())
    }
}
log.Fatal(err)

pb is the package you generated. The endpoint for each region is on regions & endpoints.