Kredits:IPFS

From Kosmos Wiki
Revision as of 22:33, 26 November 2019 by Raucao (talk | contribs)
Jump to navigation Jump to search

IPFS is a public, decentralized, p2p file system.

It is content-addressable, meaning a filename is just a hash of its content. Thereby, identical content is never duplicated, and the authenticity of the content at a certain name or address can easily be verified by hashing it again after downloading it from the p2p network.

We use IPFS to store Kredits data, like contributor profiles and contribution details. Check out these two documents for example:

(Or you could fetch the same ones from a different node: contributor example, contribution example)

Kosmos IPFS setup

We run a few IPFS nodes, which are linked together to effectively form a cluster, in which kredits data can be accessed very quickly. This is how we mirror our data in a fast and reliable way:

  • Due to all kredits data being public by design, instead of setting up a private cluster, our IPFS nodes simply run a program which listens to new IPFS hashes being published by the smart contracts on the Ethereum blockchain. Whenever they see a new document being published, they automatically pin it locally (meaning it is downloaded and marked to be saved indefinitely on that node).
  • Our smaller nodes only connect to a few other p2p nodes in order to save memory and CPU resources. However, they are connected to at least one other Kosmos node at all times.
  • Our largest node, which is also running the public gateway at ipfs.kosmos.org, is connected to a few hundred other IPFS nodes, so that anyone else can access kredits data reasonably fast.
  • Some developers and users also run the Kredits IPFS Pinner on their own machines. They may run it once every now and then to simply back up the data, or they may also run it on an always-on server of theirs, in order to mirror all kredits data live.