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.
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.
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With