Where does IPFS store all the data?

前端 未结 1 862
自闭症患者
自闭症患者 2020-12-23 16:21

I\'ve been trying to implement and understand the working of IPFS and have a few things that aren\'t clear.

Things i\'ve tried:
Implemented IPFS on my system and

相关标签:
1条回答
  • 2020-12-23 17:16

    When you upload something, the file is chunked by ipfs and stored in your cache folder (.ipfs).

    If you check the file existance on another peer of the network (say the main gateway, ipfs.io) that peer requests the file from you and caches it too.

    If later you switch off your daemon and you can still see the file on the gateway it's probably because the gateway or some other peer on the web still has it cached.

    When a peer wants to download a file but it's out of memory (it can no longer cache), it trashes the oldest used files to free space.

    If you want to dive deep into the technology, check first these fundamentals:

    • how git works
    • decentralized hash tables (DHT)
    • kademlia
    • merkle trees

    The latter should give you an idea of how the mechanism works more or less.

    Now, let's answer point by point

    1. Yes
    2. All the peers that request your file cache it
    3. You lose the file when it's no longer possible to reconstitute your file from all the peers that had a part of it cached (including yourself)
    4. One can get just a part of it, imagine you are watching a movie and you stop more, or less, at the half... that's it, you've cached just half of it.
    5. When you watch a video on YouTube your browser caches it (that means a replication!)... ipfs is more efficient in terms of traffic, let's say you switch off the browser and 2 minutes later you want to watch it again. Ipfs gets it from your cache, YouTube makes you download it again. There's also an interesting matter on the delta storage (related to git) and from where you get it (could be inside your lan... that means blazing fast) but I want to stick to the questions.
    6. If you get data, you cache it so...
    7. The main daemon is written in go. Go is efficient but not as much as writing it on C++, C, Rust... Also, the tech is pretty young and it will improve with time. The more space you have the more you can cache, CPU power isn't THAT important.

    If you are interested in ways to store data in a p2p manner, here some links to interesting projects.

    • https://filecoin.io/
    • https://storj.io/
    • https://maidsafe.net/
    • https://www.ethereum.org/ and it's related storage layer
    • https://ethersphere.github.io/swarm-home/
    0 讨论(0)
提交回复
热议问题