OpenInfra.sh is now live - Solana infrastructure, included with every server. LEARN MORE HERE >

OpenInfra.shopeninfra.sh

getFeeForMessage

Returns the lamports the cluster would charge to process a serialized message at the requested commitment.

Request

{  "jsonrpc": "2.0",  "id": 1,  "method": "getFeeForMessage",  "params": [    "AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",    {      "commitment": "processed"    }  ]}

Parameters

ParameterTypeRequiredDescription
messagestringYesBase-64 encoded transaction message. Accepts both legacy and v0 (versioned) message formats.
commitmentstringNoprocessed | confirmed | finalized (default: finalized). Controls which confirmed slot the fee is evaluated against.
minContextSlotnumberNoMinimum slot at which the request can be evaluated.

commitment values

ValueDescription
processedReturn data from the highest slot this node has processed on the fork it currently considers best. This is the newest view, but it can still change if the cluster switches forks.
confirmedReturn data from the highest slot that at least two-thirds of active stake has directly voted to confirm. More stable than processed, but weaker than finalized.
finalizedReturn data from the highest slot that the cluster recognizes as finalized. The slot has reached maximum vote lockout and is recognized by at least two-thirds of active stake. This is the strongest commitment level.

Response

{  "jsonrpc": "2.0",  "result": {    "context": { "apiVersion": "3.1.8", "slot": 5068 },    "value": 5000  },  "id": 1}
FieldTypeDescription
contextobjectSlot and API version the node used to answer this request.
valueu64 | nullFee for the supplied message at the referenced blockhash, in lamports. Returns null if the blockhash is no longer valid.

context fields

FieldTypeDescription
slotu64Slot at which the node evaluated this request.
apiVersionstringRPC API version reported by the node. May be omitted by older nodes.