Historical Replay
Replay historical data with LaserStream’s fromSlot parameter
Laserstream is currently in private beta and not yet publicly available. Access is limited, and some features may still be under development.
Overview
One of LaserStream’s most powerful features is Historical Replay, which allows you to replay data from a specific point in time. This capability ensures you never miss critical on-chain events, even if your application disconnects temporarily.
With Historical Replay, you can:
- Backfill missing data after a disconnection
- Bootstrap new applications with recent historical data
- Analyze past events for specific accounts or transactions
- Test application behavior with real historical data
How Historical Replay Works
When you establish a LaserStream connection, you can optionally specify a starting slot using the fromSlot
parameter. LaserStream will then:
- Begin streaming data from the specified slot
- Deliver all relevant events from that slot forward
- Eventually catch up to real-time data
- Continue streaming real-time events seamlessly
Automatic Reconnection: The LaserStream SDK (helius-laserstream
) automatically handles reconnections and replay for you. If your connection drops, the SDK will reconnect and resume from where it left off without requiring any additional code.
Using the fromSlot
Parameter
The fromSlot
parameter can be used with both gRPC and WebSocket connections.
With gRPC
Add the fromSlot
parameter to your SubscribeRequest
object:
With WebSockets
For transaction subscribe:
For account subscribe:
Limitations
- Replay Window: Currently, you can replay data from up to 3000 slots in the past (approximately 20 minutes of blockchain activity).
- Data Availability: Some very old historical data may not be available for replay.
Best Practices
- Use Recent Slots: When specifying a
fromSlot
, ensure it falls within the replay window (currently 3000 slots or about 20 minutes). - Handle High Volumes: During catch-up, you may receive data at a faster rate than during real-time streaming.
- Set Appropriate Filters: To minimize the amount of data during replay, use specific filters.
- Monitor Reconnections: The SDK handles reconnections automatically, but it’s good practice to log when they occur.
Simplified Example
The LaserStream SDK will transparently handle:
- Initial connection and data streaming
- Automatic reconnection if the connection drops
- Resuming from where it left off after a reconnection
- Buffering and delivering data in the correct order