What is the maximum IPFS block size

I know that locally it can be anything you want but bit swap needs it to be some under some maximum size or they’re rejected. I’m asking because I’ve seen reference two different numbers out there, 1m, 2m, 4m, and others. I’m assuming that it was changed to be larger at some point and some of the others references are just incorrect.

Thanks.

To be safe:

  • Data should not be created with blocks larger than 1MiB
  • Data transfer protocol implementations should be able to process blocks at least 2MiB

What if I wanted to live dangerously? I’m assuming there’s a preference for fewer full blocks.

Living dangerously is a bit dangerous for my tastes :grin:. I’m not sure what the largest you could possibly send via the current go-bitswap implementation is, but I wouldn’t rely too heavily on it.

I’m assuming there’s a preference for fewer full blocks.

How files are chunked up into blocks is situational and has a number of variables involved such as parallelization of requests, duplicate data received, how many CIDs to advertise (particularly if you want random access into the chunks of your files), data deduplication, and probably a few more that I’m missing.

If you’re really concerned about block sizes I’d do some rough benchmarking with your datasets and use cases to see what makes sense, or see what other folks have done with use cases similar to yours. I’d be wary of exceeding the safe limits without good evidence of how much it’ll help you though since it may not be worth the pain of potential breakage in the future.