starknet_call | Starknet

📘

Starknet OpenRPC spec

For the latest version of the publicly maintained OpenRPC spec, see the Starknet specs GitHub repo.

Starknet API method that executes a function call to a contract without creating a Starknet transaction.

It allows you to call a function in a contract and returns the value of the function that you run on the contract. Using this call will not create a transaction; hence, it will not change the state.

👍

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • request — the details of the function call:
    • contract_address — the address of the contract to be called.
    • entry_point_selector — the selector of the function to be called.
    • calldata — the parameters passed to the function.
  • block_id — the hash of the requested block, or number (height) of the requested block, or a block tag, for the block referencing the state or call the transaction on.

Response

  • result — the function's return value, as defined in the Cairo output.

Use case

A practical use case for starknet_call is to interact with a contract's function without creating a transaction or changing the state. This can be useful for querying contract state or testing function calls.

Deprecated feeder gateway method

The feeder gateway was deprecated on December 11, 2023.

Example of the call you had to make to the feeder gateway before the deprecation:

curl --request POST \
     --url 'https://alpha-mainnet.starknet.io/feeder_gateway/call_contract?blockNumber=pending' \
     --header 'Content-Type: application/json' \
     --data-raw '{
         "contract_address": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
         "entry_point_selector": "0x2e4263afad30923c891518314c3c95dbe830a16874e8abc5777a9a20b54c76e",
         "calldata": ["0x03a20d4f7b4229e7c4863dab158b4d076d7f454b893d90a62011882dc4caca2a"]
     }'
Language
Click Try It! to start a request and see the response here!