Skip to content

firstbatchxyz/hollowdb-lit-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

How to use HollowDB with Lit Protocol

This is an example project using Lit Protocol and HollowDB together to create a two-sided encryption flow.

Using Lit Protocol, any data can be encrpyted and can only be decrypted if certain access control conditions are met. See the lit protocol docs for more information.

On the otherside, HollowDB allows you to store your data permamently and privately. Unlike Lit Protocol, HollowDB hides your address information and lets you update the data only by providing ZK-proofs. Read more about HollowDB here.

Combining HollowDB with Lit Protocol gives you a two-sided encryption where both your identity and data is safe and encrypted.

Prerequisite

We will use hollowdb-client package for interact with the database/contract.

yarn add hollowdb-client

For the basics please look at this usage:

import { HollowClient } from "hollowdb-client";

async function main() {
  const client = await HollowClient.new({
    apiKey: "YOUR_API_KEY",
    db: "Database-1",
  });

  await client.put(key, payload)
  await client.update(key, newPayload, proof);
  const result = await client.get(key);
}

main();

Please sign in from here to HollowDB dashboard to get your Api_Key, Database_Name, ContractTxId that you will use in demo.

ContractTxId: change in path lit/pages/api/hollowdb.js with the key found in here
DatabaseName: change in path server/src/client/client.ts with the key found in here
ApiKeys:change in path server/src/client/client.ts with the key found in here

Also 2 different node version needed to run this demo (Lit protocol uses v16, on the server side you can use v18). To do that first install nvm according to instructions in here and then you open 2 different terminal windows (after running the yarn install for both server/ and lit/ folders). Now you should be able to use 2 different node version via running nvm use <node_version> in two different terminal windows.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published