I've learned about permissioned block chains here. Is it possible to filter transactions to the contract's methods based on the sender's address. Something the lines of:
contract FilterByAddress {
address[] addrs = [0x36eaf79c12e96a3dc6f53426c, 0xf235aa56dd96bda02acfb361e];
address controlAddr = 0x36eaf79c12e96a3dc6f53426c;
function getSensitiveData() public return (string) {
uint i = 0;
for(i = 0; i < addrs.length; ++i)
if(msg.sender == addrs[i])
return "You got the secret";
else
return "You got nothing";
}
}
Where the secret is a value encrypted with a key obtained through a secure channel.
Would it be also possible to control the list of allowed peers by their address? For example,
function addAddress(address addr) public return (uint) {
if(msg.sender == controlAddr) {
addrs.push(addr);
return 1;
} else
return 0;
}
Now this isn't a fully permissioned block chain as any may sync with it and see the contract's contents and it's still susceptible to the 51% attack.
Will the contract's state change (the address filtering list) when updated from the controlAddr?