2

My question follows directly this answer to a similar question.

I need for my client app users to be able to trigger private contract deployment. I've tried using privateFor with both the web3 and web3-quorum npm packages, but it doesn't work: contract is deployed but not private.

I understand from the answer above that Quorum only allows creating a private smart contract from the node itself, because the node possess the keys to encrypt and decrypt everything.

So here's my question: Can a smart contract function itself deploy a private smart contract?

I will try but it will take me a while so maybe I can get an answer here before then.

Thank you

bumped to the homepage by Community yesterday

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

0

You need to mention the account addresses where you wish to post your smart contract and you need to mention this in your truffle file(truffle.js).

something like this:

var SimpleStorage = artifacts.require("SimpleStorage");

module.exports = function(deployer) {
  // Pass 42 to the contract as the first constructor parameter
  deployer.deploy(SimpleStorage, 42, {privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]})
};
  • Thank you for your answer. I don't have truffle on my client app. I only use web3js to communicate with the node, and all smart contract solidity files are on the node. My client app only has the abi and bytecode for the smart contract to deploy. – Alice Rocheman Nov 22 '18 at 9:50
  • Truffle would not work for the end user to trigger the contract deployment, would it? – Alice Rocheman Nov 22 '18 at 10:38
  • Okay if you wish to try you can try with the Quorum maker. That will be best suited for deployment of the smart contract. And even though if you able to call the web3js library of quorum you can deploy your contract via RPC port. – shrey bhardwaj Nov 22 '18 at 10:41
  • I've tried connecting Web3.js via RPC port to deploy the contract, but the contract that I deploy is still not private so it's not a solution either. – Alice Rocheman Nov 26 '18 at 8:16
0

how are you? The post is a bit confusing as your question is somewhat unrelated to the rest of the contents of the post. I'll try to answer both, but please feel free to chime in so I can provide more detail.

Your question: Can a smart contract function itself deploy a private smart contract? Yes, if the contract was a Factory contract (factories: Create New Contract from within another contract of the same type in Solidity) and it was executed as a private txn, then newly factoried contract will also be private.

The rest of your post seems to talk about whether or not a contract is private. The first thing to mention here is that a participating node will be able to read this contract with the correct ABI. A node that is not a participant, will either get undefined errors or 0s for all values of this contract. That said, internally in Quorum, you will not see if a contract is private according to its ABI. To check if its private, you should track down the contract creation txn and check its "v" value -- this is explained in depth here: https://github.com/jpmorganchase/quorum/wiki/Transaction-Processing

  • Hi, thanks for your response :) I'm developing a JS client app that communicates with a remote BC node. My app's user is supposed to be able to create a new private Smart Contract between his node and another node. In the linked question, you said it's not yet possible, so I'm looking for another way, maybe with an existing SC that allows SC deployment via a dedicated method. I can check if a SC is private by calling it from a node it's not supposed to be private with. The problem is that so far, any SC I deploy remotely is not private. I will check out your links and get back to you. :) – Alice Rocheman Nov 28 '18 at 9:21
  • Alice, if you are working with Quorum, please join our slack so we could talk in real time. Auto-inviter is here: clh7rniov2.execute-api.us-east-1.amazonaws.com/Express Quorum allows private contracts and private txns, a node configured to be on the Quorum network can generate a txn that will be private thereby allowing you to create an app you are looking for. – fixanoid Nov 28 '18 at 18:16

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.