Consider a getter function with a restriction on who can read it, like
function getData()
public
view
returns (uint x)
{
require(msg.sender = '0x123..123');
x = data;
}
This prevents people from getting this data via Remix or from another contract unless its address is 0x123..123; the requester must know not just the address, but possess its private key.
Yet via web3.js, I can pull this by using
EthContract.methods.getData.cacheCall({ 'from': '0x123..123' })
Here I do not need the private key.
I was wondering if there was a way to call web3.js programs within the blockchain, which would allow one to effectively get around the private key ownership requirement.
msg.sender
to get pass the require. When running on the EVM to get pass through the verification you have to be the correctmsg.sender
.