0

this link talks about contract visibility and accessibility in the blockchain. Solidity functions - private visibility

So if I use the keyword "onlyOwner" only the owner can call the function?

Is it possibile to fake the sending address of the owner or the blockchain nature already prevents it?

1 Answer 1

2

onlyOwner is defined in the contract code. The code checks that msg.sender matches the owner variable that has been set previously.

msg.sender is created automatically: It's either the account that signed the transaction or the contract that called your contract. You can rely on it to be correct and not faked: If you could fake msg.sender, Ethereum would be completely broken.

The owner address will depend on the previous code that defines it, but it will be correct unless that code is buggy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.