Skip to content

Solidity Development #587

Answered by TatyOko28
Mercure28 asked this question in Q&A
Discussion options

You must be logged in to vote

msg.sender: Refers to the address that called the function (can be a contract or a user).
tx.origin: Refers to the address of the user who initiated the transaction (does not change, even if multiple contracts are called).
Problem withtx.origin : It exposes the contract to phishing attacks . An attacker can create a contract that calls your contract with tx.origin, thus exploiting the verification logic.

Solution : Always use msg.senderto verify caller ID.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Mercure28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants