Fund:0.02 ETH / $11.57
Question is solved

What is the difference between msg.sender and tx.origin?

1 month ago

I’ve been learning Solidity and love the Blockgeeks videos. I see in many contracts people using both msg.sender and tx.origin. I’ve read the docs and still don’t fully grasp what the difference is.


To put it shortly, msg.sender can be a ETH address or another contract whereas tx.origin cannot handle a contract as the sender. Vitalik recommends using msg.sender as tx.origin may be deprecated with the Solidity Serenity update (release date still TBD I believe). So tx.origin will not work if it is a contract address reaching out to it but msg.sender would. Otherwise they are very similar just with msg.sender being more future proof.
1 month ago

Your question is successfully refund. You will be redirect in few seconds.