getFeeForMessage

POSTFees & BlockhashAll plans

Returns the fee, in lamports, that a compiled transaction message would cost right now.

Try itSends a real request from your browser to the selected region.
POST
/

getFeeForMessage takes a base64-encoded, compiled transaction Message (not a full transaction; no signatures required) and returns its fee under the current fee schedule, based on its signature count and compute-budget instructions.

The result depends on the message's embedded blockhash remaining recent, detailed further in Notes.

Plans & rate limitsAll plans
Free5/s
Operator50/s
Blade Runner200/s
Nexus500/s

Parameters

params is a JSON array, with values in this order: message, config.

1messagestringrequired

Base64-encoded, compiled transaction message (the Message, not a full signed Transaction).

2configobject

Optional configuration.

Show propertiesProperties
commitmentstringdefault: "finalized"

Bank state to compute the fee against.

Allowed values:finalizedconfirmedprocessed
minContextSlotinteger

Minimum slot the node must have processed before answering.

Result

resultobject

The fee in lamports, wrapped with context, or null if the fee can't be computed.

Show propertiesProperties
contextobjectrequired
Show propertiesProperties
slotinteger
apiVersionstring
valueinteger | nullrequired

Fee in lamports for the given message, or null if the message's blockhash is not found (for example because it has already expired).

Notes

  • value is null when the embedded blockhash is too old for the node to have a fee schedule for it; this is not an error.
  • 5000 lamports per signature is the current base fee; a priority fee from compute-budget instructions adds to it, and this call reflects that.
  • Both example messages encode a single-signer SystemProgram transfer; they differ only in which blockhash was compiled into them.