ZeppelinOS with Quorum/Private Contracts

Does zOS work with Quorum and private contracts?

3 Likes

Hey! Iā€™ll be trying this soon, all I know for now is that OpenZeppelin and Truffle workā€¦ will let you know when I try it. Are you trying to run Quorum on Azure or locally?

2 Likes

Hi @aparm23 Welcome to the community. :wave:

I haven't played with Quorum or private contracts, though hopefully someone in the community has and can provide an answer.

Otherwise please try it out and let the community know how it went. :smile:

Assuming in your use of ZeppelinOS you are using EVM packages such as openzeppelin-eth then you would need to deploy the EVM packages once for the network you are using:

https://docs.zeppelinos.org/docs/linking.html
There is one caveat here with the --deploy-dependencies flag. We mentioned that this feature is about reusing packages that were already deployed, and we do have already deployed versions of openzeppelin-eth and many other packages to mainnet, ropsten, rinkeby and kovan. However, on this guide we are not using any of those networks, instead we started a local development network with Truffle that is empty. So, --deploy-dependencies tells ZeppelinOS to deploy to the network the EVM packages we depend on. This has to be done only once, so if you are using one of the real networks mentioned above, or you are running the command again on the local network, this flag won't be needed.

It would be awesome if you could share what you are working on.

Running Quorum-maker on some VMā€™s I spun up. Currently deploying via truffle and was wondering if I could swap zOS into the build/deploy workflow and how the proxy pattern would handle private contracts

2 Likes

Great thanks! Running a messaging app on top of a quorum-maker blockchain network across a few distributed vmā€™s. Using Quorumā€™s private contracts and transactions to protect messages if desired. Wanted to use zOS as a way to upgrade private contracts going forward

2 Likes

update on what I found: contracts deploy to the network but canā€™t seem to access the contract instance in the truffle console. the myContract = await MyContract.at(ā€™ā€™) hangs where as with ethereum it passes through no issue @ianbrtt @abcoathup

2 Likes

Thanks for keeping us updated @aparm23

Was this a private upgradeable contract or a public upgradeable contract?
Have you tried deploying and interacting the same contract as a standard public contract (not a ZeppelinOS upgradeable contract). (Apologies if I havenā€™t got the terminology right).

What version of ZeppelinOS and Truffle are you using?
(Regards Truffle, was thinking of this issue: Upgrade truffle 5.0.13+ to 5.0.20)

Was a truffle version issue, thanks for the suggestion! Got the template contracts to work, currently troubleshooting my own contracts. ā€œContract code could not be deployed, please check the gas limitā€. I donā€™t think itā€™s actually a gas issue as iā€™ve deployed without zOS on quorum with these @abcoathup

3 Likes

Glad you are making progress on this, I still havenā€™t tried it, but if it works for you, in a near future I would love to know how you did it :slight_smile:

1 Like

Hi @aparm23 it might be worth creating a new topic for the deployment issue (if you havenā€™t already resolved).

Ideally with a sample contract and the versions of truffle, node, zos you are using.

A good way to track down the problem is to deploy a non-upgradeable version of the contract, to determine if it is a general issue or if it is specific to ZeppelinOS.

Hey guys - finally got to the bottom of this. Basically, I had to downgrade truffle to 5.0.4 in order to get the contracts to deploy without the gas error (5.0.20 failed with quorum and ethereum). Once I did that, I had to upgrade truffle to 5.0.12 in order to interact with my contracts (5.0.4 hangs with quorum). I then got to the conclusion that zOS abstracts the migrations file where you can specify privacy, so unable to specify a private contract. I also tried conducting a private transaction through a .js file and it gives this error, since itā€™s not expecting the ā€œprivateForā€ argument

3 Likes

Hi,
just like aparm23, I am currently testing using ZOS with private transactions on Quorum. I see in @aparm23 comment above that ZOS is abstracting the migration file making it not possible to specify a private transaction.
Has anyone looked into this since this comment ? Maybe @abcoathup ?

Thanks!

1 Like

Hi @amkCha welcome to the community :wave:

I havenā€™t tried private transactions on Quorum yet.
@aparm23 and @ianbrtt how did you get on?

Hey guys - I ended up having to manually implement the proxy pattern. Was not able to use zOS for this as it abstracts the migrations

1 Like

Thanks @abcoathup :hugs:

Iā€™m working on a project where we would really want to use ZOS and not manually implement a proxy pattern when ZOS has already implemented the latest one

Is it cumbersome to make ZOS look into the migrations files ? Should we add a feature request on Github ?

2 Likes

Hi @amkCha

There is an example of OpenZeppelin SDK (formerly known as ZeppelinOS) using truffle migrations:

Perhaps you could try using that?

If that doesnā€™t work, please go ahead with creating a feature request.
You would be welcome to tackle the implementation of it too. :smile:

I am attempting to set up an environment so that I can test to.

1 Like

Hi @amkCha

Have you had any success? If not, please go ahead with creating a feature request.


I setup a 7nodes Quorum network using Docker.

I was able to deploy a private contract on Quorum using truffle as per the instructions: https://www.trufflesuite.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains

I was able to deploy and interact with an OpenZeppelin SDK public contract on Quorum created using OpenZeppelin SDK interactive commands.

I tried using truffle migrations with OpenZeppelin SDK based on the following example and adding privateFor option to the deploy and quorum network type but this appears to have created a public contract rather than a private one:

2_deploy_v0.js

Added privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] to the options

// Load zos scripts and truffle wrapper function
const { scripts, ConfigManager } = require('@openzeppelin/cli');
const { add, push, create } = scripts;

async function deploy(options) {
  // Register v0 of MyContract in the zos project
  add({ contractsData: [{ name: 'MyContract_v0', alias: 'MyContract' }] });

  // Push implementation contracts to the network
  await push(options);

  // Create an instance of MyContract, setting initial value to 42
  await create(Object.assign({ contractAlias: 'MyContract', methodName: 'initialize', methodArgs: [42] }, options));
}

module.exports = function(deployer, networkName, accounts) {
  deployer.then(async () => {
    const { network, txParams } = await ConfigManager.initNetworkConfiguration({ network: networkName, from: accounts[1], privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] })
    await deploy({ network, txParams, privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] })
  })
}

Hi @amkCha

I have created a feature request, please add any relevant information.

A community member has created a Pull Request to add privateFor support :rocket:

This is awesome!! Would love to see this get approved

1 Like