mirror of https://github.com/rairyx/raven
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.6 KiB
Plaintext
54 lines
1.6 KiB
Plaintext
# libp2p Demos
|
|
|
|
## Demo 1: DHT Peer & Content with Go and JS Nodes
|
|
|
|
**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.
|
|
|
|
**First terminal:**
|
|
```
|
|
cd content-dht-provide-find
|
|
make
|
|
./dht-interop
|
|
```
|
|
|
|
**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:
|
|
|
|
```
|
|
node js-dht-test/index.js /ip4/127.0.0.1/tcp/9876/ipfs/QmehVYruznbyDZuHBV4vEHESpDevMoAovET6aJ9oRuEzWa
|
|
```
|
|
|
|
Note that the node ID of `dht-interop` is always `Qm...RuEzWa` because it is being read in from `util/private_key.bin` (an X.509 private key generated by `util/private-key-gen`).
|
|
|
|
|
|
## Demo 2: PubSub
|
|
|
|
**What it demonstrates**: Two Go nodes are created and run a chat server using a shared PubSub topic. **TODO**: Should be a Go node and a JS node, once I get the two Go nodes version working.
|
|
|
|
|
|
_Acknowledgements: @jhiesey for DHT (content & peer routing) JS+Go interop, @stebalien for PubSub_
|
|
|
|
|
|
|
|
|
|
--------------------------------------------
|
|
|
|
util/private-key-gen -> private_key.bin (marshalled private key that is used for stable peer id of bootstrap server)
|
|
|
|
|
|
|
|
0. Help me fix node "Error: Cannot find module 'libp2p'"
|
|
Answer:
|
|
cd js-dht-test
|
|
npm install
|
|
|
|
|
|
2. Let's run it on bootstrap box (go) and locally (js)
|
|
WORKS!
|
|
|
|
3. Explain to me how you generated peer CIDs
|
|
One is the hash of a pubsub topic
|
|
The other is just mine
|
|
|
|
All this is example does is verify that two peers can find each other's content
|
|
|