SDK
Currently, only the Ethereum Holesky testnet and AO are supported, with plans to gradually expand support to the Ethereum mainnet and other networks in the future.
Overview
The bavo-network-sdk allows developers to utilize BAVO Network, providing trustless and confidential computing capabilities. For more information, visit the Introduction.
Quick Start
Demos
Usage
Installation
Install the package using npm:
bashCopy codenpm install --save @bavolabs/bavo-network-sdkImport WASM
Add lhe.js to your HTML file to automatically load the WASM:
htmlCopy code<script type="text/javascript" src="https://bavo-online.s3.ap-northeast-1.amazonaws.com/resources/v2/lhe.js"></script>If you encounter this browser console error:
vbnetCopy code_stream_writable.js:57 Uncaught ReferenceError: process is not defined
at node_modules/readable-stream/lib/_stream_writable.js (_stream_writable.js:57:18)Refer to the project documentation using vite.
Getting Started
Utils
Generate Key Generate public-private key pairs to submit tasks and retrieve task results:
BavoNetworkContractClient
Import Client
Instantiate Client
The constructor for BavoNetworkContractClient:
chainName: The blockchain to connect to.
wallet: The wallet used for blockchain interactions.
storageType: Optional. Defaults to
ARSEEDING.
By default, storageType is set to ARWEAVE for ao and ARSEEDING for holesky or ethereum.
If using ARSEEDING, deposit ETH to EverPay to cover storage and computation costs.
Example
Upload Data
Upload data to the storage chain:
Example
Submit Task
Submit a task to BAVO Network:
Example
Get Task Result
Retrieve the result of a task:
Example
Get Balance and Withdraw Tokens
Get Balance:
Withdraw Tokens:
Types and Enums
KeyInfo
ChainName
StorageType
TaskType
Solidity: IDataPermission
Developers can implement the IDataPermission contract to define custom permission-checking logic for data access:
You can find a whitelist example in WhiteListDataPermission.
Last updated