



  

Tracker 0.0.1 documentation

 [Tracker](index.html#document-index) 

 latest

 

* [API](index.html#document-api)

* [Notes](index.html#document-notes)

* [Database Layout](index.html#document-schema)

[Tracker](index.html#document-index)

* [Docs](index.html#document-index) »

* Tracker 0.0.1 documentation

* [Edit on GitHub](https://github.com/Ell/Tracker/blob/master/docs/index.rst)

---

Tracker - A BitTorrent Tracker[¶](#tracker-a-bittorrent-tracker "Permalink to this headline")

=============================================================================================

Tracker aims to implement the [BitTorrent tracker specification](http://wiki.theory.org/BitTorrentSpecification#Tracker_.27scrape.27_Convention) faithfully and allow people to easily implement it for use in private and public BitTorrent communities. The source code is [available on github](https://github.com/Ell/Tracker).

Contents:

API[¶](#module-api "Permalink to this headline")

------------------------------------------------

Notes[¶](#notes "Permalink to this headline")

---------------------------------------------

BitTorrent tracker is a pretty basic web application that needs to store and display data.

Some private tracker specific implementations needed:

* Announce endpoint needs to take a keypass that is unique to the user using the site:

```

GET /<keypass>/announce

```

Database Layout[¶](#database-layout "Permalink to this headline")

-----------------------------------------------------------------

Tracker uses RethinkDB to track torrents and user stats

### Torrents[¶](#torrents "Permalink to this headline")

Tracker tracks torrent stats in accordance to the bittorrent tracker specification. Every torrent that is tracked must store:

* Number of peers who have the entire file(s) ie. **seeders**

* Number of peers who are still downloading ie. **leeching**

* List of peer addresses with port

* info\_hash - the Torrents unique id from the client

Torrent:

```

torrent::<info_hash>          # we store torrents in redis based on their info_hash since it will always be unique

{

  id: <info_hash>,     # the torrents unique info_hash

  peer_list: {

    <peer_id>: {

      ip: <ip>,              # list of peers by user_id

      port: <port>

  }

  seeders: []

  leechers: []

  downloaded: <int> # count of people who sent completed event

  }

}

```

### Users[¶](#users "Permalink to this headline")

User:

```

user::<key>                   # users are stored a retrieved based on the `user_id` given by the front end

{

  id: <key>,             # user_id given when adding new user

  last_ip: <ipaddress>,           # last known ip of user (optional?)

  last_port: <port>,

  seeding: [],                  # list of torrents user is seeding

  leeching: [],                 # list of torrents user is leeching

  torrents: {

    <info_hash>: {

      uploaded: <>,

      downloaded: <>,

    },

    ..

  }                  # overall list of all torrents user is active in

},

  total_upload: <uploadamount>,   # total uploaded

  total_downloaded: <downloaded>, # total downloaded

}

```

User ratio isnt calculated by the tracker since thats pretty pointless when we are already tracking total up and down.

