Data Sharing
Overview
This guide introduces how to use the BAVO NETWORK SDK with examples to help you get started.
Preparations
Node.js: Version 18 or above
MetaMask: Required if using Ethereum or Holesky chains
Ensure you have enough ETH in your wallet to cover gas and computation fees.
EverPay: Ensure you have enough ETH in EverPay to cover storage fees (see SDK documentation for more details).
ArConnect: Required if using the AO chain
Ensure you have enough wAR (Wrapped AR) in your wallet.
How to Run the Demo
Clone the repository:
Install the packages:
Usage
Installation
Install the BAVO SDK via npm:
Initialize Client
For AO Chain:
Ensure ArConnect is installed in Chrome and that you have enough AR.
For Ethereum or Holesky Chains:
Ensure MetaMask is installed in Chrome and you have enough ETH for gas and computation fees, as well as ETH in EverPay for storage.
Data Provider
Upload Data
Prepare the data in Uint8Array format:
Tag the data (e.g., filename and suffix):
Set the price for the data:
For Holesky or Ethereum:
For AO (using wAR):
Define data permissions (optional):
Set the encryption schema (optional):
Upload the data:
If successful, you will receive a
dataId
to query your uploaded data.
Retrieve Balance and Withdraw Tokens
Data providers earn token rewards when their data is purchased. You can check and withdraw the balance as follows:
Get balance:
Withdraw tokens:
Data User
Generate Key Pair
You must generate a public-private key pair for encryption and decryption:
Submit Task
To submit a task, you need the dataId
provided by the Data Provider.
This will return a taskId
to use when retrieving the result.
Get Task Result
Retrieve the task result:
If successful, you will receive the data in Uint8Array
format for further processing.
Conclusion
Using the BAVO NETWORK SDK, developers can easily interact with the network to upload data, submit tasks, retrieve results, and manage balances.
Last updated