Govur University Logo
--> --> --> -->
...

Why is it very risky to use `tx.origin` to decide who can do important things in a contract, even if `msg.sender` is used for other stuff?



Using `tx.origin` to decide who can perform important actions in a smart contract is very risky due to the fundamental difference between `tx.origin` and `msg.sender` in a transaction's call stack. `tx.origin` is the address of the Externally Owned Account (EOA) that initially signed and sent the transaction, initiating the entire sequence of calls. This value remains constant throughout all subsequent internal and external calls within that single transaction. In contrast, `msg.sender` is the address of the account or contract that directly called the currently executing function. `msg.sender` changes with each external call in a transaction's call chain. For instance, if EOA A calls Contract B,....

Log in to view the answer



Redundant Elements