Create README.md

master
Rai Yang 5 years ago committed by GitHub
parent 42bf62bcf6
commit 85003e06bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,34 +1,13 @@
# libp2p Demos
# Whistleblower
## Demo 1: DHT for Connecting Peers & Sharing Content (Go and JS nodes)
## Decentralized messaging network that anyone can broadcast/subscribe messages anonymously.
**Directory**: `content-dht-provide-find`
Anonymity is achieved by implementing Dandelion protocol on top of libp2p's pub/sub module, dandelion is a privacy preserving protocol to make message sender anonymous, it has 2 phases, the first phase is stem phase, where messages go through a psuedo-random path, the second phase is fluffing, when the message reaches the last node(randomly chosen), the message is diffused to its surrounding peers, so the third party observer cannot track back the node original node who send the message, because the message is relayed through an anonymous graph.
Message broadcasting is implemented by libp2p floodsub.
**libp2p-pubsub-dandelion**: https://github.com/rairyx/go-libp2p-pubsub/tree/dandelion
**What it demonstrates:** A new DHT is created by the Go program `dht-interop`. In a separate terminal or machine, a Node.js program connects to this DHT. One connected, each verifies that it can find the other's content via the DHT.
**First terminal:**
```
cd content-dht-provide-find
make
./dht-interop -b ../util/private_key.bin.bootstrapper.Wa
```
`-b` means bootstrap mode. In this example, the go program is always the bootstrap node, so `-b` is always required. (***TODO***: eliminate this superfluous option)
Note that the node ID of `dht-interop` is always `Qm...6aJ9oRuEzWa` because it is being read in from `../util/private_key.bin.bootstrapper.Wa` (a private key marshalled to X.509 generated by the program `util/private-key-gen`). This is to keep the peer id of the bootstrap server stable across invocations.
**Second terminal:** run the command printed out by dht-interop, replacing 127.0.0.1 with the IP of the server where dht-interop is listening. Example:
Running the Node.js program:
```
cd content-dht-provide-find/js-dht-test
npm install # first time only
node js-dht-test/index.js /ip4/127.0.0.1/tcp/5555/ipfs/QmehVYruznbyDZuHBV4vEHESpDevMoAovET6aJ9oRuEzWa
```
## Demo 2: PubSub
## Demo
**Directory**: `pubsub`
@ -83,7 +62,7 @@ If you return to the second, third or fourth terminals and type a message, the b
**Conclusion**
You now have a chat app on a private libp2p network where each node can exchange messages using PubSub.
You now have a chat app on a private libp2p network where each node can exchange messages anonymously using PubSub.
## Debugging Notes

Loading…
Cancel
Save