Quorum Blockchain - GeeksforGeeks

11 May, 2022
Quorum is an “Enterprise-focused” Ethereum blockchain that tries to improve blockchain technology.  Although the first generation Blockchain provides scalability, peer-to-peer networks, interoperability, transparency, and other features, it is still not perfect. Researchers around the world are working hard to improve the state of the blockchain. Quorum is the brainchild of JP Morgan, which developed to advance blockchain technology in the financial industry.
At present, the finance sector’s information is handled by more than one organization, but still, the finance sector suffers from a lack of transparency, information control, and security. The traditional blockchain also does not fulfill the finance sector requirements even if it provides traceability and immutability. There is a need for a system that provides private control on the blockchain through automation which is customizable according to needs.   
Performance: Quorum is faster than Bitcoin and Ethereum. It carries out more than 150 transactions per second. This is because of the simple consensus mechanism used by quorum. By default, quorum uses RAFT consensus for fault-tolerance and IBFT consensus for Byzantine fault tolerance, which is quite faster than Ethereum’s proof of work consensus.
Permission Management: It limits participation to a known set of nodes that have to be provisioned to be part of the blockchain network, so it is not open to all and implemented only between participants that are pre-approved by a designated authority
Elimination of transaction pricing: It eliminated the concept of adding cost to a transaction using gas. There is no need for any cryptocurrency costs associated with running transactions on the quorum network. The Quorum code was initially forked off Ethereum, the usage of the gas itself exists but is set to zero.
Better Privacy: Quorum provides on-chain public and private transactions. The open transactions are similar to Ethereum, whereas private transactions are not exposed to the public. It uses Constellation technology which encrypts specific messages in a place called an enclave and stores information about previous transactions.
Assets Management: It allows an entity to create, manage, and distribute digital assets without going through a third party. This gives the owner autonomy over how to manage their assets.
Open Source: It is an open-source where more than 300 contributors are active and working on the development of Quorum.
Consensus Algorithm: It uses the “Quorum-Chain” consensus algorithm which is based on majority voting. However, not all nodes are capable of voting. Only a few and selected nodes are given the ability to vote in the voting process. This helps in the verification of the transaction. Quorum uses Istanbul BFT and Raft-based models for better fault tolerance. Only selected participants take part in the network.
Hybrid Smart Contracts: Smart contracts are set to both private and public and solidity is used to program them. Once a smart contract is set private, it cannot be transformed into a public one. Similarly, public smart contracts cannot be changed to private ones, which makes them more secure.
Performance: Quorum provides higher transaction speed since generally private contracts are used and private contracts work better than public ones. It has been tested that the Raft performs better than the Istanbul BFT.
Scalability: Quorum’s channel-based approach to privacy presents challenges for privacy and scalability as use cases become more complex.
Lack of crypto-economics: Quorum doesn’t require a built-in cryptocurrency because consensus is not reached via mining. It’s not possible to develop a native currency or a digital token with Quorum.  
Lack of Support: There are fewer developers and contributors to Quorum, due to which the help and support are less.  
Let’s discuss the architectural details of Quorum Blockchain.
Quorum Node: It is a command-line tool that is a lightweight fork of Geth. It is configured only to allow connection from permission nodes, ditching the P2P connectivity.
Constellation: It kept the transaction manager and enclave. It ensures that information added to the blockchain remains secure in every possible way.Transaction Manager: It takes care of the transaction privacy and ensures that the transaction data is encrypted during the process by storing the allowed access and other important data to facilitate the transactions.Enclave: It provides different cryptographic techniques such as participant authentication, transaction history, and other key functions to ensure that all the operations are performed optimally with a focus on scalability.
Transaction Manager: It takes care of the transaction privacy and ensures that the transaction data is encrypted during the process by storing the allowed access and other important data to facilitate the transactions.
Enclave: It provides different cryptographic techniques such as participant authentication, transaction history, and other key functions to ensure that all the operations are performed optimally with a focus on scalability.
Alastria: A multisector Spanish consortium. It promotes the establishment of DLT semi-public infrastructure. It aimed to improve services in Spain and will work according to European regulations.
VAKT: It provides a digital ecosystem that enables users to do physical post-trade processing. It can be termed as a “Post Trade Management Platform.” By doing so, it acts as a single source for the trade lifecycle which can be verified when needed. It covers the end-to-end trade life cycle, unlike other solutions that only try to solve a certain part and not the whole problem.
Kimlic: It is a KYC on the blockchain. It is a decentralized identity validation platform. It helps startups to instantly add users to their Dapps and crypto exchanges. This means that the user only needs to complete KYC once and then it can be used on different platforms.
Blockoneiq-quorum: It is a data provider for the Quorum blockchain, an Oracle framework that would help the DLT to use signed content which is generated and captured using smart contracts from Thomson Reuters.
Komgo: It is an interesting project that helps financial network integration with other users and networks.
Vaccination tracing: One of the great features of Quorum is to hold records that are only accessible to various individuals. A team in Nigeria with the United Nations has come up with a way to use Quorum to create a secure database for vaccinations with blockTEST. This database shows records of children that have or are yet to have vaccinations.
Supply Chain Tracking: Various industries and businesses are using Quorum to track the supply of their products. For instance, Starbucks uses the Microsoft feature, Azure, to track coffee production in various parts.
Customized Private Blockchains: Any private financial institution can take full advantage of Quorum blockchains like banks or insurance companies. The permissioned nature helps Quorum to be used in all types of settings. The ability to customize from the onset is what makes it an ideal candidate.
Step 1: Open the Google cloud shell in the provided editor mode from the Google developer console.
Step 2: Install Docker.
Step 3: Clone the repository by running these commands and, after that, move to the quorum-examples folder.
$ git clone https://github.com/jpmorganchase/quorum-examples
$ cd quorum-examples
$ PRIVATE_CONFIG=ignore QUORUM_CONSENSUS=raft docker-compose up -d  
Step 4:  After running the above command there are 7 containers running with 7 nodes and 7 transaction managers. At least 3 nodes are required. So, open 3 terminals and activate the 3 nodes by running these commands:
For node1:
docker exec -it quorum-examples_node1_1 geth attach /qdata/dd/geth.ipc
eth.accounts
eth.getBalance("0xed9d02e382b34818e88b88a309c7fe71e65f419d")
For node 4:
docker exec -it quorum-examples_node7_1 geth attach /qdata/dd/geth.ipc
eth.accounts
eth.getBalance("0xcc71c7546429a13796cf1bf9228bff213e7ae9cc")
For node 7:
docker exec -it quorum-examples_node4_1 geth attach /qdata/dd/geth.ipc
eth.accounts
eth.getBalance("0x9186eb3d20cbd1f5f992a950d808c4495153abd5")
 Step 5: Create a smart contract (sample code), copy the code, and paste it into any geth console to generate the contract address: 
