An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          


logo



HollowDB Client



HollowDB client is the simplest way to use HollowDB, a decentralized & privacy-preserving key-value database.



License: MIT


NPM


License: MIT


Workflow: Tests


GitHub: HollowDB


Discord

## 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.