Links

eth_call

Executes a new message call immediately without creating a transaction on the block chain.

Parameters

Params - a string array containing (required):
  • Object - The transaction call object
    • from(hex string, optional)- the address the transaction is sent from.
    • to(hex string, required) - the address the transaction is directed to.
    • gas(hex string, optional) - integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
    • gasPrice(hex string, optional) - integer of the gasPrice used for each paid gas.
    • value(hex string, optional) - integer of the value sent with this transaction.
    • data(hex string, optional) - hash of the method signature and encoded parameters. For details see Ethereum Contract ABI in the Solidity documentation.
  • QUANTITY|TAG(hex string|string, required) - integer block number in hex string format, or the string "latest", "earliest" or "pending", see the default block parameter.

Returns

DATA(hex string) - the return value of executed contract.

Example

Request

curl
TypeScript
curl https://api.blockvision.org/v1/<api key> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0x08a2e41fb99a7599725190b9c970ad3893fa33cf",
"data": "0x18160ddd"
},
"0xa2f2e0"
],
"id": 1
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.ARB_MAINNET)
// Access standard Ethers.js JSON-RPC node request
bv.call({
to: '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41',
data: '0x3b3b57debf074faa138b72c65adbdcfb329847e4f2c04bde7f7dd7fcad5a52d2f395a558'
}).then(console.log)

Result

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