3

If a transaction is sent to a smart contract, can the smart contract read the total gas cost?

4

From the official documentation, you will find that a contract can access a set of properties of the block and its transactions, such as:

tx.gasprice (uint): gas price of the transaction
msg.gas (uint): remaining gas
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.