a = eth.accounts[0]
web3.eth.defaultAccount = a;
// abi and bytecode generated from simplestorage.sol:
// > solcjs --bin --abi simplestorage.sol
var abi = [{"constant":true,"inputs":[],"name":"storedData","outputs":
          [{"name":"","type":"uint256"}],"payable":false,"type":"function"},
           {"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set",
            "outputs":[],"payable":false,"type":"function"},
           {"constant":true,"inputs":[],"name":"get","outputs":
          [{"name":"retVal","type":"uint256"}],"payable":false,"type":"function"},
           {"inputs":[{"name":"initVal","type":"uint256"}],"payable":false,"type":"constructor"}];
var bytecode = "0x6060604052341561000f57600080fd5b604051602080610149833981016040528080519060200190919050505b806000819055505b505b610104806100456000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605157806360fe47b11460775780636d4ce63c146097575b600080fd5b3415605b57600080fd5b606160bd565b6040518082815260200191505060405180910390f35b3415608157600080fd5b6095600480803590602001909190505060c3565b005b341560a157600080fd5b60a760ce565b6040518082815260200191505060405180910390f35b60005481565b806000819055505b50565b6000805490505b905600a165627a7a72305820d5851baab720bba574474de3d09dbeaabc674a15f4dd93b974908476542c23f00029";
var simpleContract = web3.eth.contract(abi);
var simple = simpleContract.new(40002, {from:web3.eth.accounts[0], 
                                data: bytecode, gas: 0x47b760}, 
                                function(e, contract){
if (e) 
{
 console.log("err creating contract", e);
} else 
{
 if (!contract.address) 
 {
  console.log("Contract transaction send: TransactionHash: " + 
               contract.transactionHash + " waiting to be mined...");
 } else 
 {
  console.log("Contract mined! Address: " + contract.address);
  console.log(contract);
 }
}
});
 
Step 6:  Once the transaction hash is generated, it is possible to get the contract address by using this command:
eth.getTransactionReceipt(mention the txHash here as shown in picture)
Step 7: Deploy the contract address.
var address = # mention your contract address here
var abi = [{"constant":true,"inputs":[],"name":"storedData","outputs":
          [{"name":"","type":"uint256"}],"payable":false,"type":"function"},
           {"constant":false,"inputs":[{"name":"x","type":"uint256"}],
            "name":"set","outputs":[],"payable":false,"type":"function"},
           {"constant":true,"inputs":[],"name":"get","outputs":
          [{"name":"retVal","type":"uint256"}],"payable":false,"type":"function"},
           {"inputs":[{"name":"initVal","type":"uint256"}],"type":"constructor"}];
var private = eth.contract(abi).at(address)
Output: Here node 1 made a private transaction to node 7 and node 4 is completely isolated from this transaction state, so only node 1 and node 7 are able to see the transaction state.  
 
Blockchain
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to connect ReactJS with MetaMask ?
How to Set up Ganche with Metamask?
Solidity - While, Do-While, and For Loop
How to Setup Your Own Private Ethereum Network?
Difference between Public and Private blockchain
Blockchain - Hyperledger vs Ethereum
Solidity - Variables
Solidity - Error Handling
Solidity - Types
Blockchain | Smart Contracts