Skip to main content

Client libraries

GoQuorum supports common smart contract and dapp development, deployment, and operational use cases, using tools such as Hardhat, web3.js and web3js-quorum. The client supports common JSON-RPC API methods, for example eth, net, web3, debug, and miner.



You can use the Quorum Developer Quickstart to deploy either public contracts or private contracts. To enable privacy, enter Y at the prompt for private transactions.


The web3.js library is the most widely used for developing applications.

Install web3 in your project

npm install web3

Initialize the web3 client

Initialize your client where:

  • <GoQuorum JSON-RPC HTTP endpoint> is the JSON-RPC HTTP endpoint of your GoQuorum node.
Example connection
const Web3 = require("web3");
const web3 = new Web3("http://some.local.remote.endpoint:8545");

WS example

Example connection
const Web3 = require("web3");
const web3 = new Web3("http://some.local.remote.endpoint:8546");

Deploying a contract

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

data: '0x12345...',
arguments: [123, 'My String']
from: '0x1234567890123456789012345678901234567891',
gas: 1500000,
gasPrice: '30000000000000'
}, function(error, transactionHash){ ... })
.on('error', function(error){ ... })
.on('transactionHash', function(transactionHash){ ... })
.on('receipt', function(receipt){
console.log(receipt.contractAddress) // contains the new contract address
.on('confirmation', function(confirmationNumber, receipt){ ... })
console.log(newContractInstance.options.address) // instance with the new contract address

Alternatively, you can also deploy a contract using eth.sendSignedTransaction

const rawTxOptions = {
nonce: "0x00",
from: account.address,
to: null, //public tx
value: "0x00",
data: "0x" + contractBin + contractConstructorInit,
gasPrice: "0x0", //ETH per unit of gas
gasLimit: "0x24A22", //max number of gas units the tx is allowed to use
console.log("Creating transaction...");
const tx = new Tx(rawTxOptions);
console.log("Signing transaction...");
tx.sign(Buffer.from(account.privateKey.substring(2), "hex"));
console.log("Sending transaction...");
var serializedTx = tx.serialize();
const pTx = await web3.eth.sendSignedTransaction(
"0x" + serializedTx.toString("hex").toString("hex"),
console.log("tx transactionHash: " + pTx.transactionHash);
console.log("tx contractAddress: " + pTx.contractAddress);
return pTx;

web3 methods

For more information about the web3 methods, see the web3 reference documentation.


The web3js-quorum library extends web3.js and adds supports for GoQuorum-specific JSON-RPC APIs and features.


The web3js-quorum library replaces the deprecated quorum.js and web3js-eea libraries, and includes all the features of both libraries.


web3js-quorum supports GoQuorum JSON-RPC over HTTP only.

Only the enclave connection can be configured over TLS.


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 your project

npm install web3js-quorum

Initialize the web3js-quorum client

Initialize your client where:

const Web3 = require("web3");
const Web3Quorum = require("web3js-quorum");
const fs = require("fs");

const isQuorum = true;
const keyFileBuffer = fs.readFileSync("<enclave key file path>");
const certFileBuffer = fs.readFileSync("<enclave TLS cert file path>");
const caCertFileBuffer = fs.readFileSync("<enclave TLS CA cert file path>");
const enclaveOptions = {
ipcPath: "<Enclave IPC Path>",
privateUrl: "<Enclave Private URL>",
tlsSettings: {
key: keyFileBuffer,
clcert: certFileBuffer,
cacert: caCertFileBuffer,
allowInsecure: true | false,

const web3 = new Web3Quorum(
new Web3("<GoQuorum JSON-RPC HTTP endpoint>"),

IPC and HTTP are mutually exclusive. Choose one or the other depending on your needs.

Deploying a contract with generateAndSendRawTransaction

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

const contractOptions = {
data: `0x123`, // contract binary
privateFrom: "tesseraNode1PublicKey",
privateFor: ["tesseraNode3PublicKey"],
privateKey: "goquorumNode1PrivateKey",
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.