Skip to content
Azure Token Service on Quorum feature image
Conor Svensson

Published On - October 24, 2017

Azure ERC-20 Token Service on Quorum

We recently made available our first blockchain solution on the Azure Marketplace.

This sample environment provides RESTful services for creating and managing ERC-20 tokens on top of Quorum.

It provides a 3-node Quorum environment and RESTful service endpoints for interacting with each of those nodes over HTTP. These services are provided via the erc20-rest-service which uses web3j and Spring Boot.

Full transaction privacy is supported thanks to Quorum.

ERC-20 API
Create the machine image as per a usual Azure VM image, We recommend you use a DS1 v2 or better host, due to the memory requirements of running a Quorum cluster on a single VM. 
 
You should use ubuntu as username, then deploy the host as per a normal Azure VM. 
 
Once available on Azure, logon to the host, and start the application with the following commands:
cd erc20-quorum-vm-example
./init.sh
This will start a 3-node Quorum cluster using RAFT consensus, and 3 instances of our ERC-20 RESTful service.
The ERC-20 token standard is an Ethereum standard for implementing smart contracts that provide tokens on the Ethereum network. It provides a common set of methods that these contracts should implement. 
 
Each of these services are available at the following URLs:
At each URL there should be a Swagger UI that looks like the below.
Deploying our ERC-20 contract
You’re now ready to experiment with the service itself
 
We’re going to start by creating our own token named QToken. From the Swagger UI select the POST /deploy operation (you can use the URL http://<hostname>:8080/swagger-ui.html#!/controller/deployUsingPOST alternatively).  
Deploying our ERC-20 contract
Provide the following parameter values

contractSpecification:

{
"initialAmount": 1000000,

"tokenName": "QToken",

"decimalUnits": 0,

"tokenSymbol": "Q$"

}

privateFor:

1iTZde/ndBHvzhcl7V68x44Vx7pl8nwx9LqnM/AfJUg=

Then click the Try it out! button.

You should see a response like the below:

 
Deploying our ERC-20 contract
Congratulations you’ve just deployed a smart contract to a Quorum network! It uses Quorum’s transaction privacy to ensure that the transaction is only visible between two parties on the three party network. 
 
The address of the smart contract on the network is the response body:
In this case its:
0x938781b9796aea6376e40ca158f67fa89d5d8a18
Let’s now prove that the contract is only available to a subset of parties on the network.We can do this by calling any method on the smart contract. If we’re allowed to view the smart contract we’ll get a result back, otherwise we won’t. 
 
We’re going to call the symbol method on the contract from each of our nodes.
We start with our first node:
 
Enter the contract address we have been provided with (0x938781b9796aea6376e40ca158f67fa89d5d8a18)
Click Try it out! 
 
You should see the symbol name Q$ in the response body showing that our first node can access the contract.
 
Demonstrating Quorum’s transaction privacy
Now try doing the same on our second node:
This time around you’ll get a different response, as the second node was not privy to the transaction.
 
Demonstrating Quorum’s transaction privacy

Hence the request fails returning a HTTP 500 response:

{
"timestamp": 1505302053178,

"status": 500,

"error": "Internal Server Error",

"exception": "java.lang.RuntimeException",

"message": "Empty value returned by call",

"path""/0x938781b9796aea6376e40ca158f67fa89d5d8a18/symbol"

}
 
Finally we try with the third node which is successful, as this node was privy to the transaction.
 
Demonstrating Quorum’s transaction privacy
This demonstrates the transaction privacy of Quorum. 
 
Alternatively you can perform these actions without taking advantage of the transaction privacy of Quorum, leaving the privateFor field blank. Then the demo runs much like it would on a normal Ethereum network, but with Quorum’s fast RAFT consensus mechanism. 
 
There are a number of other methods you can call as per the ERC20 token standard. We encourage you to have a play. 
 
Please feel free to contact us if you have any questions or want to chat. 
Azure, Web3j, Erc20, Company News