Skip to content

hcliff/sqlite-ipfs

Repository files navigation

sql.js-ipfs

Inspiration / Deps

Heavily inspired and uses code from https://github.com/phiresky/sql.js-httpvfs Impossible without sql.js

Usage

Basic

  1. npm install
  2. npm run dev
  3. Using https open your browser and navigate to the url given by webpack
  4. Check the console

With your own database

  1. Install IPFS
  2. Add your sqlite file ipfs add db.sqlite3
  3. Take the CID from the output and change ipfsPath in examples/index.ts
  4. npm run dev
  5. Check the console

FAQ

  • How does this work? Your browser runs a wasm binary that contains the sqlite server & client. It reads blocks of data from a .sqlite file on ipfs and performs queries in your browser.
  • Performance? Table scans are very bad. The cross-worker communcation of Atomics introduces heavy performance penalties too.
  • Writes? Certainly possible, but not implemented currently.
  • What was the hardest part of the project? Configuring webpack
  • Is this blockchain? 🚀🚀🚀 It's not, but it is technically a distributed ledger, be sure anyone you give money too can explain the difference.