Skip to Content
Technical Articles

Quorum – To begin with Quorum Blockchain Services – SCP Trial FOC

It’s a good time for Blockchain scenarios…!!!  SAP is focusing on Customer & Partner demands and adding more value to its Cloud Platform Blockchain Services. With the release of Quorum, I would like to explore and see how it works.

Release – Quorum Blockchain Available for SAP Cloud Platform Trial Accounts

Help Documents – Quorum on SAP Cloud Platform

Now, what is/why Quorum?

To being with, Quorum is an enterprise-focused version of Ethereum. Yes, you heard me correct, Quorum is a fork of Ethereum which is one of the biggest development community on Blockchain; it is an Open Source framework supported by Financial Institutions to meet the business requirements.

Quorum gives you a high speed, high throughput processing and adds value on the areas of Trust, Community, and Maturity.

Quorum is designed in such a way that most of the Ethereum Smart Contracts can be deployed with minimal efforts and is focused to be developed and evolve along Ethereum. Quorum uses a scripting language called Solidity(supported by Ethereum).

As a part of the release, SAP Quorum service supports Consensus mechanism called Istanbul BFT and Raft-based Consensus is not supported for now and is in the roadmap. Quorum being a permission network, it also supports private transaction which is the main benefit.

SAP offering for Quorum comes with 4 types:

  • Developer Story – Sandbox for development & testing (private data not possible) which is enabled on Trial Accounts
  • Test Network – helps to provision your own node to become part of the predefined network together with other participants and explore business process between companies and node interaction (private data possible)
  • Large Plan – you may provision a full node to create your own network or connect to any other node or network with high throughput
  • Connect Your Own Network (CYON) – helps to run blockchain technology on an infrastructure of your choice and connect business processes via SAP Cloud Platform

I am sure there will be many more questions on Quorum, I have added few Reference links at the bottom to support the queries.

With this being said and talking about Quorum on a high level, I would like to get started on the Step by Step guide, to begin with, Quorum on your Trail Account.

Pre-Requisites to start with Quorum:

Login to your SAP Cloud Platform Trial Account using the link:

https://account.hanatrial.ondemand.com/

Click on Log On and enter your login details. In case you are a new user, please register yourself.

Enter your login details and click on Log on. You should be able to see two Services, click on Cloud Foundry Trail.

Click on the trial account which is displayed.

Click on Spaces from the list of services on the left and click on Dev.

Click on Spaces from the list of services on the left and click on Dev.

Now click on Services and then click on Service Marketplace and search for Blockchain/Quorum and click on it

You should now be able to see the Description, Service Plan and Instances. Feel free to refer to Documentation of Quorum as required. To continue with the blog, click on Instances

Click on New Instance

 

Select Dev and click on Next

 Click on Next for “Specify Parameters” and “Assign Application”. Enter your Instance Name and click on Finish

 

 

Your Quorum Dev node is created.

 

 

 

Click on Open Dashboard and you should be able to see the following details:

  • Node Information
  • Network Configurations
  • Logs
  • RPC Endpoint – HTTPs URL is used for a connection from the client. I am going to demonstrate it during the next steps

 

Now, let us create a Service Key. Click on the + to create a New Key, enter the Name and Password and click ok Create. Ensure you make a note of the Service Key Password, we need it further.

 

Once the Service Key is created, click on the Display icon.

 

 

You should now be able to see the following details:

  • Address – Used to recognize the node details
  • NetworkID
  • RPC Endpoint – Explained above, the value will remain same

 

Close the Window.

Now open a new tab and go to http://remix.ethereum.org

Remix offers a default Smart Contract with an example of Ballot/Voting use case. During the deployment of the use case, we can provide the number of users who are participating in the election and vote as required. The sample code is written in such a way that only one vote is possible for one user.  (There are ways to delegate and giveRightToVote as a part of the sample code, which is not covered in this blog).

Tip. A remix is a Solidity IDE to create, test, debug and deploy Ethereum Smart Contracts.

 

