GithubHelp home page GithubHelp logo

isabella232 / web3j-quorum Goto Github PK

View Code? Open in Web Editor NEW

This project forked from web3j/web3j-quorum

0.0 0.0 0.0 495 KB

web3j integration layer for JP Morgan's Quorum

Home Page: https://www.web3labs.com

License: Other

Java 77.98% Kotlin 20.99% Shell 1.04%

web3j-quorum's Introduction

web3j-quorum: Java integration library for Quorum

image

web3j-quorum is an extension to web3j providing support for JP Morgan's Quorum API.

web3j is a lightweight, reactive, type safe Java library for integrating with clients (nodes) on distributed ledger or blockchain networks.

For further information on web3j, please refer to the main project page and the documentation at Read the Docs.

Features

  • Support for Quorum's private transactions through private transaction manager
  • Ability to send signed private transactions
  • Works out the box with web3j's smart contract wrappers

Getting started

Add the relevant dependency to your project:

Maven

Java 8:

Gradle

Java 8:

compile ('org.web3j:quorum:4.8.4')

Run Quorum

See instructions as per the Quorum project page

Start sending requests

To send synchronous requests:

To send asynchronous requests:

To use an RxJava Observable:

IPC

web3j also supports fast inter-process communication (IPC) via file sockets to clients running on the same host as web3j. To connect simply use UnixIpcService or WindowsIpcService instead of HttpService when you create your service:

Smart Contract Wrappers

Smart contract wrappers generated using web3j 2.0+ work out the box with with web3j-quorum.

The only difference is that you'll need to use the Quorum ClientTransactionManager:

These wrappers are similar to the web3j smart contract wrappers with the exception that the transactions are signed by the Quorum nodes rather then by web3j. They also support the privateFor field on transactions.

See the web3j documentation for a detailed overview of smart contracts and web3j.

Sending Raw Private Transactions

web3j supports sending raw private transactions through a connection to Quorum Transaction Managers. Code examples

Connection to Tessera via HTTP

Connection to Tessera via IPC

Connection to Constellation via IPC

Using the QuorumTransactionManager with Smart Contract Wrappers

Using the QuorumTransactionManager alone

Using a single QuorumTransactionManager method signAndSend

Using multiple exposed QuorumTransactionManager methods (storeRawRequest, sign, sendRaw)

Retrieving a private transaction payload with Enclave receive method

Full sample code

Sample code for sending raw private transactions via smart contract, QuorumTransactionManager and Enclave

Using web3j RawTransactionManager

web3j-quorum's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.