Call Contract

Invoke a smart contract.

This method will use 100 Compute Units.


Invoke a smart contract

post

Returns a result from EVM execution such as cost-free execution of read-only smart contract queries, gas estimation, and transient simulation of read-write operations. If estimate field is set to true gas estimation is executed. Currently we support only latest block.

The table below defines the restrictions and support for the endpoint

Estimate Operation Type Mirror Node Version
false static contract state reads for non precompile functions 0.78+
static contract state reads for precompile functions except allowance/isApprovedForAll 0.78+
static contract state reads for precompile functions with allowance 0.79+
static contract state reads for precompile functions with isApprovedForAll 0.81+
non-static contract state reads for non precompile functions 0.83+
non-static contract state reads for precompile read only functions 0.83+
true non-static contract state reads and modifications for non precompile functions except lazy account creation 0.83+
non-static contract state reads and modifications for associate precompile functions 0.83+
non-static contract state reads and modifications for non precompile functions with lazy account creation 0.84+
non-static contract state reads and modifications for precompile functions except associate Not supported

The operations types which are not currently supported should return 501 error status.

Body
blockstring | nullableOptional

Hexadecimal block number or the string "latest", "pending", "earliest". Defaults to "latest".

Example: latestPattern: ^((0x)?[0-9a-fA-F]+|(earliest|pending|latest))$
datastring · binary | nullableOptional

Hexadecimal method signature and encoded parameters.

Example: 0x0198489200000000000000000000000000000000000000000000000000000000000003eePattern: ^(0x)?[0-9a-fA-F]+$
estimateboolean | nullableOptional

Whether gas estimation is called. Defaults to false.

Example: true
fromstring · binary | nullableOptional

The 20-byte hexadecimal EVM address the transaction is sent from.

Example: 00000000000000000000000000000000000004e2Pattern: ^(0x)?[A-Fa-f0-9]{40}$
gasinteger · int64 | nullableOptional

Gas provided for the transaction execution. Defaults to 120000000.

Example: 120000000
gasPriceinteger · int64 | nullableOptional

Gas price used for each paid gas.

Example: 100000000
tostring · binary · min: 40 · max: 42Required

The 20-byte hexadecimal EVM address the transaction is directed to.

Example: 0x00000000000000000000000000000000000003f4Pattern: ^(0x)?[A-Fa-f0-9]{40}$
valueinteger · int64 | nullableOptional

Value sent with this transaction. Defaults to 0.

Example: 0
Responses
200
OK
application/json
post
POST /v1/YOUR_API_KEY/api/v1/contracts/call HTTP/1.1
Host: mainnet.hedera.validationcloud.io
Content-Type: application/json
Accept: */*
Content-Length: 265

{
  "block": "latest",
  "data": "0x0198489200000000000000000000000000000000000000000000000000000000000003ee",
  "estimate": true,
  "from": "00000000000000000000000000000000000004e2",
  "gas": 120000000,
  "gasPrice": 100000000,
  "to": "0x00000000000000000000000000000000000003f4",
  "value": 0
}
{
  "result": "0x94c4d54535f6e616d6500"
}

Last updated

Was this helpful?