Jump to
Ctrl
+
/

Estimate Program Invocation Compute Units Solana

POST
/blockchain-fees/solana/{network}/estimate-program-invocation-compute-units

This endpoint estimates the number of compute units an arbitrary Solana program invocation would consume. You provide the program to call, the base64-encoded instruction data, and the list of accounts the instruction references; the transaction is built and simulated against the node (without being broadcast) and the simulated compute units consumed are returned. This is the Solana analogue of estimating contract-interaction gas on EVM chains. Use it to size a ComputeBudget instruction before submitting the transaction.

Path Parameters

network string Required

Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - "mainnet" is the live network with actual data while a network like "devnet" is a test network.

Query Parameters

context string Optional

In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

Request Body Schema application/json

context string Optional

In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

data object Required
item object Required
sender string Required

Base58 string representation of the fee payer pubkey (the account that pays for and signs the transaction).

programId string Required

Base58 string representation of the program pubkey to invoke (the on-chain program the instruction calls).

instructionData string Required

Base64-encoded instruction data bytes passed to the program. May be an empty string for instructions that take no data.

accounts array Items (object) Optional

Array of the accounts referenced by the instruction (Solana AccountMeta entries), in the order the program expects them. May be empty.

pubkey string Required

Base58 string representation of the account pubkey referenced by the instruction.

isSigner boolean Required

Whether this account must sign the transaction.

isWritable boolean Required

Whether the instruction may modify this account's data or lamports.

Response Schema

apiVersion string Required

Specifies the version of the API that incorporates this endpoint.

2024-12-12
requestId string Required

Defines the ID of the request. The requestId is generated by Crypto APIs and it's unique for every request.

601c1710034ed6d407996b30
context string Optional

In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

yourExampleString
data object Required
item object Required
computeUnits integer Required

String-encoded integer of the simulated compute units the program invocation would consume.

4645

Credits Cost

Blockchain protocol Credits for 1 Results
Default Cost 120
Solana 120
Was this page helpful?
Yes
No
Powered by
Language
URL

{
    "apiVersion": "2024-12-12",
    "requestId": "601c1710034ed6d407996b30",
    "context": "yourExampleString",
    "data": {
        "item": {
            "computeUnits": 4645
        }
    }
}