GithubHelp home page GithubHelp logo

hypercore-playground's Introduction

hypercore-playground

Build Status js-standard-style

Simple playground on the hyper stack

Motivation

I always found fascinating the tech behind some p2p technology. Lastly I've saw some pretty interesting things about beaker browser, this talk and, more deeply this post. However, this intersting distributed world seemed just to complicated to me, and even though the teams behind the tech I was watching (The hyper stack and Dat project before that) have done an amazing job on their documentation, I still haven't find any beginner friendly introduction.

So I decided to try already those libraries, by making some simple chat like examples, and share what I found, this isn't the beginner guide I was looking for, because I can't even assure I would come to something useful, but it's going to be at least something fun.

File structure

I have organized this repo in folders grouped by the main module that I'm testing in it, the organization is clear but very opinionated.

Discovers

A high-level API for finding and connecting to peers who are interested in a "topic."

  • minimal: Here is what I have as a minimal hyperswarm implementation. It could be even more minimal by using nodes native crypto module instead of sodium. This one was surprisingly easy, but has some drawbacks. When a peer process is killed it kills all other peers, this seems to be because I'm connecting directly to the process stdio streams.
  • fancy: This one was a mess. I just tried to make it look like a chat by changing the log, but it seems to be quite difficult to change process.stdout as many sites suggest. So this is broken.
  • universal-chat: This is basically RangerMauve/hyperswarm-universal-chat. I've just added some code for deduplication.

Hypercore is a secure, distributed append-only log.

  • minimal: I actually started trying with the chat folder, but had no result. So tried a bit simpler approach but have issues also. After a lot of old school debuggin (console.log every where) I found out that my error was because of this code pattern
feed = hypercore(ram, argv.key)
// ...
feed.append(data, (err, seq) => {
  if (err) {
    console.error(err)
    process.exit(1)
  }
})

that's because you can´t write data to a feed that you didn't create, you can see that from hypercore tests (the are very illustrative)

License

MIT

hypercore-playground's People

Contributors

yerkopalma avatar

Stargazers

Roman avatar Gavin Ray avatar Andrew Chou avatar monz avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.