Does Ipfs pull complete block when we do `ipfs refs -r <CID>` or `ipfs object stat <CID>`

Let’s assume I have only the parent-hash and ipfs --offline refs -r <CID> returns False for it.

Now I want to only obtains its hashes that are returned from ipfs refs -r <CID>.

As I know when we apply ipfs ls <CID> it pulls the complete data files/blocks from the network.

Instead when we apply ipfs refs -r <CID> does it still still pull the complete data files from the network on only small amount of data such as few kilobytes in order to figure out its refs?

If you do ipfs refs -r then yes, you will need to pull all blocks to get their links. MerkleDag objects roughy look like

// An IPFS MerkleDAG Link
message IPLDLink {
    // multihash of the target object
    bytes hash = 1;
    // utf string name. should be unique per object
    string name = 2;
    // cumulative size of target object
    uint64 size = 3;
}
  
// An IPFS MerkleDAG Node
message IPLDNode {
    // refs to other objects
    repeated IPLDLink links = 2;
    // opaque user data
    bytes data = 1;
}

IF you run ipfs object stat then I believe you just need to fetch the first block, but I’m not entirely certain

If you use ipfs ls --resolve-type=false --size=false it will not pull the data.

2 Likes