You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This proposal introduces profiles for IPFS CIDs. Profiles explicitly define CID version, hash algorithm, chunk size, DAG width, layout, and other parameters.
21
+
This proposal introduces profiles for IPFS CIDs. Profiles explicitly define CID version, hash algorithm, chunk size, DAG width, layout, and other parameters.
19
22
20
23
## Motivation
21
24
22
25
Currently, CIDs can be generated with a variety of settings and optimizations for chunking, DAG width, and more. This means the same file can yield multiple, different CIDs depending on which tools and settings are used, and it is not possible to reliably reproduce or verify the CID. Profiles offer With profiles, following the same profile will produce identical CIDs for identical content, whic makes verification regardless of implementation.
23
26
24
27
## Detailed design
25
28
26
-
We introduce a profile naming system,
29
+
We introduce a profile naming system,
27
30
28
31
Each profile must specify the following characteristics:
29
32
30
33
1. CID version (currently only CIDv0 or CIDv1)
31
-
2. Hash algorithm
32
-
3. UnixFS Chunk size (explicitly set, not contextual/reactive to input)
33
-
4. UnixFS directory DAG width
34
-
5. UnixFS directory DAG layout
35
-
6. HAMT directory DAG threshold
36
-
7.HAMT directory DAG width
37
-
8. Leaf Envelope (historically dag-pb, now none/raw)
38
-
9. Allow empty directories
39
-
6. Required
34
+
1. Hash algorithm
35
+
1. UnixFS Chunk algorithm (e.g. size-based or content-based)
36
+
1. UnixFS directory DAG layout (e.g. balanced, trickle)
37
+
1. UnixFS file DAG width (max number of links per `File` node)
38
+
1. UnixFS directory DAG width (max number of links per basic `Directory` node)
39
+
1. UnixFS HAMT directory DAG threshold (max `Directory` size before switching to `HAMTDirectory`)
40
+
1. HAMT directory DAG width (max number of fanout links per internal HAMTDirectory node)
| DAG width | 1024 | 174 (but it's complicated*) | 1024 | 174 | not specified |
72
-
| DAG layout | balanced | balanced | balanced | balanced | not specified |
52
+
Here is a summary table of current (2025-Q2) defaults, thanks to input & clarifications from @2color@achingbrain@lidel:
73
53
74
-
* Kubo has 2 different default DAG widths:
75
-
* For HAMT-sharded directories, the `DefaultShardWidth`[here](https://github.com/ipfs/boxo/blob/f1d5312e3be45d151bb9c8f11c9283820687bea3/ipld/unixfs/io/directory.go#L30) is 256.
76
-
* For files, `DefaultLinksPerBlock`[here](https://github.com/ipfs/boxo/blob/v0.29.0/ipld/unixfs/importer/helpers/helpers.go#L30) is ~174
See related discussion at https://discuss.ipfs.tech/t/should-we-profile-cids/18507/
79
68
@@ -85,7 +74,7 @@ Reliable, deterministic CIDs allow independent verification of content across to
85
74
86
75
Implementations will need to (1) make CID generation settings configurable and (2) support user setting of profiles.
87
76
88
-
Kubo currently has no CLI / RPC / Config option to control DAG width in Kubo. https://github.com/ipfs/kubo/issues/10751 is the starting point to add that ability.
77
+
Kubo 0.35 will have [`Import.*` configuration](https://github.com/ipfs/kubo/blob/master/docs/config.md#import) option to control DAG width.
89
78
90
79
### Security
91
80
@@ -95,6 +84,15 @@ TODO
95
84
96
85
Another approach could be to name profiles based on the key UnixFS/CID parameters, e.g. v1-sha256-balanced-1mib-1024w-raw. This is longer and more convoluted.
97
86
87
+
88
+
#### Empty directories
89
+
90
+
Decision if empty directories should be included is left out of scope.
91
+
92
+
Tools can apply arbitrary filtering before passing filesystem entries
93
+
to be converted into a DAG, thus for 1:1 CID reproducibility one should
94
+
run without any prefilters, or ensure the same prefilters are applied.
0 commit comments