1

I'm aware that msg.value is the amount of "wei" sent to the contract according to this page. I think it's sent from a transaction so it should be defined there.

Question: How is the value of msg.value in a transaction is defined to have a structure like: msg.value in the contract?

1
  • 1
    It is part of the transaction, from the Ethereum Yellow Paper, section 4.2 "The transaction" it has a field called 'value'. From a contract you cant get this value with the opcode CALLVALUE (0x34), section H.2 "Instruction Set", table "30s Environmental Information" .
    – Ismael
    Aug 15, 2017 at 18:52

2 Answers 2

1

This is what the crontact receive in ethereum (what the sender of the transaction pay exclude gas and miner fee). It is in wei (1 ethereum = 10000000000000000000 wei (10^18)) wei is like satoshi a subunit more precise.

1

It is part of the transaction, from the Ethereum Yellow Paper, section 4.2 "The transaction" it has a field named 'value'.

From a contract you get the value with the opcode CALLVALUE (0x34), section H.2 "Instruction Set", table "30s Environmental Information".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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