Skip to main content

Solana ShredStream SDK/Decoder for Python, enabling ultra-low latency Solana transaction streaming via UDP shreds from https://www.shredstream.com

Project description

Solana ShredStream SDK for Python

Solana ShredStream SDK/Decoder for Python, enabling ultra-low latency Solana transaction streaming via UDP shreds from ShredStream.com

Part of the ShredStream.com ecosystem — ultra-low latency Solana shred streaming via UDP.

License: MIT Python

📋 Prerequisites

  1. Create an account on ShredStream.com
  2. Launch a Shred Stream and pick your region (Frankfurt, Amsterdam, Singapore, Chicago, and more)
  3. Enter your server's IP address and the UDP port where you want to receive shreds
  4. Open your firewall for inbound UDP traffic on that port (e.g. configure your cloud provider's security group)
  5. Install Python 3.10+:
    # Linux (Ubuntu/Debian)
    sudo apt update && sudo apt install -y python3 python3-venv python3-pip
    
    # macOS
    brew install python3
    

🎁 Want to try before you buy? Open a ticket on our Discord to request a free trial.

📦 Installation

# Create a virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate

# Install the SDK
pip install shredstream

⚡ Quick Start

Create a file main.py:

from shredstream import ShredListener
import os

# Bind to the UDP port configured on ShredStream.com
PORT = int(os.environ.get("SHREDSTREAM_PORT", 8001))
listener = ShredListener(port=PORT)

# Decoded transactions — ready-to-use Solana transactions
for slot, transactions in listener:
    for tx in transactions:
        print(f"slot {slot}: {tx.signature}")

Run it:

python3 main.py

📖 API Reference

ShredListener

ShredListener(port=8001, recv_buf=25*1024*1024, max_age=10)
Parameter Type Default Description
port int 8001 UDP port to bind
recv_buf int 25 MB Socket receive buffer size
max_age int 10 Maximum slot age before eviction

Methods

  • Iterator protocol -- for slot, transactions in listener: yields decoded transactions as they arrive.
  • listener.active_slots() -- Number of slots currently being accumulated.
  • listener.stop() -- Closes the UDP socket.

Transaction

Field Type Description
signatures list[bytes] Raw 64-byte signatures
raw bytes Full wire-format transaction bytes
signature str (property) First signature as base58 (lazy, via solders)

🎯 Use Cases

ShredStream.com shred data powers a wide range of latency-sensitive strategies — HFT, MEV extraction, token sniping, copy trading, liquidation bots, on-chain analytics, and more.

💎 PumpFun Token Sniping

ShredStream.com SDK detects PumpFun token creations ~499ms before they appear on PumpFun's live feed — tested across 25 consecutive detections:

ShredStream.com SDK vs PumpFun live feed — ~499ms advantage

ShredStream.com provides a complete, optimized PumpFun token creation detection code available with our monthly subscription plan. Battle-tested, high-performance, ready to plug into your sniping pipeline. To get access, open a ticket on Discord or reach out on Telegram @shredstream.

⚙️ Configuration

OS Tuning

# Linux -- increase max receive buffer
sudo sysctl -w net.core.rmem_max=33554432

# macOS
sudo sysctl -w kern.ipc.maxsockbuf=33554432

Dependencies

  • solders>=0.21 -- Required for base58 signature encoding (tx.signature property). Imported lazily on first access.

💡 Examples

Filter by program

from shredstream import ShredListener
from solders.pubkey import Pubkey

PUMP_FUN = bytes(Pubkey.from_string("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"))

for slot, txs in ShredListener(port=8001):
    for tx in txs:
        if PUMP_FUN in tx.raw:
            print(f"slot {slot}: {tx.signature}")

🚀 Launch a Shred Stream

Need a feed? Launch a Solana Shred Stream on ShredStream.com — sub-millisecond delivery, multiple global regions, 5-minute setup.

🔗 Links

📄 License

MIT — ShredStream.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shredstream-1.0.5.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shredstream-1.0.5-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file shredstream-1.0.5.tar.gz.

File metadata

  • Download URL: shredstream-1.0.5.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for shredstream-1.0.5.tar.gz
Algorithm Hash digest
SHA256 f46f3f4a7f6472e841cf8da3f3c99b02b3c592128d36e33a2ebd38d962f02dcc
MD5 fa5af12859b10a39bbefcaadaffa0b8f
BLAKE2b-256 6a9356a1ff7fb31ca7c08af847b71708eeb58e1ea32152825a18be3c13d07b87

See more details on using hashes here.

File details

Details for the file shredstream-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: shredstream-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for shredstream-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0e5c3faf0570b8441cfbb4d2ca36b28673a10b2018d10b2b47d8fbc8e6ba09a8
MD5 1d9eac4e52409c4d4b276f4e73ff3650
BLAKE2b-256 bd0c1b1e9982e9732fccdb7f19d17837744a78c4dfbcf9ff502b102ff7a29965

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page