Skip to content

decentstack/hypercorder

Repository files navigation

Build Status JavaScript Style Guide standard-readme compliant

hypercorder

Version: alpha-0.0.1

Hypercorder is a datastructure with a cryptographic signing scheme capable of embedding entries from foreign feeds in a publicly verifiable way.

Simply put: Many to one feed encoder.

Introduction

Hypercorder extends hypercore and works exactly like a regular feed with the exception that it has 2 modes of replication.

  • feed.replicate(initiator, opts) replicates as usual, won't be mentioned here further.
  • feed.exchange(initiator, opts) creates a hyperplexed replication stream capable of accepting 'suggestions' on new content from other peers.

Suggestions come encoded as a Statement - each statment contains cryptographic proof of it's origin and integrity.

When participating in a "RecorderTopic" as a moderator, your goal is to collect valid statements.

You control which Statments are recorded by providing a filter function. For optimal performance, each peer should use identical filter functions - forming a topic-wide consensus. Deviations in consensus are perfectly acceptable but come at the cost of reduced network throughput.

When participating in a "RecorderTopic" as a voice, your goal is to publish your own statements and replicate data until either your statements are recorded or the main feed finalized.

In order for your statement to be recorded it has to reach a moderator and pass that individual's filter function.

Anyone with access to the "RecorderTopic" has uncensored access to content.

My hypothesis is that if each peer forwards only locally validated statements: A self-curating network should form - your voice should be heard as long as there is anyone willing to listen.

Install

 yarn add hypercorder
 # or
 npm i hypercorder

Usage

const Recorder = require('hypercorder')

// Define a statement validation function for the network
// a statement failing the validation test will not be relayed
const filter = stmt => {
  const message = stmt.data.toString('utf8')
  if (message.match(/bad content/)) {
    return false
  } else {
    return true
  }
}

// Initialize a new hypercorder
const mainFeed = new Recorder(storage, { filter })
await mainFeed.ready()

// TODO: show how to simultaneously join 2 topics and
// differentiate between the two.

Ad

 _____                      _   _           _
|  __ \   Help Wanted!     | | | |         | |
| |  | | ___  ___ ___ _ __ | |_| |     __ _| |__  ___   ___  ___
| |  | |/ _ \/ __/ _ \ '_ \| __| |    / _` | '_ \/ __| / __|/ _ \
| |__| |  __/ (_|  __/ | | | |_| |___| (_| | |_) \__ \_\__ \  __/
|_____/ \___|\___\___|_| |_|\__|______\__,_|_.__/|___(_)___/\___|

If you're reading this it means that the docs are missing or in a bad state.

Writing and maintaining friendly and useful documentation takes
effort and time. In order to do faster releases
I will from now on provide documentation relational to project activity.

  __How_to_Help____________________________________.
 |                                                 |
 |  - Open an issue if you have ANY questions! :)  |
 |  - Star this repo if you found it interesting   |
 |  - Fork off & help document <3                  |
 |.________________________________________________|

I publish all of my work as Libre software and will continue to do so,
drop me a penny at Patreon to help fund experiments like these.

Patreon: https://www.patreon.com/decentlabs
Discord: https://discord.gg/K5XjmZx
Telegram: https://t.me/decentlabs_se

Contributing

Ideas and contributions to the project are welcome. You must follow this guideline.

License

GNU AGPLv3 © Tony Ivanov

About

many to one feed encoder

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published