I just started to learn Solidity as a personal challenge. I'm not a developer so I've a loooooong way to go.
I'm following the Ethereum.org tutorial, here is what I've got doubt about: What does [msg.sender] stand for? I guess it is the wallet address of who triggered the contract, but I'm not sure.
2 Answers
msg.sender(address): sender of the message (current call)
msg.sender will be the person who's currently connecting with the contract.
Later on, you'll probably deal with contracts connecting with contracts. In that case, the contract that is creating the call would be the msg.sender.
Check out the documentation here:
1Let's make it very simple.
There are two types of accounts in Ethereum
1). Externally Owned Accounts(EOA) [Person]
2). Contracts Accounts [Function of Contract]Both accounts have their addresses.
Wallet address of personA (EOA) is0x0cE446987406E92DF41614C46F1d6df9Cc925847.
Contract Address of the method functionA() in Math.sol is0x0cE446987406E92DF41614C46F1d6df9Cc753869
Contract Address of the method functionB() in Addition.sol is0x0cE446987406E92DF41614C46F1d6df9Cc357241
Here, functionB() called from functionA().
So, whenever personA calls functionA()
In this scenario, if you get msg.sender and tx.origin inside functionB() then the result would be like this
msg.sender = `0x0cE446987406E92DF41614C46F1d6df9Cc753869` //functionA() Contract address
tx.origin = `0x0cE446987406E92DF41614C46F1d6df9Cc925847` //personA (EOA) Wallet Address 2