There are two crucial aspects of using gas or transaction fees in public, permissionless networks.
Every transaction published into the blockchain imposes on the network the cost of needing to download and verify it. People who run a node spend time, money and effort to do this for which they are compensated. Transaction fees are rewarded to miners (...
It doesn't matter if you put more than required, because you'll always get it back
There is no single answer to your question, because the required amount of gas may change from one transaction to another, depending on the state of the blockchain (i.e., the value of every state variable involved in the transaction)
It also depends to a certain extent on the ...
If you encauntering
Error: The contract code couldn't be stored, please check your gas amount.
While deploing into private network througth truffle suite, then it may be wrong evm version on remote node
Always check evm version and it differencing from production enviroment
Also you should check for which version of evm truffle use for compilation. It ...
Using an event defined as follows to store the data in the logs improves the gas costs even more. Compared to the best solution that @greag_jeanmart
I forked his code and updated it so it runs with the current version of Truffle. Find the code ...
Your web3 provider will try to estimate how much gas your transaction will take. If it encounters an error (i.e. the tested transaction fails) then it will try to increase the gas, because the error could be an "out of gas" error instead of an internal error in the smart contract. Sadly, by simply reading the error code, you are unable to know whether it was ...
First of all, you don't need to add the gas-price into your computation.
This factor is chosen by you (the transaction sender), so there are no questions about it.
The only part in question is the 64244 gas units used in the transaction.
According to the white-paper, you have determined that it should be 21000 + 68 * 7 = 21476:
21000: Paid for every ...
It is because you are using string which does not has a particular size i.e., it is unbound data type. You can use bytes32 in place of string to limit the cost of gas on execution code because solidity considers it a 32 bit literal.