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

Uploaded Python 3

File details

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

File metadata

  • Download URL: shredstream-1.0.1.tar.gz
  • Upload date:
  • Size: 10.0 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.1.tar.gz
Algorithm Hash digest
SHA256 69eff81f845f9f3e17d68f63d460f5b2a88b3da9eef6d27f01903b75692986f3
MD5 ce0c51c2533ea4b0448e1aaaff89de8a
BLAKE2b-256 12c7be02080e2c54cf751c773b3931ddbc3d3b88f2fdfa92d080a6c3d331908c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shredstream-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a6f70c363f94d145a2b0fd4d5127d80721d7be1e97ffe140b15578218bc9fbd
MD5 07a161c45f2046dc5d603191f2ca6e5f
BLAKE2b-256 cfd8ce7b2a896254ae88337d4693e1bd9a9e97a7e48cb9af0cdbb608d37370e8

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