> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenderly.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Gas अनुमान

> Simulation API के साथ estimate_gas का उपयोग करके gas का अनुमान लगाएँ, या भेजने से पहले tenderly_estimateGas RPC विधियों के माध्यम से 100% सटीक सीमाएँ प्राप्त करें।

Simulation API आपको ट्रांज़ैक्शन को सफलतापूर्वक निष्पादित करने के लिए आवश्यक अनुमानित gas उपयोग प्राप्त करने के लिए ट्रांज़ैक्शन का simulation करने की अनुमति देता है।

Gas अनुमान प्राप्त करने के लिए अनुरोध में `estimate_gas: true` सेट करें।

<Note>
  नोट: आप [**`tenderly_estimateGas`**](/node-rpc/rpc-reference?network=ethereum-mainnet\&method=tenderly_estimateGas) और [**`tenderly_estimateGasBundle`**](/node-rpc/rpc-reference?network=ethereum-mainnet\&method=tenderly_estimateGasBundle) RPC विधियों का उपयोग करके 100% सटीक gas अनुमान प्राप्त कर सकते हैं।
</Note>

**उदाहरण**

सुनिश्चित करें कि आप एक्सेस कुंजी को सुरक्षित रूप से एक `.env` फ़ाइल में संग्रहीत करें।

```ts title="example.ts" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}

dotenv.config();

const { TENDERLY_ACCOUNT_SLUG, TENDERLY_PROJECT_SLUG, TENDERLY_ACCESS_KEY } = process.env;

const simulateTransaction = async () => {
  const { data } = await axios.post(
    `https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_SLUG}/project/${TENDERLY_PROJECT_SLUG}/simulate`,
    {
      // Simulation Configuration
      save: true,
      save_if_fails: false,
      estimate_gas: true,
      simulation_type: 'quick',
      network_id: '1',
      // Standard EVM Transaction object (sample values)
      from: '0xdc6bdc37b2714ee601734cf55a05625c9e512461',
      to: '0x6b175474e89094c44da98b954eedeac495271d0f',
      input: '0x095ea7b3000000000000000000000000f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1000000000000000000000000000000000000000000000000000000000000012b',
      gas: 8000000,
      gas_price: 0,
      value: 0,
    },
    {
      headers: {
        'X-Access-Key': TENDERLY_ACCESS_KEY as string,
      },
    },
  );

  console.log({ data });
};

simulateTransaction();
```

यह ट्रांज़ैक्शन के लिए आवश्यक अधिकतम gas की गणना करता है। एक सफल simulation के बाद, `transaction` संरचना में `gas_used` फ़ील्ड की जाँच करें।

**परिणाम**

```json title="example.json" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
"transaction": {
    ...
    "gas": 8000000,
    "gas_price": 0,
    "gas_fee_cap": 0,
    "gas_tip_cap": 0,
    "cumulative_gas_used": 0,
    "gas_used": 51534, // Gas estimates
    "effective_gas_price": 0,
    ...
 }
```
