Skip to main content

Installation

This guide will walk you through the process of installing the BeL2 SDK in your project.

Prerequisites

Before installing the BeL2 SDK, make sure you have the following prerequisites:

  • Node.js (version 12 or higher)
  • npm (usually comes with Node.js) or yarn

Installation Steps

  1. Open your terminal or command prompt.

  2. Navigate to your project directory:

    cd path/to/your/project
  3. Install the BeL2 SDK using npm:

    npm install @bel2labs/sdk

    Or, if you're using yarn:

    yarn add @bel2labs/sdk
  4. The installation process will download the BeL2 SDK and its dependencies.

Verifying the Installation

To verify that the BeL2 SDK has been installed correctly, you can create a simple test file:

  1. Create a new file named test-bel2-sdk.js in your project directory.

  2. Add the following content to the file:

    const { ZKP } = require('@bel2labs/sdk');

    console.log('BeL2 SDK successfully imported');
  3. Run the test file:

    node test-bel2-sdk.js

    If the installation was successful, you should see the message "BeL2 SDK successfully imported" printed in the console.

Next Steps

Now that you have successfully installed the BeL2 SDK, you can proceed to configure the SDK for your specific use case and start integrating ZKP functionality into your application.

Here's a quick example of how to use the SDK with Ethers.js v6:

import { ZKP } from "@bel2labs/sdk";
import { ethers } from 'ethers';

const verification = await ZKP.EthersV6.TransactionVerification.create(txId, 20);
if (!verification.isSubmitted()) {
const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();

verification.status$.subscribe((status) => {
console.log("New status:", status);
});

const response = await verification.submitVerificationRequest(signer);
}

For more detailed information on how to use the SDK, please refer to the Configuration and Submit Verification sections.

If you encounter any issues during the installation process, please refer to the Troubleshooting section or reach out to our support team.