# Estimating Gas Price

This Estimating Gas Price using this method.&#x20;

## API Specification

## Estimating Gas Price

<mark style="color:green;">`POST`</mark> `http://localhost:8889/wallet/estimateGas`

Submit Transaction under the given instance.&#x20;

**Headers**

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| ChainId\* | String | ChainId     |

#### Request Body

| Name                                            | Type   | Description                                                 |
| ----------------------------------------------- | ------ | ----------------------------------------------------------- |
| to<mark style="color:red;">\*</mark>            | String | The recipient's address                                     |
| walletId<mark style="color:red;">\*</mark>      | String | The ID of the wallet                                        |
| params<mark style="color:red;">\*</mark>        | String | Additional parameters for the transaction                   |
| method<mark style="color:red;">\*</mark>        | String | The method for the transaction                              |
| isContractTxn<mark style="color:red;">\*</mark> | String | Indicates whether the transaction is a contract transaction |
| contractABI<mark style="color:red;">\*</mark>   | String | The Application Binary Interface (ABI) of the contract      |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
  "Status": "SUCCESS",
  "Message": "",
  "Data": {
    "address": "0xa287e3DE5f629fc49321De34F40da40aAd799fa7",
    "estimatedGas": 23912
  }
}
```

{% endtab %}

{% tab title="417: Expectation Failed invalid contract abi " %}

```javascript
{
    "Status": "FAILURE",
    "Message": "error reading ABI : EOF",
    "Data": null
}
```

{% endtab %}
{% endtabs %}

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

{% tabs %}
{% tab title="curl" %}

```bash
curl -X POST http://localhost:8889/wallet/estimateGas \
-H "Content-Type: application/json" \
-H "ChainId: xxxx" \
-d '{
  "walletId": "effae2b6-3ee3-xxxxxxxxxxxxxxxxxxxxxxxxx",
  "to": "0xc2de797fab7d2d2b26xxxxxxxxxxxxxxxxxxxxxxxxx",
  "method": "store",
  "params": [
    {
      "type": "uint256",
      "value": "35"
    }
  ],
  "isContractTxn": true,
  "contractABI": "[]"
}'

```

{% endtab %}

{% tab title="Node.js (Fetch)" %}

```javascript
const axios = require('axios');

const data = {
  walletId: 'effae2b6-3ee3-48cb-9528-87c29152c89e',
  to: '0xc2de797fab7d2d2b26246e93fcf2cd5873a90b10',
  method: 'store',
  params: [{ type: 'uint256', value: '35' }],
  isContractTxn: true,
  contractABI: '[]',
};

axios.post('http://localhost:8889/wallet/estimateGas', data, {
  headers: {
    'Content-Type': 'application/json',
    'ChainId': 'xxxx',
  },
})
  .then((response) => {
    console.log('Response:', response.data);
  })
  .catch((error) => {
    console.error('Error:', error);
  });

```

{% endtab %}

{% tab title="Python " %}

```python
import requests
import json

url = 'http://localhost:8889/wallet/estimateGas'
headers = {'Content-Type': 'application/json', 'ChainId': 'xxxx'}
data = {
    "walletId": "effae2b6-3ee3-48cb-9528-87c29152c89e",
    "to": "0xc2de797fab7d2d2b26246e93fcf2cd5873a90b10",
    "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"}]'
}

response = requests.post(url, data=json.dumps(data), headers=headers)

if response.status_code == 200:
    print('Response:', response.json())
else:
    print('Request failed with status code:', response.status_code)

```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "http://localhost:8889/wallet/estimateGas"
  method := "POST"

  payload := strings.NewReader(`{
  "walletId": "effae2b6-3ee3-xxxxxxxxxxxxxxxxxxxxxxxxx",
  "to": "0xc2de797fab7d2d2b26xxxxxxxxxxxxxxxxxxxxxxxxx",
  "method": "store",
  "params": [
    {
      "type": "uint256",
      "value": "35"
    }
  ],
  "isContractTxn": true,
  "contractABI": "[]"
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("ChainId", "xxxxxx")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.krypcore.com/dev-docs/api-reference/core-service-apis/wallet-manager/self-managed-wallet/estimating-gas-price.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
