Skip to content

Python

Yellowstone publishes no Python client of its own, so generate one from its geyser.proto with grpcio-tools, 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.

pip install grpcio grpcio-tools
python -m grpc_tools.protoc -I proto --python_out=. --grpc_python_out=. proto/geyser.proto proto/solana-storage.proto
import os
import grpc
import geyser_pb2
import geyser_pb2_grpc

channel = grpc.secure_channel("your-region-endpoint:443", grpc.ssl_channel_credentials())
stub = geyser_pb2_grpc.GeyserStub(channel)

def requests():
    yield geyser_pb2.SubscribeRequest(
        slots={"slots": geyser_pb2.SubscribeRequestFilterSlots()},
        commitment=geyser_pb2.CommitmentLevel.PROCESSED,
    )

metadata = [("x-token", os.environ["SLIPSTREAM_KEY"])]
for update in stub.Subscribe(requests(), metadata=metadata):
    print(list(update.filters), update.WhichOneof("update_oneof"))

The endpoint for each region is on regions & endpoints.