POST
/
efb0a5eccd2caa5135eb54eba6f7f300
curl --request POST \
  --url https://optimism-mainnet.core.chainstack.com/efb0a5eccd2caa5135eb54eba6f7f300 \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "eth_call",
  "id": 1,
  "params": [
    {
      "to": "0xC7846d1bc4d8bcF7c45a7c998b77cE9B3c904365",
      "data": "0x1526fe270000000000000000000000000000000000000000000000000000000000000001"
    },
    "latest"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}

The example is a call to the poolinfo of the Gamma MasterChef contract.

Optimism API method eth_call executes a smart contract function call directly and returns the result without requiring a transaction or changing the state on the blockchain. This method is widely used for reading data from smart contracts.

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

  • transactionObject — an object containing transaction parameters, including:
    • to — the address of the contract to call.
    • data — the call data, typically including the function signature and parameters.
  • blockParameter — a string specifying the block number (in hexadecimal) or one of the strings "earliest", "latest", or "pending", indicating the blockchain state to use for the call. Most commonly, "latest" is used.

Response

  • result — the result of the call, encoded as a hexadecimal string. The format of the result depends on the function called.

Use case

The eth_call method is essential for:

  • DApps that need to retrieve state or compute derived values from smart contracts without making a transaction.
  • Wallets and interfaces that display contract information, such as token balances or the state of a decentralized finance (DeFi) contract.
  • Automated scripts and bots that monitor contract states or conditions on the blockchain.

Body

application/json
jsonrpc
string
default:2.0
method
string
default:eth_call
id
integer
default:1
params
array

Response

200 - application/json
The result of the call
jsonrpc
string
id
integer
result
string