# Program Streams Quickstart

> Open a decoded program event stream with Python.

Canonical: https://nolimitnodes.com/docs/api-reference/program-streams/quickstart

## Install tools

```bash
python -m pip install grpcio grpcio-tools protobuf
curl -O https://nolimitnodes.com/protos/program-streams.proto

python -m grpc_tools.protoc \
  -I . \
  --python_out=. \
  --grpc_python_out=. \
  program-streams.proto
```

## List topics

```python

channel = grpc.secure_channel(
    "events.nln.clr3.org:443",
    grpc.ssl_channel_credentials(),
)
client = rpc.StreamServiceStub(channel)
metadata = [("x-api-key", "YOUR_API_KEY")]

topics = client.ListTopics(pb.ListTopicsRequest(), metadata=metadata)
for topic in topics.topics:
    print(topic.name)
```

## Fetch the payload schema

```python
topic = "solana.pump_fun.trade_event"

schema = client.GetTopicSchema(
    pb.GetTopicSchemaRequest(topic=topic),
    metadata=metadata,
)

print(schema.message_type)
print(schema.proto_schema)
```

## Subscribe to JSON

```python

request = pb.SubscribeRequest(topic=topic, format=pb.JSON)

for message in client.Subscribe(request, metadata=metadata):
    event = json.loads(message.payload)
    print(message.slot, event)
```

Store the slot with every event. Use a transaction signature or event identity from the payload for deduplication.
