# iWant | Decentralized Peer to Peer File Sharing ⛓

**URL:** <https://onehack.st/t/iwant-decentralized-peer-to-peer-file-sharing/56528>\
**Category:** Tutorials & Methods\
**Tags:** tools, networking, file-management\
**Created:** [September 10, 2019, 10:00pm UTC](https://onehack.st/t/iwant-decentralized-peer-to-peer-file-sharing/56528 "2019-09-10T22:00:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheJoker](https://onehack.st/user_avatar/onehack.st/thejoker/32/22660_2.png) [@TheJoker](https://onehack.st/u/TheJoker)\
**Post date:** [September 10, 2019, 10:00pm UTC](https://onehack.st/t/iwant-decentralized-peer-to-peer-file-sharing/56528/1 "2019-09-10T22:00:16Z")

</div>

![Decentralized-Peer-to-Peer-File-Sharing](https://onehack.st/uploads/default/original/3X/9/4/94f158fe1430a0bdd9ec21afadc88b98a07987d0.jpeg)

> # A command-line tool for searching and downloading files in LAN network, without any central server.

## Features

- **Decentralized** : There is no central server hosting files. Therefore, no central point of failure
- **Easy discovery of files** : As easy as searching for something in Google.
- **File download from multiple peers** : If the seeder fails/leaves the group, leecher will continue to download from another seeder in the network
- **Directory download** : Supports downloading directories
- **Resume download** : Resume download from where you left off.
- **Consistent data** : Any changes(modification, deletion, addition) made to files inside the shared folder will be instantly reflected in the network
- **Cross Platform** : Works in Linux/Windows/Mac. More testing needs to be done in Mac

## Installation

`pip install iwant`

Or, if you download from source

`python setup.py install --user`

**Works on Python2 only**

## System Dependencies

Make sure, you have the following system dependencies installed:

- libffi-dev
- libssl-dev

## Usage

```
iWant.

    A commandline tool for searching and downloading files in LAN network, without any central server.

Usage:
    iwanto start
    iwanto search <name>
    iwanto download <hash>
    iwanto share <path>
    iwanto download to <destination>
    iwanto view config
    iwanto --version

Options:
    -h --help Show this screen.
    --version Show version.
    start This starts the iwant server in your system
    search <name> Discovering files in the network. Example: iwanto search batman
    download <hash> Downloads the file from the network
    share <path> Change your shared folder
    view config View shared and download folder
    download to <destination> Change download folder

```

**Note: Shared and Download folder cannot be the same**

## How does it work ?

As soon as the program starts, it spawns the election daemon, folder monitoring daemon and server daemon.

1. The **election daemon** takes care of the following activities

- Manages the consensus.
- Notifies the **server daemon** as soon as there is a leader change.
- It coordinates with other peers in the network regarding contesting elections, leader unavailability, network failure, split brain situation etc.
- It uses **multicast** for peer discovery. The consensus description is mentioned [here](https://github.com/nirvik/iWant/blob/master/iwant/core/engine/consensus/README.md)

1. When the **folder monitoring daemon** starts, it performs the following steps

- Indexes all the files in the shared folder
- Updates the entries in the database
- Informs the server about the indexed files and folders.
- Any changes made in the shared folder will trigger the **folder monitoring daemon** to index the modified files, update the database and then inform the server about the changes

1. The **iwant client** talks to the **server daemon** when the user wishes to:

- search for files
- download files
- change shared folder
- change download folder

1. The **server daemon** receives commands from **iwant client** and updates from **file monitoring and election daemon**.

- Updates received from **folder monitoring daemon** is fowarded to the leader. For example: indexed files/folders information.
- Updates received from the **election daemon** like `leader change` event, triggers the server to forward the indexed files/folders information to the new leader
- Queries received from the **iwant client** like `file search` is forwarded to the leader, who then performs fuzzy search on the metadata it received from other peers and returns a list containing (filename, size, checksum)
- Queries received from the **iwant client** like `file download` is forwarded to the leader, who forwards the roothash of the file/folder along with the list of peers who have the file. The **server daemon** then intiates download process with peers mentioned in the peers list.
- Updates received from the **iwant client** like `changing shared folder` , triggers the **server daemon** to make sure that the **folder monitoring daemon** indexes the new folder and after indexing is complete, the **server daemon** updates the leader with the new indexed files/folders meta information.

> # [https://github.com/nirvik/iWant](https://github.com/nirvik/iWant)

---

<div class="post-metadata">

**Author:** ![big](https://onehack.st/user_avatar/onehack.st/big/32/17883_2.png) [@big](https://onehack.st/u/big)\
**Post date:** [September 10, 2019, 10:15pm UTC](https://onehack.st/t/iwant-decentralized-peer-to-peer-file-sharing/56528/2 "2019-09-10T22:15:14Z")

</div>

Nice tips.

---

<div class="post-metadata">

**Author:** ![Xtreme](https://onehack.st/user_avatar/onehack.st/xtreme/32/23142_2.png) [@Xtreme](https://onehack.st/u/Xtreme)\
**Post date:** [September 10, 2019, 10:36pm UTC](https://onehack.st/t/iwant-decentralized-peer-to-peer-file-sharing/56528/3 "2019-09-10T22:36:39Z")

</div>

So it doesn’t work with latest version of Python v3
