sui_getCheckpoint - Get Checkpoint Info
Get detailed checkpoint information from Sui blockchain including transactions, network metrics, and consensus data using Dwellir's high-performance Sui RPC infrastructure.
Retrieves detailed information about a specific checkpoint on the Sui blockchain, including transactions, network metrics, and consensus data.
Overview
The sui_getCheckpoint method provides comprehensive information about Sui network checkpoints. Checkpoints represent finalized batches of transactions that have been agreed upon by the network consensus. This method is essential for blockchain analytics, network monitoring, historical data analysis, and understanding the state progression of the Sui blockchain.
Code Examples
Common Use Cases
1. Network Health Monitoring
async function monitorNetworkHealth() {
const monitor = new CheckpointMonitor(client);
// Set custom thresholds for alerts
monitor.thresholds = {
maxTransactionsPerCheckpoint: 5000,
minTimeBetweenCheckpoints: 2000,
maxTimeBetweenCheckpoints: 15000
};
monitor.onNewCheckpoint = (checkpoint) => {
const txCount = checkpoint.transactions.length;
const timestamp = new Date(parseInt(checkpoint.timestampMs));
console.log(`📊 Network Status:`);
console.log(` Checkpoint: ${checkpoint.sequenceNumber}`);
console.log(` TPS: ${txCount} transactions`);
console.log(` Time: ${timestamp.toLocaleTimeString()}`);
};
await monitor.startMonitoring(5000); // Check every 5 seconds
}2. Transaction Throughput Analysis
async function analyzeThroughput(checkpointCount = 100) {
const metricsTracker = new NetworkMetricsTracker(client);
const metrics = await metricsTracker.trackMetrics(checkpointCount);
const throughput = metrics.transactionThroughput;
const analysis = {
averageTPS: metrics.averageTPS,
peakTPS: Math.max(...throughput.map(t => t.tps)),
minTPS: Math.min(...throughput.map(t => t.tps)),
medianTPS: throughput.map(t => t.tps).sort()[Math.floor(throughput.length / 2)],
tpsStandardDeviation: calculateStandardDeviation(throughput.map(t => t.tps))
};
return analysis;
}3. Epoch Transition Tracking
async function trackEpochTransitions(epochCount = 5) {
const latestCheckpoint = await getLatestCheckpoint();
const currentEpoch = parseInt(latestCheckpoint.epoch);
const epochTransitions = [];
for (let epoch = currentEpoch - epochCount; epoch <= currentEpoch; epoch++) {
// Find last checkpoint of epoch (simplified search)
let foundTransition = false;
let checkpointSeq = parseInt(latestCheckpoint.sequenceNumber) - (currentEpoch - epoch) * 1000;
for (let i = 0; i < 2000 && !foundTransition; i++) {
const checkpoint = await getCheckpointBySequence(checkpointSeq + i);
if (checkpoint && checkpoint.endOfEpochData) {
epochTransitions.push({
epoch: checkpoint.epoch,
checkpoint: checkpoint.sequenceNumber,
timestamp: checkpoint.timestampMs,
nextEpochCommitteeSize: checkpoint.endOfEpochData.nextEpochCommittee?.length || 0
});
foundTransition = true;
}
}
}
return epochTransitions;
}4. Data Availability Verification
async function verifyDataAvailability(startSeq, endSeq) {
const verification = {
requestedRange: { start: startSeq, end: endSeq },
availableCheckpoints: [],
missingCheckpoints: [],
consecutiveRanges: [],
availabilityPercentage: 0
};
let currentRange = null;
for (let seq = startSeq; seq <= endSeq; seq++) {
const checkpoint = await getCheckpointBySequence(seq);
if (checkpoint) {
verification.availableCheckpoints.push(seq);
if (currentRange) {
currentRange.end = seq;
} else {
currentRange = { start: seq, end: seq };
}
} else {
verification.missingCheckpoints.push(seq);
if (currentRange) {
verification.consecutiveRanges.push(currentRange);
currentRange = null;
}
}
}
if (currentRange) {
verification.consecutiveRanges.push(currentRange);
}
verification.availabilityPercentage =
(verification.availableCheckpoints.length / (endSeq - startSeq + 1)) * 100;
return verification;
}Best Practices
1. Efficient Checkpoint Queries
// Cache frequently accessed checkpoints
const checkpointCache = new Map();
async function getCachedCheckpoint(id) {
if (checkpointCache.has(id)) {
return checkpointCache.get(id);
}
const checkpoint = await client.getCheckpoint({ id });
if (checkpoint) {
checkpointCache.set(id, checkpoint);
// Limit cache size
if (checkpointCache.size > 1000) {
const firstKey = checkpointCache.keys().next().value;
checkpointCache.delete(firstKey);
}
}
return checkpoint;
}2. Batch Processing
// Process checkpoints in batches to avoid overwhelming the RPC
async function processCheckpointRange(start, end, batchSize = 10) {
const results = [];
for (let i = start; i <= end; i += batchSize) {
const batchEnd = Math.min(i + batchSize - 1, end);
const batchPromises = [];
for (let j = i; j <= batchEnd; j++) {
batchPromises.push(getCheckpointBySequence(j));
}
const batchResults = await Promise.allSettled(batchPromises);
results.push(...batchResults.map(r => r.value).filter(Boolean));
// Small delay between batches
if (batchEnd < end) {
await new Promise(resolve => setTimeout(resolve, 200));
}
}
return results;
}3. Error Handling and Retry Logic
async function robustGetCheckpoint(id, retries = 3) {
for (let attempt = 1; attempt <= retries; attempt++) {
try {
const checkpoint = await client.getCheckpoint({ id });
return { success: true, data: checkpoint };
} catch (error) {
console.warn(`Attempt ${attempt} failed for checkpoint ${id}:`, error.message);
if (attempt === retries) {
return { success: false, error: error.message };
}
// Exponential backoff
await new Promise(resolve =>
setTimeout(resolve, Math.pow(2, attempt - 1) * 1000)
);
}
}
}Performance Considerations
- Rate Limiting: Implement delays between requests to avoid overwhelming the RPC endpoint
- Caching: Cache checkpoint data as it's immutable once finalized
- Batch Processing: Process checkpoints in batches rather than individual requests
- Selective Queries: Only fetch the checkpoint data you need
- Parallel Processing: Use Promise.all for independent checkpoint queries
Related Methods
- suix_getLatestSuiSystemState - Get complete system state
- sui_getTransactionBlock - Get transactions in checkpoint
- suix_queryTransactionBlocks - Query transactions by checkpoint
Notes
- Checkpoints are immutable once finalized by consensus
- Sequential numbering ensures no gaps in the checkpoint sequence
- End of epoch checkpoints contain additional validator committee information
- Timestamps are in milliseconds since Unix epoch
- Transaction digests in checkpoints can be used to fetch detailed transaction data
- Validator signatures provide cryptographic proof of consensus
Need help? Contact our support team or check the Sui documentation.
sui_executeTransactionBlock - Execute Su...
Submit and execute signed transactions on Sui blockchain. Send coins, call smart contracts, and manage objects with Dwellir's reliable Sui RPC infrastructure.
sui_getObject - Retrieve Sui Object Data
Query object information on Sui blockchain using sui_getObject RPC method. Access object data, ownership, version, and content with Dwellir's high-performance Sui infrastructure.