Canonical: https://nitride.xyz/use-cases/token-launch-detection

# Token launch detection from shreds

Detect Solana token launches from raw shreds: which instructions to match, why launchpad mints hide in inner calls, failed launches, and when Ultra is worth it.

Token launch detection from shreds means spotting the transaction that creates a new mint or opens a launchpad market while the leader is still broadcasting its block. You decode the raw shreds yourself, match the program IDs and instructions you track, and alert or trade before the slot confirms, accepting that some launches will fail.

## What does a launch detector watch for?
A token launch on Solana is a short sequence: a mint account is created and initialised, metadata is written, a bonding curve or liquidity pool is opened, and the first buys follow, often in the same slot. Most launches go through a launchpad program or an AMM's pool-creation instruction. A smaller share are plain mint initialisations sent by a wallet.

The people who build detectors want different things from the same signal. Some trade the launch itself. Some feed a [trading alerts](https://nitride.xyz/use-cases/trading-alerts) service. Some track deployer wallets to spot repeat rug patterns, or build datasets of what launched and how it traded. [Market makers](https://nitride.xyz/use-cases/market-making) use it to decide whether a new pair deserves quotes at all.

The workload is bursty. Launches cluster, and a busy hour can bring a wave of creations along with heavy swap traffic on each new token. That is when packet rates peak, and when a slow receiver drops the very shreds it was waiting for.

## Which launch signals appear in shreds?
Shreds carry the transactions a leader included, with their top-level instructions. For launch detection, four details shape your matching logic:

- **Launchpad mints hide in inner calls.** A launchpad usually creates the mint from inside its own program, by calling the token program (a cross-program invocation). That inner call is not in the transaction you decode from shreds; it only shows up in execution metadata later. So match the launchpad's own top-level instruction, by its program ID and instruction discriminator, rather than the token program.
- **Direct mint creations do show the token program.** When a wallet initialises a mint itself, the SPL Token or Token-2022 program appears at top level, and the first byte of the instruction data is the instruction tag: 0 for `InitializeMint`, 20 for `InitializeMint2`.
- **Program IDs are static keys.** A version 0 transaction may load accounts from lookup tables, but the programs it invokes must sit among its static account keys. Matching on program ID needs no lookup-table resolution.
- **The deployer is easy to find.** The fee payer is always the first static key, and every signer sits among the static keys. A mint created from a fresh keypair must sign, so its address is a static key too. A mint derived as a program address is read from the instruction's account list, which may point into a lookup table.

Launchpad instructions often carry the token name, symbol and metadata URI as arguments. Read the layout from the program's IDL instead of guessing; Anchor programs prefix instruction data with an 8-byte discriminator.

What shreds cannot tell you: whether the launch transaction succeeded, the resulting pool reserves, or anything about the token's safety.

## Ultra or Standard for launch detection?
It depends on what happens after the match.

If a bot trades the launch within the same or next slot, choose Ultra Low Latency Shreds. At $200 for 30 days on one destination, it skips the relay and reaches your detector sooner than Standard. If competing launch traders read shreds, the delivery path is a part of the race you can pay to shorten.

If a person reads the alert, or the output is research, a deployer database or a dataset, choose Standard Shreds at $100 for one destination for 30 days, delivered through our relay. Human reaction time and your own decode time dwarf a relay hop. The shreds are the same on both plans.

Some teams run both: Ultra to the box that trades, Standard to the box that records. Each destination is a separate purchase. We publish no latency figure, so compare plans on your own server: log when the first shred of a slot arrives and when your RPC node reports that slot. The full comparison is in [Ultra Low Latency vs Standard Shreds](https://nitride.xyz/compare/ultra-vs-standard-shreds).

## A receiver sketch in Python
Python suits a prototype or an alert service. A detector that trades should receive in a compiled language. This sketch collects shreds per slot (the slot is a little-endian u64 at offset 65, 8 bytes), records when each slot's first shred arrived, and after a short settle window passes the slot to a decoder you supply, then checks each transaction for launch patterns.

```python file="launch_watch.py"
import socket, struct, time
from collections import defaultdict

PORT, HEADER, SETTLE = 9000, 83, 2
TOKEN = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
TOKEN_2022 = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
LAUNCHPADS = {}  # program id -> set of 8-byte "create" discriminators, from each IDL

def decode_slot(shreds):
    """Your decoder or an open-source one: recover FEC sets, deserialise entries.
    Return transactions as dicts: 'keys' (static keys, base58) and
    'ixs' (list of (program_index, account_indexes, data_bytes))."""
    raise NotImplementedError

def launch_kind(tx):
    keys = tx["keys"]
    for prog_ix, accounts, data in tx["ixs"]:
        prog = keys[prog_ix]
        if prog in (TOKEN, TOKEN_2022) and data[:1] in (b"\x00", b"\x14"):
            mint = keys[accounts[0]] if accounts and accounts[0] < len(keys) else None
            return ("direct-mint", mint)
        if data[:8] in LAUNCHPADS.get(prog, ()):
            return ("launchpad", prog)
    return None

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 16 << 20)
sock.bind(("0.0.0.0", PORT))
slots, first_seen, newest = defaultdict(list), {}, 0

while True:
    data = sock.recv(1228)
    if len(data) < HEADER:
        continue
    slot = struct.unpack_from("<Q", data, 65)[0]
    if slot + SETTLE < newest:
        continue  # straggler for a slot already decoded
    first_seen.setdefault(slot, time.time_ns())
    slots[slot].append(data)
    newest = max(newest, slot)
    for done in [s for s in slots if s + SETTLE < newest]:
        arrived = first_seen.pop(done, None)
        for tx in decode_slot(slots.pop(done)):
            hit = launch_kind(tx)
            if hit:
                print(done, arrived, hit, "deployer", tx["keys"][0])
```

Decoding inline blocks the receive loop, which is acceptable for a prototype and wrong for production: move `decode_slot` to another process and keep the loop receiving. Waiting for the whole slot also costs time; a faster detector decodes each FEC set as soon as it is complete, which is the decoder's job. The `first_seen` timestamp is what you compare against your RPC node when you measure.

The receive part matches the [Rust receiver](https://nitride.xyz/docs/rust), which also shows the full header and how to accept only the address we send from, which support can give you once delivery is active. A Python version is in the [Python receiver docs](https://nitride.xyz/docs/receiver/python).

## What are the limits of shred-based launch detection?
- **Failed launches look like launches.** Shreds include transactions that will fail. A create that runs out of compute or hits a program error still appears. Confirm before treating a match as fact anywhere but a time-critical trade.
- **Skipped slots and forks.** A launch in a block that never confirms did not happen. Your detector must retract it.
- **Loss peaks with the frenzy.** Raw UDP has no retransmission, and launch waves bring the highest packet rates. Size your socket buffers, watch the kernel's receive-buffer error counters, and record slots your decoder could not rebuild.
- **Upkeep.** Launchpads upgrade programs and add instructions. Keep your program ID and discriminator lists current, and decode everything yourself.
- **Detection is not due diligence.** Shreds say a token exists, not whether its authority, supply or liquidity is safe.
- **Frankfurt only.** A launch sniper far from Frankfurt gives back on the route what Ultra saves on the hop.

## Next steps
[What a shred is, and why it arrives before a confirmed block](https://nitride.xyz/blog/what-is-a-shred) covers the background, and [Solana shreds, explained](https://nitride.xyz/learn/solana-shreds) goes deeper. If launch matches feed a wallet-following bot, see [copy trading from shreds](https://nitride.xyz/use-cases/copy-trading). For other workloads, start from the [use cases hub](https://nitride.xyz/use-cases).

### Why does my detector not see InitializeMint for launchpad tokens?

Because the launchpad creates the mint through an inner call to the token program, and inner calls are not part of the transaction carried in shreds. Match the launchpad's own instruction instead.

### Can shreds tell me whether a new token is a rug?

No. Shreds show that a mint or pool was created and by which wallet. Judging authority settings, supply and liquidity needs account state from RPC and your own rules.

### Do I need Ultra to trade launches?

If you trade within the same or next slot, Ultra is the plan built for that, since it skips our relay hop. For alerts and research, Standard is enough.

### Is there a free trial so I can test detection during a busy period?

Each plan has a free 2-hour trial, once per person. Email support@nitride.xyz with the IPv4 address and UDP port you want to test. We verify you receive on that address, then your 2 hours start.