Ignore any errors, and open the file ballot.sol, here .sol stands for Solidity. Click on Compile and select the version as 0.5.1+Commit.c8a2cb62. Here I am selecting the stable version which is committed to Git.

 

Once you select the compiler version, it should automatically compile and show error and warnings as shown below.

 

Please ignore warnings if any and click on Run. Select ‘Web3 Provider’ and click on Ok in the popup window with the message – ‘Are you sure you want to connect to an ethereum node?’ and enter the RPC End Point value from Quorum Dashboard.

Tip. If CORS is not installed, the Connection fails with an error message.

Click on Account and select your Address which we made a note of from the Service Key creations. In my case its 0xbaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0

 

Now as explained above, I would like to select the number of participants in the Voting mechanism and I will try to deploy. It shows up an error as the account is still not authenticated for any deployments. This is the general procedure followed by Quorum and Ethereum. Enter any number in the Deploy option and click on Deploy and notice the error.

 

To ensure we authenticate and allow Smart Contract Deployments, open Go Ethereum client and follow the command.

Tip. Do not copy paste, always type in the terminal window.

geth attach https://tzcor-1.qaas-prod-us.quorum.icn.engineering/90xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxM=

 

Once it is connected, let us now unlock the account. Enter the following code and enter your password which was used to create the Service Key.

personal.unlockAccount(‘0xbaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0’)

 

Now go back to remix and now try to deploy. You will now be able to see the Smart Contract is deployed Successfully. Click on the arrow next to Debug to see the full details.

 

We can query the same Transaction Hash to check the Quorum via Go Ethereum command line.

Using the following command.

eth.getTransaction(‘0x3353abecd6b9e6c0dd290af15c326d0f1c5c7d8fd834b401a747c738fd2b4d78′)

and you should be able to see the complete details of the transaction with block number on which the Smart Contract is deployed which are input stored with the hash value.

 

Now, if you observe we have a new option on the Remix tool to perform operations. Expand the option to cast your vote and observe that the transaction for Vote gets executed. Expand the arrow to see the transaction details.

 

Congratulations…!!! This completes our hands-on with Quorum.

Optional Exercise:

  1. GetVoteCount

Above ballot example only allows to vote, but to read the date we have to modify the Smart Contract and then deploy it again. Add the following small code and compile to look for errors as shown below:

Code:

function getVoteCount(uint8 prop) public view returns(uint) {

        return proposals[prop].voteCount;

    } 

 

Click on Run tab in the Remix and delete the old deployment contract.

 

Now enter the number of participants required for the Poll and click on Deploy. Now you will be able to see a new option to getVoteCount in the Deployed Contracts.

 

Since there are 5 participants in the elections, I can enter 1 and Vote, then enter 1 in getVote and see the counts.

  1. Understanding Quorum Dashboard

Quorum Dashboard gives other options to understand the network traffic and logs. You can click on each of them and explore more.

Network Configurations:

Here we can understand that it’s a part of 5 nodes which is a part of the network and we can also see the Genesis block JSON created during the installation/deployment by the SAP Cloud Account.

 

Logs:

Helps you understand the transactions happening on the network.

 

Ethereum Dashboard:

Navigate to Ethereum Dashboard and check the Username (admin) & copy the password and click on the Open Hyperlink.

 

You should be able to see the Ethereum Dashboard with the following details:

  • Best Block shows the block height of Quorum Deployed on SAP Cloud Platform
  • Avg Block Time which is 1.00s, which means that a Block is created every second
  • Transactions which indicates the number of transactions in the network
  • Node Details along with Peers, Mining, Pending Transactions, Difficulty etc.

 

This concludes the blog.

Cheers,

Nagesh

#happylearning #blockchain

Useful Links:

Understanding Go Ethereum: https://github.com/ethereum/go-ethereum

Quorum: https://github.com/jpmorganchase/quorum

Quorum Examples: https://github.com/jpmorganchase/quorum-examples

Blockchain Fork Explained: https://medium.com/digitalassetresearch/blockchain-forks-explained-8ccf304b97c8

 

5 Comments
You must be Logged on to comment or reply to a post.