Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

chore: add basic usage example #69

Closed
wants to merge 1 commit into from

Conversation

chris-asl
Copy link

@vasco-santos This is an initial attempt on the usage example for issue #36.
PS: I don't know whether you're signing your commits in libp2p, I can remove it.
Same goes for any other changes :-)


Add a basic usage example whereby the client code runs on top of each
libp2p DHT node. The idea is that each user has its own deaddrop,
identified by her UserId (on the DHT identifiers namespace), where other
users can leave messages to.

The demo instantiates three application (and thus DHT) nodes. Bootstrap
is handled by having an "always-on" node where others can connect to.
In real world examples, this would not suffice, as a discovery mechanism
needs to be in place (either by using the RandomWalk peer discovery or
by switching any implementations of libp2p/interface-peer-discovery).

Once the nodes are instantiated and connected, thus forming a single
DHT, one deaddrop application (userA) writes a message for userB. Then,
userB reads her messages (after having been informed about the message
through off-channel means).

For this example to make sense, any sent message is encrypted using the
recipient's public key, so that only she can read them, by decrypting
them with her private key.

Resolves #36.

Signed-off-by: Chris Aslanoglou [email protected]

Add a basic usage example whereby the client code runs on top of each
libp2p DHT node. The idea is that each user has its own deaddrop,
identified by her UserId (on the DHT identifiers namespace), where other
users can leave messages to.

The demo instantiates three application (and thus DHT) nodes. Bootstrap
is handled by having an "always-on" node where others can connect to.
In real world examples, this would not suffice, as a discovery mechanism
needs to be in place (either by using the RandomWalk peer discovery or
by switching any implementations of libp2p/interface-peer-discovery).

Once the nodes are instantiated and connected, thus forming a single
DHT, one deaddrop application (userA) writes a message for userB. Then,
userB reads her messages (after having been informed about the message
through off-channel means).

For this example to make sense, any sent message is encrypted using the
recipient's public key, so that only she can read them, by decrypting
them with her private key.

Resolves libp2p#36.

Signed-off-by: Chris Aslanoglou <[email protected]>
@vasco-santos
Copy link
Member

Thanks for the PR @chris-asl and sorry for the late response.

We are currently on a process to refactor this codebase to use async await and async iterators / generators, and consequently I will wait for that refactor before merging the example, as it will need to be updated.

@vasco-santos vasco-santos mentioned this pull request Jun 3, 2019
@achingbrain
Copy link
Member

Thanks for opening this, I'm sorry it never landed. The codebase has been through several refactors and this may be better off being started again if the examples are still useful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Usage Example
3 participants