5

I was reading solidity Docs and everything made sense until I got to this:

enter image description here

What are external observers? Is it clients listening for events or is it anyone who has access to web3 api?

For example, who can access and modify uint private x = 255; except the contract it's in?

In other words, how can one get the value stored in a private state variable?

4

External observers are anyone who access to a block explorer, or is otherwise able to get blocks from the network and parse the data on the blockchain.

Note that they can only access data in your contract, they are not able to modify it.

So we can all find out the value of your uint private x. If I wrote a contract, the contract wouldn't directly be able to see what x was, because x would be a private variable in a different contract. But if my contract trusted me I could look up x myself and send it to my contract as a parameter...

  • thank you, I get it now. However, I just looked up the contract account of Eth foundation on etherchain.org and didn't find any information on its state variables. etherchain.org/account/…. – manidos Aug 1 '16 at 8:59
  • The same on etherscan.io... – manidos Aug 1 '16 at 9:06
  • 2
    Try live.ether.camp – Edmund Edgar Aug 1 '16 at 9:14
  • just to be clear, there's absolutely no way to call a private function from outside the contract it resides in? – manidos Aug 3 '16 at 6:18
  • 2
    Correct. A private function can only be called by the contract that declares it. – Edmund Edgar Aug 3 '16 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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