Inline CID Format

(Adapted from Brooke’s Notes)

An idea possibly independently invented by a few people, but that I know from @matheus23.

Notes

  • @matheus23 approached it from the angle that it would pack better for general IPLD Bao-like Transfer
  • Irakli and I wanted something more compact and more readable for humans

Or in somewhat higher detail:

WIP Idea Snippets

This would have to be more at a layer like a CAR file rather than IPLD itself, but we think everyone wants a way to pack IPLD like this when your data is likely to be a tree

Before

{
  "name": "Smokey",
  "animal": "cat",
  "owner": {"/": "bafy...owner"}
}

bafy...owner = {
  "name": "Brooke",
  "city": "Vancouver"
}

After

{
  "name": "Smokey",
  "animal": "cat",
  "owner": {
    "/": {
      "name": "Brooke",
      "city": "Vancouver"
    }
  }
}

Where the inlined object would use the hashing parameters of the parent by default (e.g. SHA256 & same codec etc). We often want the same codec across a bunch of serialisations, but that changes the CID, so this helps. Irakli is also playing with adding an optional field to include the CID if its parameters different which is something like:

{
  "/": [
    "bafy...forcedCidEncoding",
    {
      "name": "Brooke",
      "city": "Vancouver"
    }
  ]
}

At time of writing, a bunch of the conversations landed was that this technique probably should be a layer on top of IPLD, and thus be a parallel to something like a CAR file. At actually works really well with BAR files (number zero’s Bao Transfer which we’ve come to discover uses essentially Bao-ified CAR files)

2 Likes

I asked ChatGPT for a better marketing name than “Inline CIDs”

Sure, here are some marketing name ideas for this concept:

  1. IPLD Treehouse - emphasizing the interconnected and nested nature of the data structure

That may be a hole in one :laughing:

I’m glad you like it! IPLD Treehouse does seem like a fitting name, given the nested and interconnected nature of the data structure. It’s catchy, memorable, and accurately reflects the essence of the concept. Good luck with your project!

Update: formal spec lives here