Jami-distributed-network.md (4938B)
1 # The Jami Network 2 3 ### Connectivity 4 5 Jami relies on a distributed network, that brings multiple 6 advantages when compared to federated networks: 7 8 - No point of failure, 9 - More resilient to censorship, 10 - Do not depend on anything other than its users, 11 - Trust amongst nodes is not necessary. 12 13 ![Network-topo](../media/distributed-network-topo.png) 14 15 This network forms a Distributed Hash Table (DHT) 16 17 The core problem of distributed communication systems is peer 18 connectivity, Jami achieves it through two elements: 19 20 - Encrypted announcements on DHT, 21 - Use of standard protocols for NAT hole punching. 22 23 Jami is built on two distinct distributed networks: 24 25 - the OpenDHT kademlia network to provide distributed connectivity 26 establishment and message distribution, 27 - the JamiNS blockchain to provide distributed name registration. 28 29 The OpenDHT network 30 ------------------- 31 32 See 33 [<https://github.com/savoirfairelinux/opendht>](https://github.com/savoirfairelinux/opendht) 34 for more information about OpenDHT, which provides a distributed 35 key-value datastore for connectivity establishment (with ICE) and 36 message distribution in Jami. 37 38 An OpenDHT network can be joined by knowing about any node already 39 connected to the network. This node will then share its knowledge about 40 other nodes on the network. 41 42 Jami clients use a persistent node cache to reconnect to the network 43 after a first session. A configurable, known, stable "bootstrap" node is 44 used for the first connection or if cached nodes don't answer. 45 46 Jami clients currently use bootstrap.jami.net:4222 as the default 47 (configurable) bootstrap node and network ID 0 (the default, public 48 OpenDHT network). 49 50 ### Contribute to the OpenDHT network 51 52 Every Jami account runs an OpenDHT node, contributing to the network and 53 allowing Jami to scale. 54 55 Jami users can have full independence by running their own stable 56 OpenDHT node and configure it as a bootstrap node in Jami, while helping 57 to improve stability, robustness and resilience for every user of the 58 public OpenDHT network. 59 60 A standalone node can be run using the [dhtnode 61 utility](https://github.com/savoirfairelinux/opendht/wiki/Running-a-node-with-dhtnode) 62 included with OpenDHT. dhtnode doesn't persist any data and has a 63 default in-memory storage limit of 8 MiB. 64 65 Stable community-run DHT nodes will be added to the default bootstrap 66 list at the request of their owner, as more bootstrap nodes means a more 67 resilient, independent network. 68 69 The JamiNS blockchain 70 --------------------- 71 72 The JamiNS blockchain is experimental and its architecture is expected 73 to evolve. 74 75 Jami clients don't run blockchain nodes themselves but rather 76 communicate with a JamiNS server using HTTP for name registration and 77 query, with a REST API. This is because the resources needed to run a 78 blockchain node are too high for most end-users. 79 80 The nameserver can be configured by-account in Jami, allowing to connect 81 Jami clients to various more or less centralized user directories. 82 83 ### Contribute to the JamiNS blockchain 84 85 The default Jami name service is ns.jami.net, provided by Savoir-faire 86 Linux, connected to an Ethereum blockchain node; the goal being to give 87 everyone the possibility (if they which so) to run their own blockchain 88 node and HTTP service, mine some Ether, and use it to pay the 89 transaction fee needed to register their username in Jami. 90 91 Code of the Ethereum contract, the blockchain genesis file, and the 92 NodeJS module (HTTP server) can be found here : 93 [1](https://github.com/savoirfairelinux/ring-nameservice) 94 95 ### Running a Jami Node 96 97 #### Pre-requisites: 98 1. Geth 1.8.23+ (download from [HERE](https://geth.ethereum.org/downloads/)) 99 2. Jami genesis file (download from [HERE](https://github.com/savoirfairelinux/ring-nameservice/blob/master/instructions/genesis.json)) 100 101 102 #### Joining the Jami Network 103 104 The process of joining the Jami network is similar to the process of joining a regular ethereum network with the difference that the genesis file is used to initialize the data directory. 105 106 1. Download the Jami genesis file from the Jami github repo 107 2. Create a directory on your computer which you will use to store the Jami blockchain data 108 * Example for MacOS (/Users/username/jamichain) 109 * Example for Linux (/home/username/jamichain) 110 * Example for Windows (C:\Users\username\jamichain) 111 3. Use geth to initialize the directory you created in (2) by running ```./geth --datadir /home/username/jamichain init genes is.json ``` 112 4. You can now start geth with the command-line options you need and specifying one of Jami's bootnodes as follows: 113 114 ``` 115 geth --datadir=/home/username/jamichain --syncmode=full --networkid 1551 --bootnodes "enode://11ba6d3bfdc29a8afb24dcfcf9a08c8008005ead62756eadb363523c2ca8b819efbb264053db3d73949f1375bb3f03090f44cacfb88bade38bb6fc2cb3d890a5@173.231.120.228:30301" console 116 ``` 117 This will start a geth daemon with an attached console which is now syncing with Jami's network.