This project demonstrates the creation and management of a private token on a Quorum network.
Quorum privacy is used, only certain members of the network are privy to the token that has been created.
It is written in Java using web3j which is maintained by Web3 Labs.
A Quorum network running with at least 3 transaction nodes. Check next section for an example of a ready to use network.
You will need the following details for each node:
- Node URL,
http://<node-url>:<node-port>
- Transaction enclave address,
<base64 encoded public key>
As an example of a Quorum network that can be used with this sample project, we have the Quorum-dev-quickstart. This, will spin up a network of 3 members with their private transactions managers and will let you demo privacy groups and how they work.
You will need to update the TokenApplication class with details of the URL for each of your transaction nodes and their associated public keys.
// FIXME: Add node URL and transaction node keys here
Node nodeA = createAndUnlockAccount("nodeA", "http://<node-url>", "<transaction node key>");
Node nodeB = createAndUnlockAccount("nodeB", "http://<node-url>", "<transaction node key>");
Node nodeZ = createAndUnlockAccount("nodeZ", "http://<node-url>", "<transaction node key>");
Where your node url would be similar to https://<app>.<yourdomain>.com:3200/{}
and
the nodekey would be a base64 encoded public key such as
V4pb2lVRMwLZXGGmm/Ee3Y2U7BTlQ+BO8abrktMbSSQ=
.
Then to run the application, simply type:
./gradlew run
The application logs the different activities it completes, which are as follows:
- Create an Ethereum account on nodes A, B and Z.
- Deploy a Quorum Token (symbol QT) contract that is visible only to nodes A, and B but not Z.
- Transfer QT to accounts associated with nodes A, B, Z.
- Display all account balances.
- Demonstrate that node Z cannot see the QT assigned to its account.
- Decrease the supply of QT.
- Display all account balances.
There are also a couple of integration tests you can use to test the application.
The Web3 Labs blockchain explorer provides an easy to use UI for browsing transaction and contract details.
git clone https://github.com/blk-io/epirus-free.git
cd epirus-free
NODE_ENDPOINT=http://<node-url> docker-compose up
You may access the blockchain explorer via http://localhost.
You can then browse the smart contract that was created by obtaining the token contract address, which is logged as follows:
19:53:10.853 [main] INFO c.w.quorum.token.TokenApplication - Quorum Token (QT) created at contract address 0x<contract-address>, by account 0x<creation-account>
You can view the contract itself via the url http://localhost:5000/contract/0x<contract-address>
:
You can also view the private transactions:
And details of those transactions:
If you wish to learn more about our Epirus contract registry and blockchain explorer, including our production-ready SaaS offerings which include features such as authentication and BI integrations please contact us.