Comments (12)
Hi @trekdev
Private transactions cannot update public contracts since that would result in a consensus break on the public state as a result of execution of those transactions. In fact the EVM has been modified to specifically prevent private transactions from writing to public contracts. Please see this section in the wiki and this section in the docs for information. Note – we plan to move all documentation from /docs into the wiki to ensure no documentation is inadvertently hidden.
If public/private state mixing isn't possible this scenario also causes some confusion with a private contract between 2 parties, and a transaction changing the state shared with only 1 of those participants. So can someone query the contract's state in two ways: one with only public knowledge of the state, and another which includes any private knowledge?
Private State is not shared, so to speak, between parties. Rather, each party has state that is private/local to their node. In certain scenarios, the state of the private contract between 2 (or more) parties may be perfectly in sync (i.e. because future Transactions are always made private to both (all) parties concerned). Whereas in other scenarios there may be a need to make some part of the contract private to a subset of the original parties (through Transactions that are private to only those parties). In terms of querying the contract’s state, you can only query for ‘the state’ of a contract, i.e. the complete state that you are privy to.
If the later is the case, what would happen if the public contract could send ether to an address? If a private transaction calls sendEther, what would everyone think the contract's and the beneficiary's balances are?
It is not possible to send a private Transaction to a public contract. Note, however, that the original contract could be made pseudo-private but making it private for every participant on the network ( or those that you may care about). This has the effect of classifying the transaction as private, whilst giving visibility to many parties. You can then make value-updating calls from one party to another, although note that Quorum does not support Ether as a Token (but does use it for gas purposes - gas being priced at 0).
In the case that public contracts and private transactions can't be mixed, I'm not sure what would happen if the 2nd contract was created privately and a private transaction sent ether to another address. Could you check someone's "private balance" and have it behave like a private token?
Per the above, Ether as a Token is not supported in Quorum. However, in terms of your own Tokens, representing these in Quorum is fine but not if their transfer/ownership should be kept private. Enabling the transfer of a token that is private to one set of parties (A,B) to another (A,C) is on our product roadmap. Note too that if your example was updating a balance as opposed to sending a token, that could be achieved through the pseudo-private example above – see Section 6.1 in the Quorum Whitepaper for further info.
from quorum.
It is not possible to send a private Transaction to a public contract. Note, however, that the original contract could be made pseudo-private but making it private for every participant on the network ( or those that you may care about).
Seeing a lot of examples and tutorials following this pattern. However, in a typical Consortium scenario, where you might have to onboard participants at a later stage, making these existing private contract instances visible/accessible to them as well is not possible I believe. The only option is to deploy a duplicate private instance every time new nodes are onboarded, but then it would mean the existing parties have to keep track of multiple private instances of the same contract.
On a different note, when using the ContractFactory -- Contract Pattern, is it possible to make the Factory instance a public contract(for reasons quoted above) and make the Contract instantiated by it, private?
I have such a setup working in Ethereum (without the privacy bits) and have been trying to see if this can be made to work on Quorum (with the privacy bits). If not, what is the recommended alternative approach?
from quorum.
@cltsao thats currently possible -- once a private contract has been created between N parties, any subset of these could be used in follow up txns. That said, you need to ensure that this is the desired functionality in your use case.
from quorum.
@cltsao overall, we agree. At the moment, theres no enforcement of this on private txn manager side, but its an area we are working on at the moment and will have something in place by the end of the year. Please follow Quorum and Tessera releases.
from quorum.
@tylobban Thanks very much for clarifying. Just a small follow up question:
Whereas in other scenarios there may be a need to make some part of the contract private to a subset of the original parties (through Transactions that are private to only those parties)
Isn't this practically the same as sending a private transaction to a public contract (the transaction that alters the state of the contract is restricted to a subset of people that can see the contract).
from quorum.
Not quite - the key point here is 'altering the state'. Consensus must be reached on the state of all public contracts, thus if only a subset of participants were updating that state (as in your example of sending private transactions to a public contract), participants would end up with different public states and it would not be possible to achieve consensus. Making these contracts private has the effect of excluding them from the global state check during the consensus process.
from quorum.
@tylobban Thanks very much.
from quorum.
Enabling the transfer of a token that is private to one set of parties (A,B) to another (A,C) is on our product roadmap.
May I know if this is delivered? If no, which issue should I track?
from quorum.
@CLDH214 it is in progress but is not yet delivered. See Issue 152.
from quorum.
@tylobban Thank you for your clarification. One follow-up question. When I send a private transaction to a private contract, can I sent it to a subset of recipients of the private contract? Let's say a private contract is deployed on node A, B, and C. If A sends a private transaction only to B to modify a state on the private contract, does it make state inconsistent between A/B and C?
from quorum.
@fixanoid Thank you for your response. I feel allowing such inconsistency poses risk in using private contracts. Can Quorum force all follow-up transactions of a private contract to be sent to the same recipients? That will ensure that private state is always consistent among recipients of a private contract.
from quorum.
Private transactions cannot update public contracts since that would result in a consensus break on the public state as a result of execution of those transactions. In fact the EVM has been modified to specifically prevent private transactions from writing to public contracts. Please see this section in the wiki and this section in the docs for information. Note – we plan to move all documentation from /docs into the wiki to ensure no documentation is inadvertently hidden.
@tylobban
You mean "Private contracts cannot update public contracts." not "Private transactions cannot update public contracts " Huge difference.
from quorum.
Related Issues (20)
- Berlin fork causing panic when accessing private state.
- QBFT Block time < 1 seconds HOT 3
- Memory usage of non-validator nodes grows indefinitely, leading to OOM and unclean shutdown HOT 1
- Panic randomly occurs on node shutdown, leading to unclean shutdown HOT 1
- Fatal: Consensus not specified. Exiting!! HOT 1
- Is the Quorum Network Remix plugin not available anymore? HOT 2
- QBFT: maxRequestTimeoutSeconds triggers ROUND-CHANGE storm after some rounds and the cluster cannot recover even when all nodes are back
- Role level 2: can deploy, cannot transact.
- Debug tracing via debug_traceCall endpoint does not work on private smart contracts HOT 1
- Upgrade geth to at least 1.10.20
- Bootnodes in genesis file
- Add function to toggle on/off IP Validation in Enhanced Permissioing NodeManager HOT 1
- Can we leverage Privacy Enhancements feature along with Privacy marker transactions (PMTs)? HOT 1
- The Round Change continues indefinitely, BUT no new block is being generated. HOT 3
- Need to create peer node on another VM and enable mine too
- highest solidity compiler compatible with quorum
- contract creation code storage out of gas
- EOF while setting up TLS connection between qlight.server and qlight.client
- net.peerCount is 0 for QBFT private network with 5 validator nodes
- The Quorum network built on the AKS cluster with Quorum-Kubernetes repeats the round change and causes block generation to stop HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quorum.