github.com/jbendotnet/noms@v0.0.0-20190904222105-c43e4293ea92/doc/decent/demo-p2p-chat.md (about) 1 [Home](../../README.md) » [Use Cases](../../README.md#use-cases) » **Decentralized** » 2 3 [About](about.md) | [Quickstart](quickstart.md) | [Architectures](architectures.md) | **P2P Chat Demo** | [IPFS Chat Demo](demo-ipfs-chat.md) 4 <br><br> 5 # Demo App: P2P Decentralized Chat 6 7 This sample demonstrates the simplest possible case of building a p2p app on top of Noms. Each node stores a complete copy of the data it is interested in, and peers find each other using [IPFS pubsub](https://ipfs.io/blog/25-pubsub/). 8 9 Currently, nodes have to have a publicly routable IP, but it should be possible to use [libP2P](https://github.com/libp2p) or similar to connect to most nodes. 10 11 # Build and Run 12 13 Demo app code is in the 14 [p2p](https://github.com/attic-labs/noms/tree/master/samples/go/decent/p2p-chat) 15 directory. To get it up and running take the following steps: 16 17 * Use git to clone the noms repository onto your computer: 18 19 ```shell 20 go get github.com/attic-labs/noms/samples/go/decent/p2p-chat 21 ``` 22 23 * From the noms/samples/go/decent/p2p-chat directory, build the program with the following command: 24 25 ```shell 26 go build 27 ``` 28 29 * Run the p2p client with the following command: 30 31 ```shell 32 mkdir /tmp/noms1 33 ./p2p-chat client --username=<aname1> --node-idx=1 /tmp/noms1 >& /tmp/err1 34 ``` 35 36 * Run a second p2p client with the following command: 37 38 ```shell 39 mkdir /tmp/noms2 40 ./p2p-chat client --username=<aname2> --node-idx=2 /tmp/noms2 >& /tmp/err2 41 ``` 42 43 Note: the p2p client relies on IPFS for it's pub/sub implementation. The 44 'node-idx' argument ensures that each IPFS-based node uses a distinct set 45 of ports. This is useful when running multiple IPFS-based programs on 46 the same machine.