> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# eth_call | Tempo

> Tempo API method that executes a new message call immediately without creating a transaction on the blockchain. Tempo via Chainstack.

Tempo API method that executes a new message call immediately without creating a transaction on the blockchain. This is commonly used to read data from smart contracts, such as TIP-20 token balances.

## Parameters

* `callObject` — the call object:
  * `from` — (optional) address the call is sent from
  * `to` — the address the call is directed to
  * `gas` — (optional) gas provided for the call
  * `gasPrice` — (optional) gas price for the call
  * `value` — (optional) value sent with the call
  * `data` — (optional) hash of the method signature and encoded parameters
* `blockParameter` — the block number (hex) or tag (`latest`, `earliest`, `pending`)

### State override (optional)

`eth_call` accepts an optional third parameter: a state override set that changes account state for this call only. Nothing is written to the chain. The set is an object keyed by account address, and each address can override:

* `balance` — the account balance in wei, hex-encoded
* `nonce` — the account nonce, hex-encoded
* `code` — the bytecode to run at the address
* `state` — storage slot values that replace the account's entire storage
* `stateDiff` — storage slot values to change, keeping the rest of the storage

This example puts bytecode that returns `42` at an unused address, then calls that address:

```bash theme={"system"}
curl --request POST \
  --url CHAINSTACK_NODE_URL \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_call",
    "params": [
      { "to": "0x00000000000000000000000000000000c0ffee42", "data": "0x" },
      "latest",
      { "0x00000000000000000000000000000000c0ffee42": { "code": "0x602a60005260206000f3" } }
    ]
  }'
```

```json theme={"system"}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x000000000000000000000000000000000000000000000000000000000000002a"
}
```

## Response

* `result` — the return value of the executed contract call

## `eth_call` code examples

The following example queries the `balanceOf` function on the pathUSD TIP-20 token contract:

<CodeGroup>
  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  // pathUSD token address
  const PATHUSD = "0x20c0000000000000000000000000000000000000";

  const getBalance = async (address) => {
      const abi = ["function balanceOf(address) view returns (uint256)"];
      const token = new ethers.Contract(PATHUSD, abi, provider);
      const balance = await token.balanceOf(address);
      // TIP-20 tokens use 6 decimals
      console.log(`pathUSD balance: ${ethers.formatUnits(balance, 6)}`);
    };

  getBalance("0x9729187D9E8Bbefa8295F39f5634cA454dd9d294");
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3

  node_url = "CHAINSTACK_NODE_URL"
  web3 = Web3(Web3.HTTPProvider(node_url))

  # pathUSD token address
  PATHUSD = "0x20c0000000000000000000000000000000000000"

  # balanceOf function signature: keccak256("balanceOf(address)")[:4]
  # Plus address padded to 32 bytes
  address = "0x9729187D9E8Bbefa8295F39f5634cA454dd9d294"
  data = "0x70a082310000000000000000000000009729187d9e8bbefa8295f39f5634ca454dd9d294"

  result = web3.eth.call({
      'to': PATHUSD,
      'data': data
  })

  balance = int(result.hex(), 16) / 10**6  # TIP-20 uses 6 decimals
  print(f"pathUSD balance: {balance}")
  ```

  ```bash cURL theme={"system"}
  curl -X POST "CHAINSTACK_NODE_URL" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "eth_call",
      "params": [
        {
          "to": "0x20c0000000000000000000000000000000000000",
          "data": "0x70a082310000000000000000000000009729187d9e8bbefa8295f39f5634ca454dd9d294"
        },
        "latest"
      ],
      "id": 1
    }'
  ```
</CodeGroup>


## OpenAPI

````yaml openapi/tempo_node_api/transaction_info/eth_call.json POST /
openapi: 3.0.0
info:
  title: eth_call Tempo example
  version: 1.0.0
  description: This is an API example for eth_call for Tempo.
servers:
  - url: https://tempo-mainnet.core.chainstack.com/c3ce2925b51f1ed18719fe8a23bbdccf
security: []
paths:
  /:
    post:
      tags:
        - Transaction info
      summary: eth_call
      operationId: tempo-eth-call
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: eth_call
                params:
                  type: array
                  items: {}
                  default:
                    - to: '0x20c0000000000000000000000000000000000000'
                      data: >-
                        0x70a082310000000000000000000000009729187d9e8bbefa8295f39f5634ca454dd9d294
                    - latest
                  description: Transaction call object and block parameter
                id:
                  type: integer
                  default: 1
      responses:
        '200':
          description: The return value of the executed contract call
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: string
                    description: The return data of the call

````