Become a geek #2: The role of the DHT in FlowingMail

The DHT, or Distributed Hash Table is a big database containing values identified by an ID.

Each node in the FlowingMail network is responsible for the storage of the values identified by an ID similar to the node’s ID.
We saw in a previous article how the nodes find other nodes with a specific ID.

Because of the DHT redundancy (each value is stored in several nodes) the DHT is used to store information that has to be always available.

The following values are published to the DHT:

the nodes’ public keys (they are identified by the owner’s ID)

the hashes of the available email (they are identified by the recipient’s ID)

the list of nodes that have the list of blocks forming an email (they are identified by the mail hash)

the list of nodes containing specific blocks of an email (they are identified by the block hash)

Therefore a node can always:

ask for a public key of a specific node, even if the requested node is offline

ask for the list of email hashes that have been sent to a specific ID (but only the recipient can decrypt the mails)

ask for the list of nodes that are storing parts of the mails

ask for a list of nodes that store specific blocks of an email

Once a recipient obtains the list of nodes that contain the blocks of his emails then it can start downloading the mails from them.