getFeeForMessage RPC Method

Get the fee the network will charge for a particular Message

This method is only available in solana-core v1.9 or newer. Please use getFees for solana-core v1.8 and below.

Parameters#

stringrequired

Base-64 encoded Message

objectoptional

Configuration object containing the following fields:

commitmentstringoptional

The commitment describes how finalized a block is at that point in time.

minContextSlotnumberoptional

The minimum slot that the request can be evaluated at.

Result#

  • <u64|null> - Fee corresponding to the message at the specified blockhash

Code sample#

curl https://api.devnet.solana.com -s -X POST -H "Content-Type: application/json" -d '
{
  "id":1,
  "jsonrpc":"2.0",
  "method":"getFeeForMessage",
  "params":[
    "AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",
    {
      "commitment":"processed"
    }
  ]
}
'

Response#

{
  "jsonrpc": "2.0",
  "result": { "context": { "slot": 5068 }, "value": 5000 },
  "id": 1
}
Try It