Help in clarifying confusion with Merkledag and IPLD

I have been coming across information about Merkledags and IPLDS that seems conflicting or overlapping.

When I first started looking into IPFS I quickly learnt about Merkle trees and how IPFS uses a slight modification of that…instead of trees, we have DAGs, hence the Merkledag. The link about Merkledag on the documentation here https://docs-beta.ipfs.io/concepts/merkle-dag/#further-resources basically presented it as the underlying data structure of IPFS.

I think I recently came across a section of the docs (and for the life of me I can’t find the link) where it was stated that Merkledag are being deprecated in favour of IPLD. But even without finding a reference to that claim, the first texts on the IPLD website here https://ipld.io/ states that IPLD is the data model of the content-addressable web - but is that what the Markledag is supposed to be?

I will appreciate if someone knowledgeable about these concepts can help clarify and disambiguate between Markledags and IPLD and how they fit into IPFS.

Thanks :slight_smile:

Would I be correct to say IPLD is still a Markledag? But Markledag with more structure? By more structure, I mean there is specification about what data the nodes in the dag should look like, how the links should look like etc?

IPLD is just an specification for Merkle-DAGs which allows to abstract many types of merkle dags and work with them. You may have seen that certain ipfs-merkledag-specific type is getting abstracted with IPLD, but as such, Merkle-DAGs remain.

I am just getting into IPLD-based development and have been trying to decide where to begin with new Go application code using embedded go-ipfs. In particular, the distinction between go-ipld-format and go-ipld-prime is somewhat confusing to me. From reading the go-ipld-legacy repo I gather that prime is the new way to do things, replacing legacy format-based code. Is that correct? I’d also like to use IPLD Schema as much as possible, and am slowly grokking how all these pieces fit together. A pointer to a minimal, but up-to-date IPLD Go code example would prove very helpful!

@crimeminister if you’re starting anything new with IPLD in Go then go-ipld-prime is definitely the right choice. At the moment there’s work going in to migrating older code to use go-ipld-prime and not a lot of work investing in building on top of the older libraries.

In terms of examples, looking through go-ipld-prime’s repo is probably the best start, there’s lots of docs littered throughout and the tests have lots of examples.

There’s a feature branch in go-ipfs that’s working to getting a migration for the bulk of the core code of go-ipfs migrated, it might be interesting: https://github.com/ipfs/go-ipfs/pull/7976 - see links and other PRs that merged into that branch.

(The forum isn’t allowing me to post more links so I’ll have to split up this response …)

Some examples top of mind (for me, I’m not necessarily the best person to be giving Go recommendations mind you):