Estimate Gas

The "Estimate Gas" feature in the KrypC wallet-dev Service API allows users to obtain an estimation of the gas consumption for a proposed transaction on the blockchain. This provides valuable insight into the anticipated transaction cost, helping users make informed decisions about resource allocation and optimizing their interactions with decentralized networks.

This Estimating Gas consumption using this method.

API Specification

To estimate Gas API

POST https://api.krypcore.com/api/v0/devWallet/estimateGas

To estimate Gas API under the given instance.

Headers

NameTypeDescription

DappId*

String

DappId

Authorization*

String

User Auth key obtained

SubscriptionId

String

SubscriptionId

ChainId

String

ChainId

Request Body

NameTypeDescription

privateKey*

String

Private Key

to*

String

Message

chainId*

String

Chain ID

method*

String

Method

params*

String

Params

isContractTxn*

String

IsContractTxn

contractABI*

String

ContractABI

{
    "Data": {
        "address": "0x11266906F2Eb9422924F3471F159377E2ED7c44C",
        "estimatedGas": 23912
    },
    "Message": "",
    "Status": "SUCCESS"
}

Take a look at how you might call this method using our official libraries, or via curl


curl --location 'https://api.krypcore.com/api/v0/devWallet/estimateGas' \
--header 'DappId: **********' \
--header 'Authorization: **********' \
--header 'SubscriptionId: ********' \
--header 'ChainId: ********' \
--header 'Content-Type: application/json' \
--data '{
     "privateKey": "**********",
    "to": "**********",
    "chainId": 80001,
    "method": "store",
    "params": [
        {
            "type": "uint256",
            "value": "35"
        }
    ],
    "isContractTxn": true,
    "contractABI": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"num\",\"type\":\"uint256\"}],\"name\":\"store\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"retrieve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]"
}'

Last updated