klay_estimateComputationCost

Generates and returns an estimate of how much computation cost will be spent to execute the transaction.

Klaytn limits the computation cost of a transaction to 100000000 currently not to take too much time by a single transaction.
The transaction will not be added to the blockchain like klay_estimateGas.

📘

Supported on Klaytn (mainnet) only.

Parameters

Request

See klay_call parameters, except that all properties are optional.
If no gas limit is specified, the Klaytn node uses the default gas limit (uint64 / 2) as an upper bound.

Result

TypeDescription
QUANTITYThe amount of computation cost used.

API Endpoint

The format of a Klaytn API endpoint is
https://open-platform.nodereal.io/{{apiKey}}/klaytn/

Here is an example:
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/klaytn/

Example

// Request
curl https://open-platform.nodereal.io/{{apiKey}}/klaytn/ \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"klay_estimateComputationCost","params":[{"from":"0x73718c4980728857f3aa5148e9d1b471efa3a7dd", "to":"0x069942a3ca0dabf495dba872533134205764bc9c", "value":"0x0", "input":"0x2a31efc7000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000003039"}, "latest"],"id":1}' 

// Result
{
  "jsonrpc": "2.0","id":1,
  "result": "0x1e8b0ad"
}