We know that in a smart contract, msg.sender can be used to obtain the address of the user calling the contract. Is it possible for users to forge their own account addresses, causing the msg.sender variable we obtained in the smart contract to be not real?


It is not possible to fake msg.sender.

msg.sender will always be the sender (or caller) of the message.

Please do not confuse msg.sender with tx.origin. The latter will always be the EOA that initiated the call. The former can be the EOA that initiated the call, but can also be the address of a contract that made a call to another address within the transaction.

  • Thanks for your answer!
    – wei wang
    Dec 7 '20 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.