Skip to content

📒 Cook Book - Problem 0: Custom Isolated App Use #9

@benzmuircroft

Description

@benzmuircroft

Please note that this code is more than likely totally wrong (Until updated/fixed by @5-142857 as discussed on discord)

NIPs

For a full list of the Nostr protocol NIPS (Nostr Implementation Protocols) see: nostr-protocol/nips

📒 Custom Isolated App Use

Most developers using this implementation of the Nostr protocol will want to use it to build social media applications that rival Twitter and Mastadon, whereas; hyper-nostr has wide ranging, broader use cases as a tool in standalone p2p app development (where the app itself may be relying on it's own internal app users to connect data in ways that a simple hypercore/autobase lacks).

Use Cases

  • A multi-writer database on the swarm
  • A shared index for quickly marrying data that a user does not personally have, to an id of known data
  • A shared cache layer
  • A shared memory for offline users, who would otherwise miss application-level events meant for them
  • Sharding large datasets
  • Data ownership

Reasoning

autobase falls short in linking literally everyone automatically together on a shared object due to it's single writer nature. Not to mention that It needs the developer to know and manage adding writers. Now, understand that hyper-nostr can be used to solve these problems, by working alongside autobase and being the needed shared multi-writer object! 😉

  • autobase is a tool for making chats and versioning systems like git collaborations and shared activities like writing music together
  • hyper-nostr replaces the role of central server (plus it can do chats / versioning / collab another way)

To Do

In /hyper-nostr/swarm.js can you please add this update?

const prefix = 'hyper-nostr-'

export default async function createSwarm (sdk, _topic, opts) {
  if (!opts) opts = {}; 
  const topic = (opts.prefix) ? opts.prefix + _topic : prefix + _topic
  ...

So that developers can use this module privately with their users (optionally) like:

createSwarm(sdk, topic); // normal hyper-nostr- known to any users on nostr
// or
createSwarm(sdk, topic, { prefix: '' }); // totally isolated to the current app
// or
createSwarm(sdk, topic, { prefix: 'myapp-' }); // isolated to a network namespace on any apps who know the namespace
// or
createSwarm(sdk, topic, { prefix: `nike-${ authKey }-` }); // protected by the nike network apps
// or
createSwarm(sdk, topic, { prefix: `${aes.decode('71a936f2a1e6bbad750933436343519983d34eecfef00d7a97b32b1103dbb0db')}-` }); // known by none / hard-coded

This will optionally allow them to isolate their apps away from the default, public hyper-nostr- discovery!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions