Actions22
- Call Contract
- Estimate Gas
- Get Balance
- Get Block
- Get Block By Hash
- Get Block Number
- Get Block Transaction Count By Hash
- Get Block Transaction Count By Number
- Get Code
- Get Gas Price
- Get Logs
- Get Storage At
- Get Transaction
- Get Transaction By Block Hash And Index
- Get Transaction By Block Number And Index
- Get Transaction Count
- Get Transaction Receipt
- Get Uncle By Block Hash And Index
- Get Uncle By Block Number And Index
- Get Uncle Count By Block Hash
- Get Uncle Count By Block Number
- Send Raw Transaction
Call Contract
AI-generatedOverview
This node operation allows users to execute a smart contract function call on the Ethereum blockchain via the Infura API. It is useful for interacting with deployed smart contracts by sending encoded function call data to a specified contract address at a particular block state. For example, a user can call a contract method to read data or trigger a state change without sending a transaction that modifies the blockchain state.
Use Case Examples
- Calling a token contract's balanceOf function to get the token balance of an address.
- Invoking a contract method to fetch stored data at a specific block.
Properties
| Name | Meaning |
|---|---|
| Contract Address | The Ethereum address of the smart contract to call. |
| Call Data | The encoded function call data representing the contract method and parameters to execute. |
| Block | The block identifier (hexadecimal or tags like 'latest', 'earliest', 'pending') at which to execute the call. |
Output
JSON
result- The result of the contract call, typically the returned data from the smart contract function.contractAddress- The contract address to which the call was made.callData- The encoded function call data used in the call.blockTag- The block identifier at which the call was executed.metadatanetwork- The blockchain network used (e.g., mainnet, rinkeby).operation- The operation performed, here 'call'.timestamp- The timestamp when the call was executed.infura_endpoint- The Infura API endpoint used for the call.raw_response- The raw JSON-RPC response from the Infura API.
Dependencies
- Infura API credentials including network, project ID, and optionally project secret for authentication.
Troubleshooting
- Ensure the contract address is valid and correctly formatted as an Ethereum address.
- Verify that the call data is properly encoded according to the contract's ABI; invalid encoding will cause the call to fail or return errors.
- Check that the block tag is valid; using an unsupported block identifier may result in errors.
- If authentication fails, verify the Infura project ID and secret credentials are correct and have necessary permissions.
Links
- Infura eth_call Documentation - Official documentation for the eth_call JSON-RPC method used to execute smart contract calls.