Search code examples
solana

Solana - Commitment vs preflightCommitment


I'm curious what the difference between preflightCommitment and commitment is.

Also, what are the different types of commitments listed below.

export type Commitment =
    | 'processed'
    | 'confirmed'
    | 'finalized'
    | 'recent'
    | 'single'
    | 'singleGossip'
    | 'root'
    | 'max';

Solution

  • preflightCommitment is the commitment used for the preflight transaction, AKA the transaction simulation, whereas commitment is used for the actual transaction.

    As for the different commitments, they're all listed at https://docs.solana.com/developing/clients/jsonrpc-api#configuring-state-commitment

    Some of those terms are old, but here's roughly how they would translate:

    • processed = recent
    • confirmed = singleGossip = single
    • finalized = root = max