introducing-laserstream
/Updates

Introducing LaserStream: Next-Gen Solana Data Streaming

5 min read

LaserStream is a drop-in replacement for running gRPC on dedicated nodes and is performance-optimized to support Enhanced WebSockets.

With historical replay and automatic reconnects, any team on Solana can stream transactions, slots, blocks, and account changes for a fraction of the cost of running dedicated infrastructure.

What is LaserStream?

LaserStream is a next-generation streaming service purpose-built for developers who need reliable, low-latency Solana data. It delivers on-chain events (transactions, slots, blocks, accounts, and more) directly to your application with industry-leading reliability, performance, and flexibility.

LaserStream connects to multiple Solana nodes, aggregates their data, and then streams it to your frontend app or backend database rather than relying on a single dedicated node.

As a result of this simplified, redundant, and scalable configuration, you won’t need to manage dedicated infrastructure, will experience more stable latency, and will not miss any updates.

LaserStream also supports historical replay, which allows you to catch up on 3,000 slots of historical data (roughly 20 minutes) in the event your subscription was paused or disconnected.

How LaserStream Works

Each LaserStream server connects to multiple Solana nodes, deduplicates incoming data, and maintains a buffer of the most recent slots so developers can replay historical slots.

To ensure high availability, data correctness, and scale, LaserStream is deployed across seven regions, with each region running multiple servers for redundancy. 

If a server in one region goes down, the traffic is automatically redirected to the next available server in that region. As a result, your application stays connected to a high-quality data feed, even during server maintenance or unexpected outages.

LaserStream Features

LaserStream is a drop-in replacement for dedicated nodes and offers many unique benefits for products using gRPC.

Historical Replay and Automatic Reconnects

One common issue with WebSockets and gRPC is socket disconnections and missed data. LaserStream solves this using automatic reconnects and historical replay.

With LaserStream, you can replay up to 3,000 slots (roughly ~20 minutes) so you don’t lose any critical data in the event you get disconnected. No more custom code to manage reconnections or backfilling missed blocks due to unexpected outages.

High Redundancy and Reliability

Reliability and data correctness are non-negotiable for Solana data streaming services. LaserStream uses a globally distributed cluster of servers, each backed by multiple Solana nodes, to ensure your data streams are never interrupted, and you always receive correct data.

  • Built-in high availability with globally distributed clusters
  • Clusters are distributed across seven regions — Frankfurt, Amsterdam, Salt Lake City, Tokyo, Singapore, Pittsburgh, and Newark
  • Every region has multiple LaserStream servers 
  • Each server is backed by multiple Solana nodes for resiliency
  • Clients are automatically redirected via our load balancers, ensuring seamless failover

No manual failovers, no stressing over lost data, just continuous streaming.

Near-Native Performance

Real-time data streaming is time-sensitive and can be the difference between winning and losing a profitable trade. 

LaserStream is built to stay fast and steady during the busiest Solana epochs. A multi-region relay mesh constantly checks real-time latency, then routes each subscription through the quickest path, sustaining tens of thousands of messages per second while keeping delivery jitter in milliseconds.

If an upstream node or an entire region blips, the connection pivots to the next relay in milliseconds and automatically replays the past 3,000 slots, ensuring you never miss an event. The result is a gap-free, high-throughput stream that lets you focus on strategy instead of uptime.

Instant Setup

Historically, traders and latency-sensitive applications required dedicated nodes running Geyser plugins to stream real-time updates. Unfortunately, running dedicated nodes is complicated, time-consuming, and dependent on available inventory in your preferred geographic locations.

LaserStream eliminates the hassle of provisioning, configuring, monitoring, and managing your own nodes for gRPC streams while providing better performance and more developer-friendly features. 

As LaserStream uses a familiar interface that is fully compatible with Enhanced WebSockets and gRPC, it is a seamless drop-in replacement for your current setup.

No complicated migrations. No new syntax. Simply replace your existing gRPC URL for a LaserStream URL to experience max performance and reliability.

Advanced Filtering

To sort through Solana’s high volume of data, teams need comprehensive and flexible filtering options so they only receive the most important information. 

LaserStream gives you precision and control over your data. Easily filter by specific accounts, account owners, transaction status, block metadata, slots, and more.

More Affordable Pricing

Dedicated nodes start at $2,300/month, which can be a large expense for startups and cost-sensitive applications. With LaserStream, all teams on a Helius Professional plan ($999/month) can access performant, real-time data streams.

More information about LaserStream pricing can be found on our plans and rate limits page.

How to Start Using LaserStream

Below is a quickstart guide showing how to connect using gRPC through our LaserStream SDK.

Quickstart with gRPC

Follow these steps to start using LaserStream as a replacement for gRPC.

1. Create a new project

Code
mkdir laserstream-grpc-demo
cd laserstream-grpc-demo
npm init -y

2. Install dependencies

Code
npm install helius-laserstream
npm install --save-dev typescript ts-node
npx tsc --init

3. Obtain your API key

Generate an API key and choose your endpoint from the endpoints page in your dashboard.

4. Create a subscription script

In a file named index.ts, add the following code:

Code
import { subscribe, CommitmentLevel, LaserstreamConfig, SubscribeRequest } from 'helius-laserstream'

async function main() {
  const subscriptionRequest: SubscribeRequest = {
    transactions: {
      client: {
        accountInclude: [‘pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA’],
        accountExclude: [],
        accountRequired: [],
        vote: false,
        failed: false
      }
    },
    commitment: CommitmentLevel.CONFIRMED,
    accounts: {},
    slots: {},
    transactionsStatus: {},
    blocks: {},
    blocksMeta: {},
    entry: {},
    accountsDataSlice: [],
    // Optionally, you can replay missed data by specifying a fromSlot:
    // fromSlot: '224339000'
    // Note: Currently, you can only go back up to 3000 slots.
  };

  // Replace these values with your actual Laserstream API key and endpoint
  const config: LaserstreamConfig = {
    apiKey: 'your-api-key',
    endpoint: 'your-endpoint',
  }

  await subscribe(config, subscriptionRequest, async (data) => {
    console.log(data);
  }, async (error) => {
    console.error(error);
  });
}

main().catch(console.error);

5. Run and view results

Code
npx ts-node index.ts

You will see transaction updates in your console whenever confirmed transactions involve the account pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA.

If you want to replay old data, uncomment the fromSlot parameter and specify the recent slot you want to start from.

For more guides, examples, and code snippets, refer to our LaserStream for gRPC docs.

LaserStream Support

If you run into issues, have questions, or want to give general feedback, please reach out via Discord or Telegram. We would love to hear from you and help you troubleshoot any problems.

Acknowledgments

Special thanks to Kirill Fomichev. LaserStream is a custom fork of his excellent Richat project.

Related Articles

Subscribe to Helius

Stay up-to-date with the latest in Solana development and receive updates when we post