[Proposal] P2P Web

Problem

It is currently no way to make a P2P web application to work without first downloading JavaScript from a web server.

Use Case

Any kind of decentralized web applications.

Requirements

  • Must be able to work without a HTTP(S) web server.
  • Overlay network should be implementation agnostic (eg. DHT implemented in JavaScript).

Implementation Idea

Workflow:

  1. User open p2p://app.example.com/ with web browser.
  2. Web browser lookup DNS records for app.example.com.
  3. Web browser then process DNS TXT records.
  4. If web-p2p: true is found then load JavaScript code (bootstrapping code, should be as short as possible): web-p2p-1: console.log('this is JS part 1');' web-p2p-2: console.log('this is JS part 2');' web-p2p-3: console.log('this is JS part 3');' ... web-p2p-14: console.log('this is JS part 14');'
  5. JavaScript is then concatenated and executed to perform logic to join P2P overlay network.
  6. Additional assets may be loaded from joined P2P overlay network.
  7. P2P web application is loaded and ready to use.

Caveats:

  • Domain name and DNS dependent.
  • JavaScript code have to split into many parts to workaround TXT record length limitation (255).
  • Due to absense of SSL/TLS, security have to be managed by the application.