Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain difference between tx.origin and msg.sender. #299

Open
DavidBDiligence opened this issue Sep 9, 2022 · 1 comment
Open

Explain difference between tx.origin and msg.sender. #299

DavidBDiligence opened this issue Sep 9, 2022 · 1 comment

Comments

@DavidBDiligence
Copy link
Contributor

In the tx.origin page it would be helpful to include short background information on what tx.origin is and how it differs from msg.sender.

@AnandK-2024
Copy link

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

for more information cheak this https://learning.oreilly.com/library/view/solidity-programming-essentials/9781788831383/3d3147d9-f79f-4a0e-8c9f-befee5897083.xhtml#:~:text=The%20tx.,account)%20that%20invokes%20the%20function.

thanks,
A K.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants