# Get gas for transaction

**URL:** <https://classic-agora.terra.money/t/get-gas-for-transaction/4997>\
**Category:** Technical Development\
**Created:** [March 15, 2022, 6:08am UTC](https://classic-agora.terra.money/t/get-gas-for-transaction/4997 "2022-03-15T06:08:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheydaashoorian](https://sea2.discourse-cdn.com/terra/user_avatar/classic-agora.terra.money/sheydaashoorian/32/2588_2.png) [@sheydaashoorian](https://classic-agora.terra.money/u/sheydaashoorian)\
**Post date:** [March 15, 2022, 6:08am UTC](https://classic-agora.terra.money/t/get-gas-for-transaction/4997/1 "2022-03-15T06:08:22Z")

</div>

I wanted to get gas for the transaction . Can I get gas from LCD or RPC such as gas gas\_price ?

---

<div class="post-metadata">

**Author:** ![petegordon](https://sea2.discourse-cdn.com/terra/user_avatar/classic-agora.terra.money/petegordon/32/2322_2.png) [@petegordon](https://classic-agora.terra.money/u/petegordon)\
**Post date:** [March 16, 2022, 10:53am UTC](https://classic-agora.terra.money/t/get-gas-for-transaction/4997/2 "2022-03-16T10:53:17Z")

</div>

Yes; somewhat.

[https://docs.terra.money/docs/learn/fees.html#gas](https://docs.terra.money/docs/learn/fees.html#gas)

Which links here…  
[https://fcd.terra.dev/v1/txs/gas\_prices](https://fcd.terra.dev/v1/txs/gas_prices)

And the other discussion ongoing about fees is priceless. [How fees on Terra work](https://classic-agora.terra.money/t/how-fees-on-terra-work/4382)

---

<div class="post-metadata">

**Author:** ![sheydaashoorian](https://sea2.discourse-cdn.com/terra/user_avatar/classic-agora.terra.money/sheydaashoorian/32/2588_2.png) [@sheydaashoorian](https://classic-agora.terra.money/u/sheydaashoorian)\
**Post date:** [March 21, 2022, 7:49pm UTC](https://classic-agora.terra.money/t/get-gas-for-transaction/4997/3 "2022-03-21T19:49:04Z")

</div>

thank you Petegordon , I mean is how to estimate gas\_limit not gas\_price

---

<div class="post-metadata">

**Author:** ![sheydaashoorian](https://sea2.discourse-cdn.com/terra/user_avatar/classic-agora.terra.money/sheydaashoorian/32/2588_2.png) [@sheydaashoorian](https://classic-agora.terra.money/u/sheydaashoorian)\
**Post date:** [March 21, 2022, 7:50pm UTC](https://classic-agora.terra.money/t/get-gas-for-transaction/4997/4 "2022-03-21T19:50:15Z")

</div>

I want to use tx.estimate\_fee() in order to get gas . set this function like this :

but get this error:  
TypeError: can’t concat str to bytes  
can I use any api to get gas same as gas-price that could get from fcd  
thank you for your help  
signer\_opt = SignerOptions(  
address=address,  
)  
tx\_opt = CreateTxOptions(  
msgs=[msg], memo=“send test”, gas\_adjustment=1.5, fee\_denoms=[“uluna”], gas\_prices=gas\_price + denom  
, gas=‘auto’  
)  
then I try to get gas from tx.estimate\_fee() in order to access to gas but get this error:  
“error”: “int() argument must be a string, a bytes-like object or a real number, not ‘NoneType’”,

estimate\_fee = self.LCDClient.tx.estimate\_fee([signer\_opt], tx\_opt)

---

<div class="post-metadata">

**Author:** ![0xjrr](https://sea2.discourse-cdn.com/terra/user_avatar/classic-agora.terra.money/0xjrr/32/1536_2.png) [@0xjrr](https://classic-agora.terra.money/u/0xjrr)\
**Post date:** [March 23, 2022, 1:09am UTC](https://classic-agora.terra.money/t/get-gas-for-transaction/4997/5 "2022-03-23T01:09:12Z")

</div>

I think the docs suggest that the functions given by TFL will try to estimate the gas for you before the signing, never got it to work correctly on the python package. I know what you are trying, I tried as well without success to find a way. I think most protocols counter this by giving a flat fee. For example anchor is flat .25, stader is flat .5  
Hope someone could answer this here as well.
