getFeeForMessage - Solana

getFeeForMessage. Calculates the estimated fee for a given transaction message

getFeeForMessage - solana [Value: 10CU]
Calculates the estimated fee for a given transaction message
Use cases

Use cases

  • Acquire fee calculations for specific Solana blockhashes
  • Determine transaction costs for better financial planning
  • Evaluate fee structures to optimize cost strategies
Constraints

Constraints

  • Limited to calculations for specific blockhashes
  • API call frequency limitations might apply
  • Possible latency in retrieving fee calculation data
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl https://solana.drpc.org \
  -X POST \
  -H "Content-Type: application/json" \
  -d '
    {
      "id":1,
      "jsonrpc":"2.0",
      "method":"getFeeForMessage",
      "params":[
        "AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",
        {
          "commitment":"processed"
        }
      ]
    }
'
Copy
Response
200
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "slot": 98108954
    },
    "value": {
      "feeCalculator": {
        "lamportsPerSignature": 5000
      }
    }
  },
  "id": 1
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersarray
array
messagestring
The transaction message encoded in base64 format.
maxSupportedTransactionVersionnumber
The maximum transaction version supported in responses. If the block contains a higher version, an error is returned. If omitted, only legacy transactions are returned, and blocks with versioned transactions will cause an error.
objectarray
Configuration options for the query:
array
commitmentstring
The level of commitment required for the query
  • finalized - The node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized
  • confirmed - The node will query the most recent block that has been voted on by supermajority of the cluster
  • processed - The node will query its most recent block. Note that the block may not be complete

Response

200
Calculates the fee required for a given transaction message

Response params

object
idinteger
jsonrpcstring
resultobject
object
valueobject
A JSON object describing the cluster fee rate at the queried blockhash.
contextobject
object
apiVersionstring
The Solana RPC API version being used.
slotinteger
The slot number corresponding to the fee calculator information.