Hello Solidity devs. Do anyone have any suggestions on what I can do to minimize the energy consumption when interacting with a smart contract on the Tron network?

Nov 3, 2020, 1:07 PM
Will it cost more energy to use for example uint256 than uint64?
Nov 3, 2020, 1:12 PM
Yes
Nov 3, 2020, 1:13 PM
If I declare a variable as just uint it will automatically be a uint256?
Nov 3, 2020, 1:14 PM
Yes
Nov 3, 2020, 1:15 PM
So integers that I know will just be short number I better set like uint8?
Nov 3, 2020, 1:15 PM
Yes
btw uint256 var1, uint8 var2, uint8 var3 take low memory than, uint8 var1, uint256 var2, uint8 var3
Nov 3, 2020, 1:17 PM
How do you mean, like the order they are declared?
Nov 3, 2020, 1:41 PM
Does it really depends on the order?
Nov 3, 2020, 1:49 PM
Yep
Nov 3, 2020, 1:50 PM
Any specific reason?
Nov 3, 2020, 1:50 PM
Google it. Don’t have time
Nov 3, 2020, 1:52 PM
I have been trying to find some info about this on Google, please share the info for this whenever you have time.
Nov 3, 2020, 2:16 PM
There is info about it in zombie tutorials
Crypto zombies. Probably lvl2
Nov 3, 2020, 2:17 PM
Ok, thx. Will have a look there
Nov 3, 2020, 2:17 PM
πŸ‘Œ
Nov 3, 2020, 2:17 PM
https://fravoll.github.io/solidity-patterns/tight_variable_packing.html
Nov 3, 2020, 2:19 PM
Thx πŸ‘
Nov 3, 2020, 2:20 PM
Search solidity int packing
Nov 3, 2020, 3:26 PM
I'm not sure I understand. A contract creation is always a Create opcode (or create2), if that's what you mean.
But, yes, you can call a function with the contract bytecode and ask the function to deploy that bytecode
(I think, unsure how to do it in reality)
Nov 3, 2020, 3:37 PM
For your usecase, that's the best choice
Nov 3, 2020, 3:54 PM

Β© 2024 Draquery.com All rights reserved.