@ -28,4 +28,68 @@ The bootstrapper creates a new libp2p node, subscribes to the shared topic strin
(Note that the node ID of `pubsub-interop` is going to be `Qm...6aJ9oRuEzWa`. Node IDs in libp2p are just public keys, and the public key `Qm...6aJ9oRuEzWa` is derived from the private key file `../util/private_key.bin.bootstrapper.Wa`. That file is just an X.509 keypair generated by the included program `util/private-key-gen`). We use fixed public/private keypairs for each node in this example to keep things simple.)
(Note that the node ID of `pubsub-interop` is going to be `Qm...6aJ9oRuEzWa`. Node IDs in libp2p are just public keys, and the public key `Qm...6aJ9oRuEzWa` is derived from the private key file `../util/private_key.bin.bootstrapper.Wa`. That file is just an X.509 keypair generated by the included program `util/private-key-gen`). We use fixed public/private keypairs for each node in this example to keep things simple.)
**Second terminal**: Create a go peer to connect to bootstrapper and publish on the topic
```
cd pubsub
./pubsub-interop ../util/private_key.bin.peer.Sk
```
This peer, which is not in bootstrapper mode, creates a node, subscribes to the shared topic string, spawns the same go routine, and then loops forever requesting user input and publishing each line to the topic.
**Third terminal**: Create another go peer to connect to bootstrapper and publish on the topic
```
cd pubsub
./pubsub-interop ../util/private_key.bin.peer.vy
```
**Fourth terminal**: Create a JS peer to connect to bootstrap and publish on topic
This JS peer will accept lines of text typed on stdin, and publish them on the PubSub topic.
(Note that the JS peer generates a new identity (public/private keypair) each time, and prints its public key to stdout. This is a deficiency in the demo; to be consistent with the Go code it should accept a private key on the CLI.)
If you return to the second, third or fourth terminals and type a message, the bootstrapper and the other 2 peers will all print your message.
**Conclusion**
You now have a chat app on a private libp2p network where each node can exchange messages anonymously using PubSub.
## Debugging Notes
**JS** To see debug messages from the Node.js program, use the `DEBUG` environment variable: