...by Daniel Szego
quote
"Simplicity is the ultimate sophistication."
Leonardo da Vinci

Sunday, December 17, 2017

Solidity and Truffle Tips and Tricks - Design principles and gas consumption


If you design a solidity code, it is not really practical to use the same design principles as at the classical object-oriented design. It is because having a good object oriented design with multiply objects, references perhaps indirectly event delegation will cause that your gas consumption will explode. Instead try to model first which are the critical transactions that should be carried out as atomic ones. Which are the transactions that can be executed independently from each other, and which are the functionalities or business logic that should not necessarily run as transaction. Based on this model a more efficient gas consumption code can be implemented.