Updated 2020-03-24

Using onchain privacy groups

Use the web3.js-eea library to create and update membership of onchain privacy groups.

Important

Onchain privacy groups are an early access feature in v1.4. Do not use in production networks.

The onchain privacy group interfaces may change between v1.4 and v1.5. There may not be an upgrade path from onchain privacy groups created using v1.4 to enable use of onchain privacy group functionality in future versions.

We do not recommend creating onchain privacy groups in a chain with existing offchain privacy groups.

Enabling onchain privacy groups

Use the --privacy-onchain-groups-enabled command line option to enable onchain privacy groups. When onchain privacy groups are enabled, the priv_createPrivacyGroup, priv_deletePrivacyGroup, and priv_findPrivacyGroup methods for offchain privacy groups are disabled.

Simple onchain privacy group example

To create and find an onchain privacy group using the web3.js-eea library:

  1. Update the example/keys.js file to match your network configuration.

  2. Run:

    node simpleOnChainPrivacy.js
    

    This script creates the onchain privacy group with two members. findPrivacyGroup finds and displays the created privacy group.

Tip

The Orion logs for Orion 1 and Orion 2 displays PrivacyGroupNotFound errors. This is expected behavior because private transactions check offchain and onchain to find the privacy group for a private transaction.

Adding and removing members

To add and remove members from an onchain privacy group, use the addToPrivacyGroup and removeFromPrivayGroup methods in the web3.js-eea library client library.

Note

When adding a member, Besu pushes all existing group transactions to the new member and processes them. If there are a large number of existing transactions, adding the member might take some time.