I am struggling to enforce privacy using Quorum's privateFor option.
I have provisioned a consortium in Azure blockchian service with 3 nodes. I deploy a smart contract from node2 privateFor node1 using the below code, but node3 can see the contract and execute functions as well(in remix for example). I can't figure out what i am doing wrong.
const Web3 = require('web3')
const rpcURL = "https://node2.blockchain.azure.com:3200/<AccessKey>"
const web3 = new Web3(rpcURL)
const EthereumTx = require('ethereumjs-tx').Transaction
const account = '<myAccountAddress>'
const privateKey = Buffer.from('<myPrivateKey>', 'hex')
const contractByteCode = '<contractbByteCode>'
const Common = require('ethereumjs-common').default
const customCommon = Common.forCustomChain(
'mainnet',
{
name: 'my-network',
chainId: <myChainId>, //from genesis
},
'constantinople',
);
web3.eth.getTransactionCount(account, (err, txCount) => {
if (err!=null) {console.log('error executing web3.eth.getTransactionCount: ', err)}
else{
console.log('txCount: ',txCount)
const txObject = {
nonce: web3.utils.toHex(txCount),
gasLimit: web3.utils.toHex(3000000),
gasPrice: web3.utils.toHex(web3.utils.toWei('0', 'gWei')),
data: contractByteCode,
privateFor: ['<node1publickey>']
}
const tx = new EthereumTx(txObject,{common: customCommon})
tx.sign(privateKey)
const serializedTransaction = tx.serialize()
const raw = '0x' + serializedTransaction.toString('hex')
web3.eth.sendSignedTransaction(raw)
.on('transactionHash',(hash) => {
console.log('txHash:', hash)
})
.on('receipt',(receipt) => {
console.log('receipt', receipt)
})
.on('error', console.error)
}
})
The Azure Blockchain service overview page looks like below. I do not see any mention of transaction member or constellation or Tessera :