0

As far as I know, private variables can only be access within the contract and internal function can only be called internally.

But is there a way for hacker to modify their block chain binary (of their own block chain) so that it allows the function to be called or variables be accessed?

An analogy is like private function inside C# classes can still be invoked via reflection. But instead of using reflection, we modify the mono runtime to ignore the private keyword.

Thanks in advance

1

You don't need to modify the binary to read the private data in a contract; you can just call eth_getStorageAt. (See https://programtheblockchain.com/posts/2018/01/02/making-smart-contracts-with-public-variables/ for an explanation of what private vs. public means in terms of state variables.) So for read-only access, yes, everything's readable by anyone.

As to modifying state, of course someone could modify their local code to let them call functions if they wanted to or change balances or whatever. But all of that would just be on their computer; all the other nodes in the Ethereum network would not accept the invalid blocks or transactions they produced.

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.