Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/web3labs/quorum-sample
Sample Token Project for Quorum
https://github.com/web3labs/quorum-sample
blockchain ethereum java java8 quorum web3j
Last synced: 3 months ago
JSON representation
Sample Token Project for Quorum
- Host: GitHub
- URL: https://github.com/web3labs/quorum-sample
- Owner: web3labs
- Created: 2019-03-15T12:04:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-10T09:32:14.000Z (over 3 years ago)
- Last Synced: 2024-05-18T18:00:12.035Z (6 months ago)
- Topics: blockchain, ethereum, java, java8, quorum, web3j
- Language: Java
- Homepage: https://www.web3labs.com
- Size: 522 KB
- Stars: 12
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-quorum - web3j token sample - Demonstrates the creation and management of a private (Educational Resources / Built on Quorum)
README
# Quorum Token Java Sample
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](https://web3j.io) which is maintained by
[Web3 Labs](https://www.web3labs.com).## Prerequisites
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://:`
- Transaction enclave address, ``## Quorum-dev-quickstart
As an example of a Quorum network that can be used with this sample project, we have the [Quorum-dev-quickstart](https://docs.goquorum.consensys.net/en/stable/Tutorials/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.## Running the application
You will need to update the
[TokenApplication](src/main/java/com/web3labs/quorum/token/TokenApplication.java#L33)
class with details of the URL for each of your transaction nodes and their associated public keys.```java
// FIXME: Add node URL and transaction node keys here
Node nodeA = createAndUnlockAccount("nodeA", "http://", "");
Node nodeB = createAndUnlockAccount("nodeB", "http://", "");
Node nodeZ = createAndUnlockAccount("nodeZ", "http://", "");
```Where your node url would be similar to `https://..com:3200/{}` and
the nodekey would be a base64 encoded public key such as
`V4pb2lVRMwLZXGGmm/Ee3Y2U7BTlQ+BO8abrktMbSSQ=`.Then to run the application, simply type:
```bash
./gradlew run
```The application logs the different activities it completes, which are as follows:
1. Create an Ethereum account on nodes A, B and Z.
1. Deploy a Quorum Token (symbol QT) contract that is visible only to nodes A, and B but not Z.
1. Transfer QT to accounts associated with nodes A, B, Z.
1. Display all account balances.
1. Demonstrate that node Z cannot see the QT assigned to its account.
1. Decrease the supply of QT.
1. Display all account balances.There are also a couple of
[integration tests](src/test/java/com/web3labs/quorum/token/TokenApplicationIT.java)
you can use to test the application.## Viewing contracts and transactions
The Web3 Labs blockchain explorer provides an easy to use UI for browsing transaction
and contract details.```bash
git clone https://github.com/blk-io/epirus-free.git
cd epirus-free
NODE_ENDPOINT=http:// docker-compose up
```You may access the blockchain explorer via http://localhost.
![Latest blocks](images/blocks.png)
You can then browse the smart contract that was created by obtaining the token contract address,
which is logged as follows:```bash
19:53:10.853 [main] INFO c.w.quorum.token.TokenApplication - Quorum Token (QT) created at contract address 0x, by account 0x
```You can view the contract itself via the url `http://localhost:5000/contract/0x`:
![Contract](images/contract.png)
You can also view the private transactions:
![Private transactions](images/transactions.png)
And details of those transactions:
![Transaction details](images/transaction.png)
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](mailto:[email protected]).