Want to be able to add "free" transactions in each block


#1

Hi,

I am developing a cosmos sdk based application, and would like to have some transactions/transaction types without any fee or gas. Is it possible? Could someone point me how to accomplish this?

Thanks!


#2

The options I see for how to handle this are:

  • Make a tx-dependent gas meter, and make auth use it
  • Make auth completely tx aware
  • Don’t use any API’s that increase gas within your special tx.

I think making your own gas meter and forking auth to use it is your best bet atm. This kind of sucks, and you should make a github issue for this to be do-able without forking the codebase :).

The line you have to change is: https://github.com/cosmos/cosmos-sdk/blob/develop/x/auth/ante.go#L316, and you’d have to make your own gas meter that took in the tx as well.


#3

Thanks @valardragon - I’ve submitted an issue in github. https://github.com/cosmos/cosmos-sdk/issues/3193

Please take a look and let me know if the requirements are clear.


#4

@valardragon - I went through the AnteHandler code, looks like the fee/gas calculation is handled there. We can create our own AnteHandler and set it in the app. Of course, we have to then replicate the AnteHandler implementation, but I think that is better than forking the auth module. Would you recommend this approach?


#5

That makes sense to do, as long as you c/p all the unexported methods for the ante handler as well.