Replacing gas consumption mechanism by your own

Hello!
Me and my team implementing blockchain based on cosmos-sdk. As I can see you’re using gas mechanism for spam protection and paying to miners for computations and storage. In our chain we don’t need this gas logic. Instead of, we want to implement bandwidth based on address stake.
I need to cut off all gas logic and replace it with my own mechanisms.
But… Going through your code I’ve noticed that all logic of transactions validation and processing is hard coded (methods like runTx and runMsgs and so on… of BaseApp) and cannot be influenced by sdk user.
One possible solution is to redefine your anteHandler or even all flow of CheckTx and DeliverTx. It’s very undesirable…
May be I’ve missed something? Could you please help me to find some simpler solution?
Thank you

4 Likes

i am also interested on this topic! thank you for share your concern

One more way is to redefine CheckTx and DeliverTx methods: run your validations for bandwidth at first and then call original methods from BaseApp. There will still be gas methods and checks. Also in that case we have to handle state and decode transactions two times. So this isn’t the nice one.

Hi :wink:
We wrote our solution alongside with gas mechanism. But there is still an issue that we cannot remove gas at all. And also implementation looks not so pretty due to cosmos-sdk design :slight_smile:

Very interesting topic, beginning on project with related issue… Will hopefully be able to post our solution…

1 Like