eth_call
Executes a new message call immediately without creating a transaction on the blockchain.
Command Shell
Bash
curl https://bsc-<network>.web3api.com/v1/YOUR-API-KEY
-X POST
-H "Content-Type: application/json"
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\": [{\"from\": \"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\": \"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\": \"0x76c0\",\"gasPrice\": \"0x9184e72a000\",\"value\": \"0x9184e72a\",\"data\": \"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}, \"latest\"],\"id\":1}"
curl -X POST 'https://bsc-<network>.web3api.com/v1/YOUR-API-KEY' \
-H 'Content-Type: application/json' \
--data-raw '{"jsonrpc":"2.0","method":"eth_call","params": [{"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155","to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas": "0x76c0","gasPrice": "0x9184e72a000","value": "0x9184e72a","data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}, "latest"],"id":1}'
Request Parameters
Response
- 1.
BLOCK PARAMETER
- Anint
block number in the form of hex, appended with 0x such as0x6D7FE0
, or pre-defined stringslatest
,earliest
,pending
. - 2.
TRANSACTION CALL OBJECT
- A transaction object to be broadcasted.
Web3API's Composer accepts
int
block numbers, which will be auto-converted to a hex representation before being sent to a node. Within the transaction call object, the following information are required.
- 1.
from
: 20 Bytes - address of the sender. - 2.
to
: 20 Bytes - address of the receiver. - 3.
gas
: Hex representation of an integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions. - 4.
gasPrice
: Hex representation of an integer of the gasPrice used for each paid gas - 5.
value
: Hex representation of an integer of the value sent with this transaction - 6.
data
: Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI.
Result Fields
RETURN VALUE
- the return value of the executed contract method.Body
{
"jsonrpc":"2.0",
"id":1,
"result": "0x"
}
Last modified 2yr ago