Three Lines of Code to Boost Download Speeds for Shared IPFS Content

This requires version 2025 or later to use

ipfs init --profile server,unixfs-v1-2025
ipfs config Import.HashFunction blake3
ipfs config Import.UnixFSHAMTDirectorySizeThreshold 1MiB

UnixFSHAMTDirectoryMaxFanout may be changed or left unchanged

ipfs config Import.UnixFSHAMTDirectoryMaxFanout 1024

Alternatively, modify Import

"Import": {
    "BatchMaxNodes": null,
    "BatchMaxSize": null,
    "CidVersion": null,
    "FastProvideRoot": null,
    "FastProvideWait": null,
    "HashFunction": null,
    "UnixFSChunker": null,
    "UnixFSDirectoryMaxLinks": null,
    "UnixFSFileMaxLinks": null,
    "UnixFSHAMTDirectoryMaxFanout": null,
    "UnixFSHAMTDirectorySizeThreshold": null,
    "UnixFSRawLeaves": null
}

Change to

"Import": {
    "CidVersion": 1,
    "HashFunction": "blake3",
    "UnixFSChunker": "size-1048576",
    "UnixFSDirectoryMaxLinks": 0,
    "UnixFSFileMaxLinks": 1024,
    "UnixFSHAMTDirectoryMaxFanout": 1024,
    "UnixFSHAMTDirectorySizeThreshold": "1MiB",
    "UnixFSRawLeaves": true
}

If you do not switch the hash to blake3, set CidVersion to 1 and UnixFSRawLeaves to true

The unixfs-v1-2025 configuration uses 1 MiB data blocks and 1,024 links per node. In comparison, the old configuration used only 256 KiB data blocks and 174 links. This provides the following benefits:
A shallower DAG tree structure (for a 1 TiB file, the new configuration requires 3 levels, while the old parameters require 4)
Approximately 4 times fewer total nodes when processing the same content
Faster random access and addressing of large files (fewer round trips are needed to traverse the tree structure)
Fewer CIDs need to be announced, reducing the load on public routing infrastructure such as the Amino DHT