> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quorum Tooling

> Set up GoQuorum client and development tools to interact with Quorum consortium network nodes on Chainstack. Consortium networks are now deprecated.

<Warning>
  ### Deprecated notice

  Consortium networks have been deprecated. This guide is for historical reference.
</Warning>

## Interaction tools

### GoQuorum

To interact with your Quorum network, you must install a GoQuorum client.

<Info>
  ### Go installation

  To be able to install GoQuorum, you must install Go first. See [Go: Getting Started](https://golang.org/doc/install).
</Info>

Having installed Go, [install GoQuorum](https://github.com/ConsenSys/quorum).

With GoQuorum installed, you can connect to the Quorum nodes with the `geth attach` command:

<CodeGroup>
  ```js GoQuorum theme={"system"}
  geth attach ENDPOINT
  ```
</CodeGroup>

where ENDPOINT — your node HTTPS endpoint

See [View node access details](/docs/manage-your-consortium-network#view-node-access-details).

Example:

<CodeGroup>
  ```Text Key-protected theme={"system"}
  geth attach https://nd-123-456-789.p2pify.com/3c6e0b8a9c15224a8228b9a98ca1531d
  ```

  ```Text Password-protected theme={"system"}
  geth attach https://user-name:[email protected]
  ```
</CodeGroup>

Invoke any methods from [Web3 JavaScript API](https://web3js.readthedocs.io/).

The example below demonstrates how to get the current block number:

<CodeGroup>
  ```js JavaScript theme={"system"}
  > web3.eth.blockNumber
  518973
  ```
</CodeGroup>

### JSON-RPC API

Interact with your Quorum network using:

<CardGroup>
  <Card title="Geth JSON-RPC" href="https://eth.wiki/json-rpc/API" icon="angle-right" iconType="solid" horizontal />

  <Card title="Quorum privacy API" href="https://docs.goquorum.consensys.net/reference/api-methods#privacy-methods" icon="angle-right" iconType="solid" horizontal />

  <Card title="Quorum permissions API" href="https://docs.goquorum.consensys.net/reference/api-methods#permission-methods" icon="angle-right" iconType="solid" horizontal />

  <Card title="Quorum contract extension API" href="https://docs.goquorum.consensys.net/reference/api-methods#contract-extension-methods" icon="angle-right" iconType="solid" horizontal />
</CardGroup>

Use [curl](https://curl.haxx.se) or [Postman](https://www.getpostman.com).

The example below demonstrates how to get basic network information:

<CodeGroup>
  ```Text Key-protected theme={"system"}
  $ curl -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":2}' \
    https://nd-123-456-789.p2pify.com/3c6e0b8a9c15224a8228b9a98ca1531d

  {"jsonrpc":"2.0","id":2,"result":"0x4"}
  ```

  ```Text Password-protected theme={"system"}
  $ curl -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":2}' \
    https://user-name:[email protected]

  {"jsonrpc":"2.0","id":2,"result":"0x4"}
  ```
</CodeGroup>

## Developments tools

### Truffle

Configure [Truffle Suite](https://truffleframework.com) to deploy contracts to your Quorum network.

1. Install [Truffle Suite](https://truffleframework.com) and create a project

   <Warning>
     ### Recommended version

     Use Truffle >= 5.0.14 which has complete Quorum support with privacy features.
   </Warning>

2. Install `HDWalletProvider`

   [HDWalletProvider](https://github.com/trufflesuite/truffle/tree/develop/packages/hdwallet-provider) is Truffle's separate npm package used to sign transactions.

   Run:

   <CodeGroup>
     ```sh sh theme={"system"}
     npm install @truffle/hdwallet-provider
     ```
   </CodeGroup>

3. Create a new environment in `truffle-config.js` with:

   * `HDWalletProvider`
   * Your Quorum network running with Chainstack

   <CodeGroup>
     ```js JavaScript theme={"system"}
     const HDWalletProvider = require("@truffle/hdwallet-provider");
     const mnemonic = "word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12 word13    word14 word15";

     module.exports = {
         chainstack: {
             provider: () => new HDWalletProvider(mnemonic, "ENDPOINT"),
             network_id: "*",
             gasPrice: 0,
             gas: 4500000,
             type: "quorum"
         }
        }
     };
     ```
   </CodeGroup>

   where

   * `chainstack` — any network name that you will pass to the `truffle migrate --network` command.
   * `HDWalletProvider` — Truffle's custom provider to sign transactions
   * `mnemonic` — your mnemonic that generates your accounts. You can also generate a mnemonic online with [Mnemonic Code Converter](https://iancoleman.io/bip39/). Make sure you generate a 15 word mnemonic.
   * ENDPOINT — your Quorum node HTTPS endpoint. See [View node access details](/docs/manage-your-consortium-network#view-node-access-details).
   * `network_id` — your Quorum network ID. See [Default network ID](./default-addresses-and-network-id). You can set it to `*` for any.
   * `gasPrice` — the setting must be `0` for the Quorum network.
   * `gas` — the setting must be the default `4500000` for the Quorum network.
   * `type` — the setting must be `quorum` to instruct Truffle for the Quorum network deployment.

   Example:

   <CodeGroup>
     ```Text Key-protected theme={"system"}
     const HDWalletProvider = require("@truffle/hdwallet-provider");
     const mnemonic = "word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12 word13    word14 word15";

     module.exports = {
       networks: {
         chainstack: {
             provider: () => new HDWalletProvider(mnemonic, "https://nd-123-456-789.p2pify.com/3c6e0b8a9c15224a8228b9a98ca1531d"),
             network_id: "*",
             gasPrice: 0,
             gas: 4500000,
             type: "quorum"
         }
        }
     };
     ```

     ```Text Password-protected theme={"system"}
     const HDWalletProvider = require("@truffle/hdwallet-provider");
     const mnemonic = "word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12 word13 word14 word15";

     module.exports = {
       networks: {
         chainstack: {
             provider: () => new HDWalletProvider(mnemonic, "https://user-name:[email protected]"),
             network_id: "*",
             gasPrice: 0,
             gas: 4500000,
             type: "quorum"
         }
        }
     };
     ```
   </CodeGroup>

4. Run `truffle migrate --network chainstack` and Truffle will deploy using Chainstack

### web3.js

Build DApps using [web3.js](https://github.com/ethereum/web3.js/) and Quorum nodes deployed with Chainstack.

1. Install [web3.js](https://web3js.readthedocs.io/).

2. Use the `HttpProvider` object to connect to your node HTTPS endpoint.

   <CodeGroup>
     ```js JavaScript theme={"system"}
     const Web3 = require('web3');

     const web3 = new Web3(new Web3.providers.HttpProvider('ENDPOINT'));
     ```
   </CodeGroup>

   where

   * ENDPOINT — your node HTTPS endpoint
   * USERNAME — your Quorum node access username
   * PASSWORD — your Quorum node access password

   Example to get the latest block number:

   <CodeGroup>
     ```Text Key-protected theme={"system"}
     const Web3 = require('web3');

     const web3 = new Web3(new Web3.providers.HttpProvider('https://nd-123-456-   789.p2pify.com/3c6e0b8a9c15224a8228b9a98ca1531d'));

     web3.eth.getBlockNumber().then(console.log);
     ```

     ```Text Password-protected theme={"system"}
     const Web3 = require('web3');

     const web3 = new Web3(new Web3.providers.HttpProvider('https://user-name:[email protected]'));

     web3.eth.getBlockNumber().then(console.log);
     ```
   </CodeGroup>

### web3j

Build DApps using [web3j](https://github.com/web3j/web3j) and Quorum nodes deployed with Chainstack.

Use the `HttpService` object to connect to your node HTTPS endpoint.

Example to get the latest block number:

<CodeGroup>
  ```java java theme={"system"}
  package getLatestBlock;

  import java.io.IOException;
  import java.util.logging.Level;
  import java.util.logging.Logger;

  import org.web3j.protocol.Web3j;
  import org.web3j.protocol.core.DefaultBlockParameterName;
  import org.web3j.protocol.core.methods.response.EthBlock;
  import org.web3j.protocol.exceptions.ClientConnectionException;
  import org.web3j.protocol.http.HttpService;

  import okhttp3.Authenticator;
  import okhttp3.Credentials;
  import okhttp3.OkHttpClient;
  import okhttp3.Request;
  import okhttp3.Response;
  import okhttp3.Route;

  public final class App {

    private static final String USERNAME = "USERNAME";
    private static final String PASSWORD = "PASSWORD";
    private static final String ENDPOINT = "ENDPOINT";

    public static void main(String[] args) {
      try {

        OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
        clientBuilder.authenticator(new Authenticator() {
            @Override public Request authenticate(Route route, Response response) throws IOException {
                String credential = Credentials.basic(USERNAME, PASSWORD);
                return response.request().newBuilder().header("Authorization", credential).build();
            }
        });

        HttpService service = new HttpService(ENDPOINT, clientBuilder.build(), false);
        Web3j web3 = Web3j.build(service);

        EthBlock.Block latestBlock = web3.ethGetBlockByNumber(DefaultBlockParameterName.LATEST, false).send().getBlock();

        System.out.println("Latest Block: #" + latestBlock.getNumber());

      } catch (IOException | ClientConnectionException ex) {

        Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
      }
    }

  }
  ```
</CodeGroup>

where

* ENDPOINT — your node HTTPS endpoint
* USERNAME — your node access username
* PASSWORD — your node access password

See also [the full code on GitHub](https://github.com/chainstack/web3j-getLatestBlock).
