Replacing gas consumption mechanism by your own


#1

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


#2

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


#3

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.