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
| Parameter | Type | Required | Description |
|---|---|---|---|
| message | string | Yes | Base-64 encoded transaction message. Accepts both legacy and v0 (versioned) message formats. |
| commitment | string | No | processed | confirmed | finalized (default: finalized). Controls which confirmed slot the fee is evaluated against. |
| minContextSlot | number | No | Minimum slot at which the request can be evaluated. |
commitment values
| Value | Description |
|---|---|
| processed | Return 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. |
| confirmed | Return 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. |
| finalized | Return 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}| Field | Type | Description |
|---|---|---|
| context | object | Slot and API version the node used to answer this request. |
| value | u64 | null | Fee for the supplied message at the referenced blockhash, in lamports. Returns null if the blockhash is no longer valid. |
context fields
| Field | Type | Description |
|---|---|---|
| slot | u64 | Slot at which the node evaluated this request. |
| apiVersion | string | RPC API version reported by the node. May be omitted by older nodes. |