Protocol Specification

File Hash Structure

  • id: created by the concatenation of each SHA256 hash of chunks
  • name: pathname of the file
  • size: number of bytes in the file
  • chunkSize: number of bytes in each chunk
  • info (optional): short text that describes the file
  • creation date: creation time of the file hash, in standard UNIX epoch format (integer, seconds since 1-Jan-1970 00:00:00 UTC)
  • created by author of the file
  • hashes: position: bytes'position of the file that coresponds to the beginning of the chunk / hash: SHA256 hash values of the chunk

Example of a file hash: da65124fffa9628dc5da843bca7ba0b4008f22572180edd484d218ebf16560a3.db that corresponds of a filehash's video

{
   "id":"da65124fffa9628dc5da843bca7ba0b4008f22572180edd484d218ebf16560a3",
   "name":"video.mp4",
   "size":47885356,
   "chunkSize":47885.356,
   "info": "This is just a test with a video",
   "creationDate": "1464824743",
   "createdBy": "Sebastien Menozzi",
   "hashes":[
      {"position":0,"hash":"f098d8d867def7a3835202e53f0315abd63e9e14fa5e0de5380aec5db6065f99"},
      {"position":47885.356,"hash":"c613cbc7964359a5160811eda6c5fc66a0523c5ee3b2e422c5455950968eebb0"},
      {"position":95770.712,"hash":"cebdc39d755f9e542f125799a0b4cba5bcd7d79732aa2b8034bcd5a02b2a4554"},
      {"position":143656.068,"hash":"4b29ecdb746f545b44f031ed83801a2699278adc9efbf44649ca5c0c3efec463"},
      {"position":191541.424,"hash":"c4d3147cd33137ae9a8c1d6ca711c27c6968d4e5ad05e3016b68a477adfac401"},
      {"position":239426.78,"hash":"d8944c1cb40e95068447ec944607881c6b542f556272eeae243c13067342beba"},
      etc...
      {"position":287312.136,"hash":"bf0d4565c8e57caace9714b2e7a40f340d536a745f89f0bb6baf9d08454de130"},
      {"position":47885355.99999927,"hash":"bd4fc42a21f1f860a1030e6eba23d53ecab71bd19297ab6c074381d4ecee0018"}
   ],
   "_id":"caOrnTgE1aUU99PG"
}

File Peers Structure

  • id: id of the file
  • peers: ip:ip of the peer / port: port of the peer

Example of a file hash: da65124fffa9628dc5da843bca7ba0b4008f22572180edd484d218ebf16560a3.db that corresponds of a filehash's video

{
   "id":"da65124fffa9628dc5da843bca7ba0b4008f22572180edd484d218ebf16560a3",
   "peers":[
      {"ip":127.0.0.1,"port":"8080"},
      etc...
      {"ip":127.0.0.1,"port":"4001"},
      {"ip":127.0.0.1,"port":"2032"}
   ],
   "_id":"caOrnTgE1aUU99PG"
}

Client Specification

  • uid: unique, determine the identity of the user
  • ip: ip of the user
  • port: port of the user

To preserve the anonymity of each user, no more information is required

Relay Specification

What is a relay ?

A relay is used to transmit information of a client A to client B while preserving the identity of each. Indeed, the fact to channel the information to a relay allows to hide the source of the information. Thus, client A will never have access to the personnale information of client B (like IP, PORT) since no live connection is established between these two peers. Also, a p2p architecture with existing NAT is not properly ensure, even with other techniques such as hole punching or the UPnP protocol.

When a file is publishing, the hash list of the file is created by the relay. This hash list enables to proove the truthfulness of each chunk that is emmeting to the client that asked the file.

When peers send you the chunks, you become an emmiter. Thus, your ip and port is recording in the file peers.

Relay → file hash and file peers

Client → file