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
-
Open your terminal or command prompt.
-
Navigate to your project directory:
cd path/to/your/project
-
Install the BeL2 SDK using npm:
npm install @bel2labs/sdk
Or, if you're using yarn:
yarn add @bel2labs/sdk
-
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:
-
Create a new file named
test-bel2-sdk.js
in your project directory. -
Add the following content to the file:
const { ZKP } = require('@bel2labs/sdk');
console.log('BeL2 SDK successfully imported'); -
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.