Parameters

This method does not take any parameters.

Response

result
number

The highest slot that can be retransmitted

Code Examples

Basic Request

curl https://rpc.orbitflare.com -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getMaxRetransmitSlot"
}'

Using web3.js

import { Connection } from '@solana/web3.js';

const connection = new Connection('https://rpc.orbitflare.com');

// Get max retransmit slot
const maxRetransmitSlot = await connection.getMaxRetransmitSlot();
console.log('Max retransmit slot:', maxRetransmitSlot);

// Check if a slot can be retransmitted
async function canRetransmitSlot(slot: number) {
  const maxRetransmitSlot = await connection.getMaxRetransmitSlot();
  return slot <= maxRetransmitSlot;
}

// Get retransmit range
async function getRetransmitRange() {
  const maxRetransmitSlot = await connection.getMaxRetransmitSlot();
  const firstAvailableBlock = await connection.getFirstAvailableBlock();
  
  return {
    startSlot: firstAvailableBlock,
    endSlot: maxRetransmitSlot,
    totalSlots: maxRetransmitSlot - firstAvailableBlock + 1
  };
}

Notes

  1. Returns the highest slot that can be retransmitted
  2. Used to determine the range of slots available for retransmission
  3. The response is immediate as it reads from the current state
  4. Slots beyond this value cannot be retransmitted
  5. This value can change as the node prunes old data

Best Practices

  1. Use this method to determine retransmission availability
  2. Cache results when appropriate to reduce RPC load
  3. Consider the impact of slot pruning
  4. Monitor for changes in max retransmit slot
  5. Use in conjunction with other slot-related methods

Common Errors

CodeMessageSolution
-32601Method not foundVerify you’re connected to a Solana RPC node
-32007Slot information unavailableNode may be bootstrapping or syncing

Use Cases

  1. Retransmission Planning

    interface RetransmitPlan {
      startSlot: number;
      endSlot: number;
      totalSlots: number;
      availableSlots: number[];
      missingSlots: number[];
    }
    
    async function planRetransmission(
      targetSlots: number[]
    ): Promise<RetransmitPlan> {
      const maxRetransmitSlot = await connection.getMaxRetransmitSlot();
      const firstAvailableBlock = await connection.getFirstAvailableBlock();
      
      const availableSlots = targetSlots.filter(
        slot => slot >= firstAvailableBlock && slot <= maxRetransmitSlot
      );
      
      const missingSlots = targetSlots.filter(
        slot => slot < firstAvailableBlock || slot > maxRetransmitSlot
      );
      
      return {
        startSlot: firstAvailableBlock,
        endSlot: maxRetransmitSlot,
        totalSlots: maxRetransmitSlot - firstAvailableBlock + 1,
        availableSlots,
        missingSlots
      };
    }
    
  2. Slot Availability Monitoring

    interface SlotAlert {
      type: 'pruned' | 'unavailable';
      message: string;
      slot: number;
      maxRetransmitSlot: number;
    }
    
    class SlotMonitor {
      private previousMaxSlot: number | null = null;
      
      async monitorSlots(
        targetSlots: number[]
      ): Promise<SlotAlert[]> {
        const maxRetransmitSlot = await connection.getMaxRetransmitSlot();
        const alerts: SlotAlert[] = [];
        
        // Check for pruned slots
        if (this.previousMaxSlot !== null && maxRetransmitSlot < this.previousMaxSlot) {
          alerts.push({
            type: 'pruned',
            message: `Slots ${maxRetransmitSlot + 1} to ${this.previousMaxSlot} have been pruned`,
            slot: this.previousMaxSlot,
            maxRetransmitSlot
          });
        }
        
        // Check target slots availability
        for (const slot of targetSlots) {
          if (slot > maxRetransmitSlot) {
            alerts.push({
              type: 'unavailable',
              message: `Slot ${slot} is beyond max retransmit slot`,
              slot,
              maxRetransmitSlot
            });
          }
        }
        
        this.previousMaxSlot = maxRetransmitSlot;
        return alerts;
      }
    }
    
  3. Historical Data Management

    interface HistoricalData {
      availableRange: {
        start: number;
        end: number;
        total: number;
      };
      prunedSlots: number[];
      availableSlots: number[];
      metadata: {
        timestamp: number;
        maxRetransmitSlot: number;
      };
    }
    
    async function manageHistoricalData(
      targetRange: { start: number; end: number }
    ): Promise<HistoricalData> {
      const maxRetransmitSlot = await connection.getMaxRetransmitSlot();
      const firstAvailableBlock = await connection.getFirstAvailableBlock();
      
      const availableSlots = [];
      const prunedSlots = [];
      
      for (let slot = targetRange.start; slot <= targetRange.end; slot++) {
        if (slot >= firstAvailableBlock && slot <= maxRetransmitSlot) {
          availableSlots.push(slot);
        } else {
          prunedSlots.push(slot);
        }
      }
      
      return {
        availableRange: {
          start: firstAvailableBlock,
          end: maxRetransmitSlot,
          total: maxRetransmitSlot - firstAvailableBlock + 1
        },
        prunedSlots,
        availableSlots,
        metadata: {
          timestamp: Date.now(),
          maxRetransmitSlot
        }
      };
    }