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+ and pip

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

📦 Installation

pip install shredstream

⚡ Quick Start

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)

# Raw shreds — lowest latency, arrives before block assembly
for shred in listener.shreds():
    print(f"slot={shred.slot} index={shred.index} len={len(shred.payload)}")

# Decoded transactions — ready-to-use Solana transactions
for slot, transactions in ShredListener(port=PORT):
    for tx in transactions:
        print(tx.signature)

📖 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

  • listener.shreds() -- Generator yielding individual ParsedShred objects.
  • Iterator protocol -- for slot, transactions in listener: yields decoded transactions per slot.
  • listener.active_slots() -- Number of slots currently being accumulated.
  • listener.stop() -- Closes the UDP socket.

ParsedShred

Field Type Description
slot int Slot number
index int Shred index within the slot
payload bytes Raw shred payload (after header)
batch_complete bool True if this shred ends an entry batch
last_in_slot bool True if this is the last shred in slot

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 to all subscribers on a monthly 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

PUMP_FUN = bytes.fromhex("6ef8...")  # program address bytes

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

Raw shred access

from shredstream import ShredListener

listener = ShredListener(port=8001)
for shred in listener.shreds():
    print(f"slot={shred.slot} index={shred.index} len={len(shred.payload)}")

🚀 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.0.tar.gz (9.9 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.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: shredstream-1.0.0.tar.gz
  • Upload date:
  • Size: 9.9 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.0.tar.gz
Algorithm Hash digest
SHA256 c698be1c6d0d2a9da2b75898c68aad2d99ac42ea5f1d1e33f6174b1e96a640d1
MD5 6990e7b537f3d0b8f71b35ada1691b99
BLAKE2b-256 8651a50b7134c1ed1782516f0f173b71c7877f005634cca810ace3d1137f454d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shredstream-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54f43e85be9309fa94a39fe93fcfff927f803167b01c9358c72793bd9c4af982
MD5 113db0b56a8d37ac540c8b30e51d6407
BLAKE2b-256 30c41366d8e1a469b7d97625286d9c4938d8623c2ef61f9b53126f3fe387e285

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