April 2018
Intermediate to advanced
222 pages
5h 28m
English
Careful readers might have noticed in the previous code illustration that both tx.origin and msg.sender show the same result and output. The tx.origin global variable refers to the original external account that started the transaction while msg.sender refers to the immediate account (it could be external or another contract account) that invokes the function. The tx.origin variable will always refer to the external account while msg.sender can be a contract or external account. If there are multiple function invocations on multiple contracts, tx.origin will always refer to the account that started the transaction irrespective of the stack of contracts invoked. However, msg.sender will refer to ...