Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • I made the function non-constant, and it still did not return the msg.sender. How can I utilize the msg.sender value in a non-transaction function? I wish to get data without paying gas, and I only want that function accessible to the creator. If a non-transaction function can't return the msg.sender value, how can it utilize it within the function's logic? Commented Sep 4, 2017 at 21:58
  • You use contract storage to store the owner address Commented Sep 4, 2017 at 22:14
  • I want to compare the owner's address to the current user's address. If a non-transaction function can't return the msg.sender value, how can it utilize it within the function's logic (to compare the owner address to the current user's address)? Commented Sep 4, 2017 at 22:22
  • Can't you just do myContractInstance.owner() === userAddress? You can get user's accounts in web3.eth.accounts. Commented Sep 4, 2017 at 22:25
  • What is the specific contract method that returns the address of the person that called a non-transaction function? This needs to be accessible from within the contract (not from JS), because that is where the logic needs to compare to the owner's address.. Commented Sep 4, 2017 at 22:30