Contract cost  


New Member
Joined:2 weeks  ago
Posts: 1
03/07/2018 9:01 am  
Hello everyone
new mycell in { contract mycell(getter, setter, @state) = { new valueHolder in { valueHolder!(state) | contract getter(ack) = { for(@value <- valueHolder) { ack!(value) | valueHolder!(value) } } | contract setter(@newValue, ack) = { for(_ <- valueHolder) { valueHolder!(newValue) | ack!(true) } } } } }

The above code from tutorial holds a value on channle. 

Rholang specification mentions shortcoming about the above code 


I am interested in the cost, if one deploys the above code to rchain, it would cost more gas to execute it than normal, right? So the user need pay more gas because of low-quality code made by developer.

It seems there is no motivation to encourage developer to write cost-less code
nor punishment mechanism to prevent cost-waste code. 


Member Moderator
Joined:5 months  ago
Posts: 36
03/07/2018 7:11 pm  

I don't think there is a general way to talk about the "efficiency" of a particular piece of code by itself; you can only compare two implementations that have the same function. As such, I do not think it would be possible to build in to the platform mechanisms that prevent developers from writing low-quality code. That being said, I am also not worried about that because I expect that if two contracts with the same functionality exist then the cheaper one will eventually win out over the expensive one because users prefer to pay less.


Please Login or Register