Tx.origin
1 min read
Pronunciation
[tee-eks dot awr-i-jin]
Analogy
Think of `tx.origin` as the 'original sender' field on a package that travels through multiple couriers. It always shows who first sent the package, regardless of which courier handed it over last.
Definition
A global variable in Solidity (and the EVM) that returns the address of the Externally Owned Account (EOA) that originally initiated the transaction. Using `tx.origin` for authorization purposes is a known security vulnerability.
Key Points
Provides the address of the transaction's ultimate initiator (an EOA).
Differs from `msg.sender`, which is the immediate caller.
Using it for authorization (`require(tx.origin == owner)`) is insecure.
Security Warning
Never use `tx.origin` for authorization checks in smart contracts. It can be exploited by malicious intermediary contracts. Use `msg.sender` instead.
Tx.origin - Related Articles
No related articles for this term.