# Estimate Provider

> Source: https://taquito.io/docs/25.1.0/estimate

Taquito's estimate method can be used to estimate fees, gas, and storage associated with an operation.

>[!NOTE]
> Our estimation of `fee`, `gasLimit` and `storageLimit` is based on the RPC call response to `simulate_operation` plus a small buffer. The context and volume at the time of `simulate_operation` might differ from `preapply/operations` and `injection/operation`, potentially causing errors like `fees_too_low`, `storage_exhausted.operation` and `gas_exhausted.operation`.

## The `Estimate` object

The `Estimate` object has the following properties (all values are numbers):

- **`burnFeeMutez`**: The number of mutez that will be burned for the storage of the operation.
- **`gasLimit`**: The limit on the amount of gas a given operation can consume.
- **`minimalFeeMutez`**: Minimum fees for the operation according to baker defaults.
- **`storageLimit`**: The limit on the amount of storage an operation can use.
- **`suggestedFeeMutez`**: The suggested fee for the operation, including minimal fees and a small buffer.
- **`totalCost`**: The sum of `minimalFeeMutez` + `burnFeeMutez`.
- **`usingBaseFeeMutez`**: Fees according to your specified base fee, ensuring that at least minimum fees are used.

### Estimate a transfer operation

The following example shows an estimate of the fees associated with transferring 2ꜩ to `tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY` address.

#### Contract API

```js
const amount = 2;
const address = 'tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY';

console.log(`Estimating the transfer of ${amount} ꜩ to ${address}: `);

try {
  const est = await Tezos.estimate.transfer({ to: address, amount: amount });
  console.log(`burnFeeMutez : ${est.burnFeeMutez},
gasLimit : ${est.gasLimit},
minimalFeeMutez : ${est.minimalFeeMutez},
storageLimit : ${est.storageLimit},
suggestedFeeMutez : ${est.suggestedFeeMutez},
totalCost : ${est.totalCost},
usingBaseFeeMutez : ${est.usingBaseFeeMutez}`);
} catch (error) {
  console.table(`Error: ${JSON.stringify(error, null, 2)}`);
}
```

  
#### Wallet API

```js
const amount = 2;
const address = 'tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY';

console.log(`Estimating the transfer of ${amount} ꜩ to ${address}: `);

try {
  const est = await Tezos.estimate.transfer({ to: address, amount: amount });
  console.log(`burnFeeMutez : ${est.burnFeeMutez},
gasLimit : ${est.gasLimit},
minimalFeeMutez : ${est.minimalFeeMutez},
storageLimit : ${est.storageLimit},
suggestedFeeMutez : ${est.suggestedFeeMutez},
totalCost : ${est.totalCost},
usingBaseFeeMutez : ${est.usingBaseFeeMutez}`);
} catch (error) {
  console.table(`Error: ${JSON.stringify(error, null, 2)}`);
}
```

  

### Estimate a smart contract call

This example will demonstrate how to estimate the fees related to calling a smart contract.

#### Contract API

The `contractCall()` member method can be used to estimate contract calls as such:

```js
try {
  const contract = await Tezos.contract.at('KT1WoBtTk3rVePcBmWxwDjNuZV7LPoQ4fASR');
  const op = contract.methodsObject.increment(7);

  console.log(`Estimating the smart contract call: `);
  const estimate = await Tezos.estimate.contractCall(op);

  console.log(`burnFeeMutez : ${estimate.burnFeeMutez},
gasLimit : ${estimate.gasLimit},
minimalFeeMutez : ${estimate.minimalFeeMutez},
storageLimit : ${estimate.storageLimit},
suggestedFeeMutez : ${estimate.suggestedFeeMutez},
totalCost : ${estimate.totalCost},
usingBaseFeeMutez : ${estimate.usingBaseFeeMutez}`);
} catch (error) {
  console.table(`Error: ${JSON.stringify(error, null, 2)}`);
}
```

  
#### Wallet API

```js
try {
  const contract = await Tezos.wallet.at('KT1WoBtTk3rVePcBmWxwDjNuZV7LPoQ4fASR');
  const op = contract.methodsObject.increment(7);

  console.log(`Estimating the smart contract call: `);
  const estimate = await Tezos.estimate.contractCall(op);

  console.log(`burnFeeMutez : ${estimate.burnFeeMutez},
gasLimit : ${estimate.gasLimit},
minimalFeeMutez : ${estimate.minimalFeeMutez},
storageLimit : ${estimate.storageLimit},
suggestedFeeMutez : ${estimate.suggestedFeeMutez},
totalCost : ${estimate.totalCost},
usingBaseFeeMutez : ${estimate.usingBaseFeeMutez}`);
} catch (error) {
  console.table(`Error: ${JSON.stringify(error, null, 2)}`);
}
```

  

### Estimate a contract origination

In this example, we will use the estimate method of Taquito on a contract origination. The `genericMultisigJSONfile` variable contains a Michelson Smart Contract.

#### Contract API

```js
console.log(`Estimating the contract origination: `);

try {
  const originationOp = await Tezos.estimate.originate({
    code: genericMultisigJSONfile,
    storage: {
      stored_counter: 0,
      threshold: 1,
      keys: ['edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t'],
    },
  });

  console.log(`burnFeeMutez : ${originationOp.burnFeeMutez},
gasLimit : ${originationOp.gasLimit},
minimalFeeMutez : ${originationOp.minimalFeeMutez},
storageLimit : ${originationOp.storageLimit},
suggestedFeeMutez : ${originationOp.suggestedFeeMutez},
totalCost : ${originationOp.totalCost},
usingBaseFeeMutez : ${originationOp.usingBaseFeeMutez}`);
} catch (error) {
  console.log(`Error: ${error}`);
}
```

  
#### Wallet API

```js
console.log(`Estimating the contract origination: `);

try {
  const originationOp = await Tezos.estimate.originate({
    code: genericMultisigJSONfile,
    storage: {
      stored_counter: 0,
      threshold: 1,
      keys: ['edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t'],
    },
  });

  console.log(`burnFeeMutez : ${originationOp.burnFeeMutez},
    gasLimit : ${originationOp.gasLimit},
    minimalFeeMutez : ${originationOp.minimalFeeMutez},
    storageLimit : ${originationOp.storageLimit},
    suggestedFeeMutez : ${originationOp.suggestedFeeMutez},
    totalCost : ${originationOp.totalCost},
    usingBaseFeeMutez : ${originationOp.usingBaseFeeMutez}`);
} catch (error) {
  console.log(`Error: ${JSON.stringify(error, null, 2)}`);
}
```
