1

My contract uses onlyOwner to restrict access to several functions. Everything was working but I've had to port everything to use Infura and no longer have local accounts.

I'm able to sign transactions offline / use sendRawTransaction but I'm not sure how to go about doing this with pure functions (not creating transactions) that are still onlyOwner.

I'm using web3.py but I can figure it out from web3.js etc.

heyyouyayou
  • 33
  • 1
  • 3
  • 1
    A comment suggests that you might trying to be store secret information in a contract. All contract variables are world-readable. See one discussion here: https://ethereum.stackexchange.com/questions/2624/private-info-on-ethereum – carver Jan 22 '18 at 22:43

1 Answers1

1

You don't need to sign a call at all. Just specify the right from address to make it past the onlyOwner check.

If you're having trouble doing that, please share your code.

user19510
  • 27,999
  • 2
  • 30
  • 48
  • Doesn't that defeat the purpose of onlyOwner if I can specify the from: address without any authentication? – heyyouyayou Jan 22 '18 at 21:55
  • calls can't have any side effects, so there's no reason to authenticate. – user19510 Jan 22 '18 at 21:56
  • 2
    I guess @heyyouyayou is trying to limit access to read data. However, that is not so simple in Ethereum. All data is visible on the blockchain. The transaction that would have written the information is visible and can be inspected with any blockchain explorer, so the value cannot be secret unless explicitly encrypted. (Even hiding it with encryption may not be simple. Anyone with access permissions would need to have the key and other information needed to decrypt.) – Ajoy Bhatia Jan 22 '18 at 23:30