The contract is supposed to be private but every node can access the ledger


April 2019


20 time


I am trying to follow this tutorial I configured 2_deploy_simplestorage.js at is mentionned and
the command deployer.deploy(SimpleStorage, 42, {privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]}).

When I try to verifiy the privacy of the value, it seems that every node can access the data, what could be the problem! I have to mention that the commend initials the value to 42 but when I verify it is 0! this is the smart contract:

 pragma solidity >=0.4.17;

 contract SimpleStorage {
 uint public storedData;

 function inita (uint initVal) public {
 storedData = initVal;

 function set(uint x) public {
 storedData = x;

 function get() view public returns (uint retVal) {
 return storedData;

1 answers


The private state is only available to the participants. If you attempt to query the state on a non-participant node, then it will return an empty result. So the value of 42 will be returned on participant nodes. The non-participant nodes will return a value of 0.