'Solidity basics: what "msg.sender" stands for

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.



Solution 1:[1]

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: https://docs.soliditylang.org/en/develop/units-and-global-variables.html#block-and-transaction-properties

Solution 2:[2]

Let'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) is 0x0cE446987406E92DF41614C46F1d6df9Cc925847.

Contract Address of the method functionA() in Math.sol is 0x0cE446987406E92DF41614C46F1d6df9Cc753869

Contract Address of the method functionB() in Math.sol is 0x0cE446987406E92DF41614C46F1d6df9Cc357241

Here, functionB() called from functionA().

So, whenever personA calls functionA()

In this scenario, if you get msg.sender and tx.origin inside functionC() then the result would be like this

msg.sender = `0x0cE446987406E92DF41614C46F1d6df9Cc753869` //functionA() Contract address
tx.origin  = `0x0cE446987406E92DF41614C46F1d6df9Cc925847` //personA (EOA) Wallet Address

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pang
Solution 2 Prince Dholakiya