https://github.com/firstbatchxyz/hollowdb-client
Simplest way to use HollowDB.
https://github.com/firstbatchxyz/hollowdb-client
Last synced: over 1 year ago
JSON representation
Simplest way to use HollowDB.
- Host: GitHub
- URL: https://github.com/firstbatchxyz/hollowdb-client
- Owner: firstbatchxyz
- License: mit
- Created: 2023-07-05T17:40:07.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-06T10:57:03.000Z (over 2 years ago)
- Last Synced: 2025-02-17T00:06:52.331Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://hollowdb.xyz
- Size: 7.11 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
HollowDB Client
HollowDB client is the simplest way to use HollowDB, a decentralized & privacy-preserving key-value database.
## Installation
HollowDB client is an NPM package. You can install it as:
```sh
yarn add hollowdb-client # yarn
npm install hollowdb-client # npm
pnpm add hollowdb-client # pnpm
```
## Usage
Create a new API key and a database at . Create a new client by providing your API key and the database name to connect:
```ts
client = await HollowClient.new({
apiKey: 'your-api-key',
db: 'your-database-name',
});
```
After that, using the client is as simple as it gets:
```ts
// without zero-knowledge proofs
await client.get(KEY);
await client.put(KEY, VALUE);
await client.update(KEY, VALUE);
await client.remove(KEY);
```
If you are connecting to a database that has zero-knowledge proof verifications enabled, you will need to provide proofs along with your update & remove requests.
You can use our [HollowDB Prover](https://github.com/firstbatchxyz/hollowdb) utility to generate proofs with minimal development effort. Assuming that a proof is generated for the respective request, the proof shall be provided as an additional argument to these functions.
```ts
// with zero-knowledge proofs
await client.get(KEY);
await client.put(KEY, VALUE);
await client.update(KEY, VALUE, PROOF);
await client.remove(KEY, PROOF);
```
## Testing
To run tests:
```sh
yarn test
```
The API calls are mocked during the test, so you can run it offline.