I am having two contracts, custodian and trader. I am using custodian as a member of trader contract. contract trader { . . custodian public custodianUser; . . }
I am deploying custodian on separate node. When I try to set custodian by calling a function setCustodian of trader, I am not able to see custodian getting associated for trader. Code works fine in remix and also on my ubuntu instance if I dont use privateFor while deploying contract. Can any one help me to use privateFor wisely. The script used was as follows:
loadScript("trader.js");
var traderbin = output.contracts["trading2.sol:trader"].bin
var traderContract =
web3.eth.contract(JSON.parse(output.contracts["trading2.sol:trader"].abi));
var trader = traderContract.new(
{
from: web3.eth.accounts[0],
data: '0x' + traderbin,
gas: '4700000',
privateFor: [<key1>,<key2>,<key3>]
}, function (e, contract){
console.log(e, contract);
if (typeof contract.address !== 'undefined') {
console.log('Contract mined! address: ' + contract.address + '
transactionHash: ' + contract.transactionHash);
}
});
var custodianBin = output.contracts["trading2.sol:custodian"].bin
var custodian = web3.eth.contract(JSON.parse(output.contracts["trading2.sol:custodian"].abi));
var custodianContract = custodian.new(
{
from: web3.eth.accounts[0],
data: '0x' + custodianBin,
gas: '4700000',
privateFor: [<key4>,<key5>]
}, function (e, contract){
console.log(e, contract);
if (typeof contract.address !== 'undefined') {
console.log('Contract mined! address: ' + contract.address + '
transactionHash: ' + contract.transactionHash);
}
});
I am having 3 Different contracts deployed as follows: Trader1 > Custodian1 > CustodianMain > Custodian2 > Trader2
If I make changes in Trader2, changes should pass upwards until Trader1
In order to make it happen, do I need to add privateFor for all nodes? If I add all node public keys in privateFor, then is there any advantage of using quorum in this scenario?