Blockstore optimization


When getting a file from my own blockstore, does my node calculate each node’s cid to find the right ones (to rebuild the merkle DAG) ? Or the cid of each block is stored in some kind of meta data of a block ?


There is metadata blocks called “root” blocks.
But thoses blocks aren’t an optimisations or anything, it’s just how IPFS works.

When you get a file, you first read the root block that will give you some sub blocks, and then repeat the operation (you can have root blocks point to root blocks pointing to root blocks, …).
If you don’t have one of the blocks it’s downloaded instead.

There is no particular optimisations IPFS will traverse the dag and rebuild the file from it.

Thanks @Jorropo :slight_smile: for your response