简体   繁体   中英

What's the difference between public and private transactions on the Quorum Blockchain

我搜索了很多站点博客,但没有获得Quorum区块链中公共交易和私人交易之间的确切区别?

https://github.com/jpmorganchase/quorum/wiki/Transaction-Processing Seemed pretty clear to me -

Public Transactions are executed in the standard Ethereum way, and so if a Public Transaction is sent to an Account that holds Contract code, each participant will execute the same code and their underlying StateDBs will be updated accordingly.

Private Transactions, however, are not executed per standard Ethereum: prior to the sender's Quorum Node propagating the Transaction to the rest of the network, it replaces the original Transaction Payload with a hash of the encrypted Payload that it receives from Constellation/Tessera. Participants that are party to the Transaction will be able to replace the hash with the actual payload via their Constellation/Tessera instance, whilst those Participants that are not party will only see the hash.

The result is that if a Private Transaction is sent to an Account that holds Contract code, those participants who are not party to the Transaction will simply end up skipping the Transaction, and therefore not execute the Contract code. However those participants that are party to the Transaction will replace the hash with the original Payload before calling the EVM for execution, and their StateDB will be updated accordingly. In absence of making corresponding changes to the geth client, these two sets of participants would therefore end up with different StateDBs and not be able to reach consensus. So in order to support this bifurcation of contract state, Quorum stores the state of Public contracts in a Public State Trie that is globally synchronised, and it stores the state of Private contracts in a Private State Trie that is not synchronised globally. For details on how Consensus is achieved in light of this, please refer to the section on Consensus.

Public transactions at like regular Eth transactions, whereas Private ones seem to be a way to limit the number of network entities that can successfully execute a smart contract within the transaction. For an analogy, consider the internet and http vs https websites. When you use http anyone in the network (well, anyone between you and the remote site) can snoop your traffic and know what you're doing. In https, only the destination site and you can know what you're doing. Both traffic types are carried on a public network and some data flowing between parties can be seen, but whether that data makes sense to everyone who looks or only some people who have the right access, is the difference. Same for Quorum trans- everyone can see and act on a public contract, only certain people can see and act on a private contract. It establishes smaller groups of people that know something secret, within a larger population

Public transactions in Quorum Blockchain are exactly same as they are done in ethereum.They modify only the public state of the blockchain. Whereas the private transactions are done by specifying an extra feild privateFor along with other feilds. in which we give the constellation public keys of nodes for which the transaction should be privateFor. In private Transactions only pthe rivate state of the respective nodes for which the transaction was done is modified. And you cannot modify both public and private states in quorum in the same transaction. Hope it gives you a starting point see here for more

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM