New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

zkdb

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zkdb

zkDatabase for the future of Web3

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
13
-82.43%
Maintainers
1
Weekly downloads
 
Created
Source

Introduction

Data plays a critical role in any computational process, including the emerging Web3 era. In order to successfully transition to Web3, it is imperative to enhance accessibility and accuracy of data. The zkDatabase use a distributed storage engine that improves the availability of data. It utilizes Zero-Knowledge Proof to ensuring the correctness of data in verifiable manner. With zkDatabase, it's allow developers to focus on developing their ideas, rather than managing the complexities of data storage and management.

It's time for verifiable data.

Installation

npm install zkdb

Connect to zkDatabase

import { ZkDatabase } from 'zkdb';

const zkdb = new ZkDatabase({
  apiKey: 'your-api-key',
  url: 'https://serverless.zkdatabase.org/graphql',
});

Create a Database

const dbTest = zkdb.db('my_database');

if (!(await dbTest.exist()).unwrapOr(false)) {
  (await dbTest.create()).unwrap();
}

Define Schema and Create Collection

import { Schema, SchemaToObject } from '@zkdb/common';
import { Permission } from 'zkdb';

const BookSchema = new Schema([
  { name: 'name', kind: 'String' },
  { name: 'author', kind: 'String' },
  { name: 'release', kind: 'UInt32' },
]);

type TBook = SchemaToObject<ReturnType<typeof BookSchema.schemaDefinition>>;

const permissions = Permission.from({
  owner: { read: true, write: true, delete: true, system: true },
  group: { read: true, write: false, delete: false, system: false },
  other: { read: true, write: false, delete: false, system: false },
});

const collectionBook = dbTest.collection<TBook>('book');
await collectionBook.create(BookSchema, permissions, 'default');

Insert Documents

const docId = (
  await collectionBook.insert({
    name: '1984',
    author: 'George Orwell',
    release: 1949n,
  })
).unwrap();

Query Documents

// Find many
const books = (
  await collectionBook.findMany({ author: 'George Orwell' })
).unwrap();
books.data.forEach((b) => console.log(b.document.name));

// Find one
const book = (await collectionBook.findOne({ name: '1984' })).unwrap();

Update Documents

const docs = (await collectionBook.findMany({ name: '1984' })).unwrap();
if (docs.data.length > 0) {
  await docs.data[0].update({ release: 1950n });
}

Delete Documents

const docs = (await collectionBook.findMany({ name: '1984' })).unwrap();
if (docs.data.length > 0) {
  await docs.data[0].drop();
}

Verify ZK Proofs

const verifyResult = await dbTest.zkProofVerify();
console.log('Proof valid:', verifyResult.unwrap());

// Check zk proof state
const zkProofState = await dbTest.zkProofState();
console.log('Zk proof state:', zkProofState.unwrap());

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

built with ❤️

Keywords

zk

FAQs

Package last updated on 03 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts