Documentation Index
Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
Use this file to discover all available pages before exploring further.
Parameters
This method does not accept any parameters.
Response
The lowest slot that the node has information about in its ledger
Code Examples
Basic Request
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "minimumLedgerSlot"
}'
Using web3.js
import { Connection } from '@solana/web3.js';
const connection = new Connection('https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');
// Get minimum ledger slot
const minSlot = await connection.minimumLedgerSlot();
console.log('Minimum ledger slot:', minSlot);
// Get minimum ledger slot with analysis
async function getMinimumLedgerSlotWithAnalysis() {
const minSlot = await connection.minimumLedgerSlot();
const currentSlot = await connection.getSlot();
return {
slots: {
minimum: minSlot,
current: currentSlot,
difference: currentSlot - minSlot
},
metadata: {
timestamp: Date.now()
}
};
}
Notes
- Returns the lowest slot in the node’s ledger
- The response is immediate as it reads from the current state
- The minimum slot can change as the ledger is pruned
- Slots below this value are not accessible
- The value may vary between nodes based on their configuration
Best Practices
- Use this method to determine ledger boundaries
- Cache results when appropriate to reduce RPC load
- Monitor for changes in minimum slot
- Consider using websocket subscription for real-time updates
- Handle network errors and retry when appropriate
Common Errors
| Code | Message | Solution |
|---|
| -32601 | Method not found | Verify you’re connected to a Solana RPC node |
| -32603 | Internal error | Node may be bootstrapping or syncing |
Use Cases
-
Ledger Analysis
interface LedgerAnalysis {
slots: {
minimum: number;
current: number;
difference: number;
};
metrics: {
pruningRate: number;
retentionPeriod: number;
};
metadata: {
timestamp: number;
};
}
class LedgerAnalyzer {
private readonly slotsPerSecond = 2; // Solana's target slots per second
async analyzeLedger(): Promise<LedgerAnalysis> {
const minSlot = await connection.minimumLedgerSlot();
const currentSlot = await connection.getSlot();
const difference = currentSlot - minSlot;
return {
slots: {
minimum: minSlot,
current: currentSlot,
difference
},
metrics: {
pruningRate: difference / this.slotsPerSecond, // seconds
retentionPeriod: difference / (this.slotsPerSecond * 3600) // hours
},
metadata: {
timestamp: Date.now()
}
};
}
}
-
Ledger Monitoring
interface LedgerStatus {
slots: {
minimum: number;
previous: number;
difference: number;
};
history: Array<{
timestamp: number;
minimum: number;
}>;
}
class LedgerMonitor {
private previousMinSlot: number | null = null;
private history: Array<{
timestamp: number;
minimum: number;
}> = [];
async monitorLedger(): Promise<LedgerStatus | null> {
const minSlot = await connection.minimumLedgerSlot();
const now = Date.now();
this.history.push({
timestamp: now,
minimum: minSlot
});
if (this.previousMinSlot === null) {
this.previousMinSlot = minSlot;
return null;
}
const status: LedgerStatus = {
slots: {
minimum: minSlot,
previous: this.previousMinSlot,
difference: minSlot - this.previousMinSlot
},
history: this.history
};
this.previousMinSlot = minSlot;
return status;
}
}
-
Ledger Planning
interface LedgerPlan {
slots: {
minimum: number;
current: number;
difference: number;
};
recommendations: Array<{
type: 'fetch' | 'wait' | 'error';
reason: string;
}>;
metadata: {
timestamp: number;
};
}
class LedgerPlanner {
private readonly maxSlotRange = 1000000; // Maximum slots to search
async planLedgerOperation(
targetSlot: number
): Promise<LedgerPlan> {
const minSlot = await connection.minimumLedgerSlot();
const currentSlot = await connection.getSlot();
const now = Date.now();
const recommendations: Array<{
type: 'fetch' | 'wait' | 'error';
reason: string;
}> = [];
if (targetSlot < minSlot) {
recommendations.push({
type: 'error',
reason: `Target slot ${targetSlot} is below minimum ledger slot ${minSlot}`
});
} else if (targetSlot > currentSlot) {
recommendations.push({
type: 'wait',
reason: `Target slot ${targetSlot} has not been reached yet`
});
} else if (currentSlot - targetSlot > this.maxSlotRange) {
recommendations.push({
type: 'error',
reason: `Target slot ${targetSlot} is too far in the past`
});
} else {
recommendations.push({
type: 'fetch',
reason: 'Target slot is within valid range'
});
}
return {
slots: {
minimum: minSlot,
current: currentSlot,
difference: currentSlot - minSlot
},
recommendations,
metadata: {
timestamp: now
}
};
}
}