Skip to content
You are reading Hyperledger Besu development version documentation and some displayed features may not be available in the stable release. You can switch to stable version using the version box at screen bottom.
Last update: September 7, 2021

web3js-quorum client library

The web3js-quorum library adds a property to your web3 instance by extending web3. Use the library to create and send RLP-encoded transactions using JSON-RPC.


web3js-quorum supports JSON-RPC over HTTP only.


web3js-quorum includes all quorum.js and web3js-eea features.

If migrating to web3js-quorum, then update your Javascript code as indicated in the following examples.

Read the migration guide for more information about updating your code.


Add web3js-quorum to project

npm install web3js-quorum

Initialize the web3js-quorum client

Initialize your client where:

  • <JSON-RPC HTTP endpoint> is the JSON-RPC HTTP endpoint of your Hyperledger Besu node. Specified by the --rpc-http-host and --rpc-http-port command line options.


const Web3 = require("web3");
const Web3Quorum = require("web3js-quorum");
const web3 = new Web3Quorum(new Web3("<JSON-RPC HTTP endpoint>"));
const Web3 = require("web3");
const Web3Quorum = require("web3js-quorum");
const web3 = new Web3Quorum(new Web3("http://localhost:8545"));


When migrating from web3js-eea to web3js-quorum, use Web3Quorum. The constructor doesn’t require the chain ID anymore. Chain ID is automatically retrieved from the chain using the specified JSON-RPC HTTP endpoint.

Deploying a contract with generateAndSendRawTransaction

To deploy a private contract, you need the contract binary. You can use Solidity to get the contract binary.

Deploying a contract with web3.priv.generateAndSendRawTransaction

const contractOptions = {
  data: `0x123`, // contract binary
  privateFrom: "tesseraNode1PublicKey",
  privateFor: ["tesseraNode3PublicKey"],
  privateKey: "besuNode1PrivateKey"
return web3.priv.generateAndSendRawTransaction(contractOptions);

web3.priv.generateAndSendRawTransaction(contractOptions) returns the transaction hash. To get the private transaction receipt, use web3.priv.waitForTransactionReceipt(txHash).

web3js-quorum methods

For more information about the web3js-quorum methods, see the web3js-quorum reference documentation.

Questions or feedback? You can discuss issues and obtain free support on Hyperledger Besu chat channel.
For Hyperledger Besu community support, contact the mailing list