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

Refresh

5 weeks ago

Views

20 time

0

I am trying to follow this tutorial https://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains. 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

0

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.