Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 324
Sumak Avatar asked Feb 01 '18 12:02

Sumak


People also ask

What does MSG sender mean in Solidity?

What is msg. sender in Solidity? The msg. sender is the address that has called or initiated a function or created a transaction. Now, this address could be of a contract or even a person like you and me.

What is _; in Solidity?

In Solidity, there is the uncommon instruction _; . _; is used inside a modifier to specify when the function should be executed. A modifier is a piece of code that manipulates the execution of a function. The _; instruction can be called before and after the call of the function.

What is TX origin in Solidity?

tx. origin is a global variable in Solidity which returns the address of the account that sent the transaction. Using the variable for authorization could make a contract vulnerable if an authorized account calls into a malicious contract.

What are state variables in Solidity?

State Variables − Variables whose values are permanently stored in a contract storage. Local Variables − Variables whose values are present till function is executing. Global Variables − Special variables exists in the global namespace used to get information about the blockchain.


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

like image 143
ReyHaynes Avatar answered Oct 03 '22 01:10

ReyHaynes