(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)