LaserStream Historical Replay: Backfill Missing Data
Recover from disconnections and backfill missing Solana blockchain data with LaserStream’s historical replay feature. Never miss a transaction again.
Never miss a beat: LaserStream’s Historical Replay ensures you can recover from disconnections and backfill missing data from the last 20 minutes of blockchain activity.
Historical Replay is LaserStream’s feature that lets you replay recent blockchain data from up to 3000 slots in the past (approximately 20 minutes of blockchain activity). This is particularly useful for handling disconnections and ensuring data continuity in real-time applications.
Limited Time Window: Historical replay is currently limited to the last 3000 slots (approximately 20 minutes of blockchain activity). You cannot replay data from arbitrary points in the past.
Handle Disconnections
Recover data lost during brief disconnections (up to 20 minutes)
Bootstrap Applications
Start applications with recent context from the last 20 minutes
The slot number to start replaying from. Must be within the replay window (last 3000 slots from current slot).Example: "224339000"Important: The slot must be recent enough to fall within the 20-minute replay window.
When your application reconnects after a short disconnection (under 20 minutes), you can use Historical Replay to ensure no data is missed:
Report incorrect code
Copy
Ask AI
// Store the last processed slotlet lastProcessedSlot = getLastProcessedSlot();// Check if the slot is still within the replay windowconst currentSlot = await getCurrentSlot();const maxReplaySlot = currentSlot - 3000;if (lastProcessedSlot < maxReplaySlot) { console.warn('Disconnection too long, some data may be lost'); lastProcessedSlot = maxReplaySlot;}const subscriptionRequest: SubscribeRequest = { // ... your subscription config fromSlot: lastProcessedSlot.toString()};await subscribe(config, subscriptionRequest, async (data) => { // Process data and update last processed slot await processData(data); lastProcessedSlot = data.slot; saveLastProcessedSlot(lastProcessedSlot); });
Bootstrap with Recent Context
Start your application with recent context from the last few minutes:
Report incorrect code
Copy
Ask AI
// Get a slot from 10 minutes ago (within the 20-minute window)const currentSlot = await getCurrentSlot();const startSlot = currentSlot - 1500; // ~10 minutes agoconst subscriptionRequest: SubscribeRequest = { // ... your subscription config fromSlot: startSlot.toString()};
Testing with Recent Data
Use recent historical data for testing (limited to last 20 minutes):
Report incorrect code
Copy
Ask AI
// Test with data from the last 5 minutesconst currentSlot = await getCurrentSlot();const testStartSlot = currentSlot - 750; // ~5 minutes agoconst testEndSlot = currentSlot - 150; // ~1 minute agoconst subscriptionRequest: SubscribeRequest = { // ... your subscription config fromSlot: testStartSlot.toString()};// Stop processing when reaching test end slotawait subscribe(config, subscriptionRequest, async (data) => { if (data.slot >= testEndSlot) { // Stop processing return; } await processTestData(data); });