Ethereum icon

Ethereum

Interact with Ethereum blockchain

Contract → Read

AI-generated

Summary

Read contract state by calling a function

Inputs

  • contractAddress (required) — The address of the contract to read from
  • abi (required) — Contract ABI as JSON array
  • useRawCalldata — Whether to use raw calldata instead of function name and parameters
  • functionName (required) — Name of the function to call
  • parameters — Function parameters as JSON array
  • calldata (required) — Raw calldata for the function call

Output shape

a single record containing the result of the contract call (e.g., return data or event logs)

The shape may be empty or an error object if the call fails; success returns the decoded result.

Examples

Example 1: Read token balance

Contract Address: 0xTokenAddr, ABI: [{"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","type":"function"}], Function Name: balanceOf, Parameters: ["0xMyAddr"], Use Raw Calldata: false

Example 2: Read using raw calldata

Contract Address: 0xTokenAddr, ABI: [], Calldata: 0x... (encoded function call), Use Raw Calldata: true

Example 3: Read with explicit function name

Contract Address: 0xTokenAddr, ABI: [{"inputs":[{"name":"","type":"uint256"}],"name":"totalSupply","type":"function"}], Function Name: totalSupply, Parameters: [], Use Raw Calldata: false

Links

Discussion