eth_call

Network: Optimism Sepolia · Testnet · Chain ID 11155420 (0xaa37dc)

Counts as 1 request. See Request Counting.

Executes a new message call immediately without creating a transaction on the blockchain. Commonly used to read data from smart contracts.

Parameters

  1. Object — The transaction call object:

    FieldTypeRequiredDescription
    fromDATANoSender address
    toDATAYesContract address
    gasQUANTITYNoGas limit
    gasPriceQUANTITYNoGas price
    valueQUANTITYNoValue sent
    dataDATANoABI-encoded function call
  2. QUANTITY|TAG — Block number, or "latest", "earliest", "pending".

Returns

DATA — The return value of the executed contract function.

Request

{ "jsonrpc": "2.0", "method": "eth_call", "params": [ { "to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "data": "0x18160ddd" }, "latest" ], "id": 1 }

The example reads ERC-20 totalSupply() (selector 0x18160ddd). Replace to with a token contract on Optimism Sepolia.

Response

{ "jsonrpc": "2.0", "id": 1, "result": "0x0000000000000000000000000000000000000000000000000000001234567890" }

Code Examples

curl -X POST https://optimism-sepolia-rpc.blockreq.com/v1/rpc/public \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","data":"0x18160ddd"},"latest"],"id":1}'

Try It