1

Im new to solidity and trying to figure out if there is any way to retrieve a mappings key value for example from the transaction data in which you set it?

mapping (uint => bool) private solution;

function setSolution(uint _number){
    solution[_number] = true;}

Would it be possible for anyone to find the current value of _number in any way while or after I have set it, or is it hidden?

0

If solution is private then it is available only within the contract.

private: Private functions and state variables are only visible for the contract they are defined in and not in derived contracts.

Solidity Docs # visibility

0

Be careful of the answers being given here!

In context of solidity you may not be able to access private mapping from outside the contract BUT

Everything in Ethereum blockchain is PUBLIC

Nodes store copies of entire blockchain and if someone wants they can read your data if its not encrypted. Be sure to write encrypted data if you want true privacy.

Ref 1: Private Info on Ethereum

Ref 2: Storing private data on the ethereum blockchain

  • This is exactly the point of my question, to find out if its posible to read out the data in any way. And if yes, how? – Xinorl Jul 16 '18 at 9:24

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.