About Demo
Overview
Here, we will introduce the steps for using the BAVO NETWORK SDK with examples.
Preparations
Node.js >= 18
MetaMask (if the chain is
ethereum
orholesky
)Ensure you have enough
ETH
in your wallet for gas and computation fees.everypay
Ensure you have enough
ETH
in EverPay to cover storage fees. You can refer to the SDK Documentation for more information.
ArConnect (if the chain is
ao
)Ensure you have enough
wAR
in your wallet.
How to run demo
clone the repo
install packages
run demo
The demo will be served at http://localhost:5173.
Usage
Installation
Init Client
chain is ao
Make sure that you have installed the Arconnect in chrome and that you have enough AR
chain is ethereum
or holesky
Make sure you have installed MetaMask
in Chrome and have enough ETH
to cover computation and gas fees, as well as enough ETH
in EverPay
to pay for storage.
Data Provider
Upload Data
prepare data
tag for the data
price for the data
if chainName is holesky
or ethereum
if chainName is ao
dataPermissions
encryption schema
upload data
If everything is fine and there are no exceptions, you will get the dataId
, and you can query the data you uploaded based on that ID.
Retrieve the withdrawable balance and proceed with the withdrawal.
When data is purchased, the data provider is able to receive a token reward, you can check the withdrawable balance and withdraw it in the following ways.
Note:
Currently,
getBalance
andwithdrawToken
are only supported on the Holesky and Ethereum chains is supported, and only ETH is supported.
Get balance
Data User
Generate key pair
You should generates a pair of public and secret keys for encryption and decryption.
Submit task
Here, you need a dataId, which is returned by the Data Provider through the uploadData
.
This will return a task id which used for getting the result.
Get task result
If nothing goes wrong, you will get the data
of the Data Provider. The data type returned is Uint8Array, you can do further processing.
Last updated