Understanding IPFS

IPFS can deliver static content only.

There are a few things worth noting here:

  • Since most content is identified by hash, it can’t be changed
  • Within IPFS, you can use either IPNS (has some issues right now, but is being steadily improved) or DNSLink as exceptions to the above rule — both of these let you make mutable pointers to other IPFS objects.
  • Lots of people are also exploring other alternatives to IPNS and DNSLink, like the blockchain-based ones @antonchanning mentioned. There’s no real “best” solution that’s emerged yet.
  • IPFS also has a built-in publish/subscribe (pubsub) feature. Most chat tools (and a lot of the database stuff) is built on top of that — it allows for speedy communication and updates. If you’re trying to communicate changes to existing objects through pubsub, you’ll also want to look into CRDTs, which are an important tool for distributed databases. OrbitDB is a good example of this in practice.
  • Individual nodes can also link up and communicate directly using Libp2p, the core networking library underlying IPFS.

Some other resources on dynamic data in IPFS:

Assume in this problem there are between 10,000 to 40,000 regular nodes and some supervisor nodes. Regular nodes want to send some data to supervisor nodes periodically and receive orders occasionally. How ipfs can help with this?

People are still figuring out the best ways to do things like this on IPFS, but a good idea to start with might be to use pubsub for most of this communication. You’ll need to implement your own system for signing or encrypting messages (depending on your security concerns) — IPFS doesn’t provide any higher-level tools for that (yet). If you need to maintain a list of public keys for nodes that are allowed to be “supervisors,” you might maintain that in IPNS, or just regularly rebroadcast the list over pubsub.

Do all nodes (from PCs to some embedded systems like Raspberry Pis) need to install ipfs bin?

You can also use IPFS as a library directly in a Go or JavaScript program. But for the most part, yes. If you want nodes to communicate in a distributed fashion, without needing to know much about each other, they’ll need to do all that communication with IPFS or Libp2p.

How can they find each other by purely using ipfs (assuming some predefined configs are made on nodes)?

Unless you have a short list that doesn’t change often, you’ll probably want to use a system like pubsub, so your nodes don’t necessarily need to communicate directly with each other. You could also have a decentralized (but not fully distributed) system where all nodes are configured with the addresses for a few central nodes — then they start by contacting those nodes to get a list of other nodes to talk with (this is how ws-star works for connecting IPFS nodes inside web browsers right now).

2 Likes