What Dat?

Scraping the web for cheap transfer of database content to web pages, I got stuck on the number of products with the name WebDB, many essentially running something like SQLite backed by web local storage.... one of them drives Beaker Browser, a peer-to-peer web browser using DAT built upon Electron.  The rabbit hole along my search to find a corporate IT alternative surfaced into a hacker community.  So, what are DAT and peer-to-peer browsing?

Share.... FTP or BitTorrent ish

Dat is a peer-to-peer file-sharing protocol that builds a distributed directory to publically readable filesystems. There is a Node command-line implementation to share and clone directories and a NPM package for programatic access.  Dat is similar to BitTorrent, but it's lighter-weight, since Dat clients can choose to download and share portions of filesystems.  The requirements are so minimal that Dat can even run from my Chromebook after a minor configuration twiddle and installation of python2, gcc, et al.... via pkg from Termux.

The Dat Project has a tutorial to install Dat and install files.  The TLDR; is

  • use npm to install dat (repeatedly until you satisfy all the gyp requirements),

  • run dat create to share a directory,

  • populate the directory with your stuff,

  • and run dat clone to access the directory elsewhere.

If you want your files to persist beyond your terminal session, HashBase will host your data, the first 100MB is free.  There's a Dat podcast, DAT;Cast, with Dat enthusiasm and events from January 2018 onward.

Interface.... _Browser_

Dat ships with a web server, just run "dat sync --http".  More generally, running dat-gateway will bridge content to your browswer, but now we're back to server land.  Beaker Browser merges a Dat node with a web-browser.

What makes this a happy marriage? Along with providing basic editing tools, Beaker provides Dat to its rendered web applications.  Without Beaker, a web app's I/O is limited to HTTP or Websockets, which require a third-party adaptor (e.g. dat-gateway).  I've failed at using a couple of Websocket-based approaches, much of the browser support is out of date, so I'd advise starting with Beaker or dat-node.

Sadly, Beaker won't run on most Chromebooks anytime soon.  Beaker is built on Electron, which runs poorly on Google's high-end PixelBook (only in development mode?), but not on lesser Chromebooks, and the Electron team turns away requests to accommodate Chrome OS.  So this next step requires a lap or desktop computer.....

How Dat.... A Sample P2P App

Here's a simple peer-to-peer application to support consensus: Cahoots!  The basic idea is that each voting-bloc member controls and publishes her own ballot containing her opinion, notes, and optionally references to other bloc members she has invited.  Each bloc member can traverse the web of references starting from a master or config ballot to listen for ballot updates and count the common opinions.

{ "displayName":
  "issueName":
  "participants": [
    
  ],
  "proposal":
  "notes": [
    [ 1531859696122, "I don't like cold soup"]
  ]
}

Entrance to the election is controlled through the write permission fo the config ballot.  Other ballots can contain additional invites, but we (each member, even) can choose to limit the entrance by the distance from the config.

 Cahoots in action.

Cahoots in action.