Skip to content

Commit 8842176

Browse files
authored
Create ipip-0000.md
1 parent 9294ac7 commit 8842176

1 file changed

Lines changed: 102 additions & 0 deletions

File tree

src/ipips/ipip-0000.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
# IPIP number should match its pull request number. After you open a PR,
3+
# please update title and update the filename to `ipip0000`.
4+
title: "IPIP-0000: CID Profiles"
5+
date: 2025-04-03
6+
ipip: proposal
7+
editors:
8+
- name: Michelle Lee
9+
relatedIssues:
10+
- n/a
11+
order: 0000
12+
tags: ['ipips']
13+
---
14+
15+
## Summary
16+
17+
<!--One paragraph explanation of the IPIP.-->
18+
This proposal introduces profiles for IPFS CIDs. Profiles explicitly define CID version, hash algorithm, chunk size, DAG width, layout, and other parameters.
19+
20+
## Motivation
21+
22+
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+
24+
## Detailed design
25+
26+
We introduce a profile naming system,
27+
28+
Each profile must specify the following characteristics:
29+
30+
1. CID version (CIDv0 or CIDv1)
31+
2. Hash algorithm
32+
3. Chunk size
33+
4. DAG width
34+
5. DAG layout
35+
6. Required
36+
37+
Additional profiles can be added at a future date. Profile names may be chosen from the names of any botanical tree with compound leaves.
38+
39+
| | Helia default | Kubo default | Storacha default | "test-cid-v1" profile | DASL |
40+
|-------------|---------------|-----------------------------|------------------|-----------------------|---------------|
41+
| CID version | CIDv1 | CIDv1 | CIDv1 | CIDv1 | CIDv1 |
42+
| Hash Algo | sha-256 | sha-256 | sha-256 | sha-256 | sha-256 |
43+
| Chunk size | 1MiB | 256KiB | 1MiB | 1MiB | not specified |
44+
| DAG width | 1024 | 174 (but it's complicated*) | 1024 | 174 | not specified |
45+
| DAG layout | balanced | balanced | balanced | balanced | not specified |
46+
47+
48+
49+
This would be specified as a table in (forthcoming UnixFS spec).
50+
51+
52+
53+
## Design rationale
54+
55+
The profile names are chosen to be easy to pronounce.
56+
57+
Here is a summary table of current defaults, thanks to input & clarifications from @2color @achingbrain @lidel:
58+
59+
| | Helia default | Kubo default | Storacha default | "test-cid-v1" profile | DASL |
60+
|-------------|---------------|-----------------------------|------------------|-----------------------|---------------|
61+
| CID version | CIDv1 | CIDv1 | CIDv1 | CIDv1 | CIDv1 |
62+
| Hash Algo | sha-256 | sha-256 | sha-256 | sha-256 | sha-256 |
63+
| Chunk size | 1MiB | 256KiB | 1MiB | 1MiB | not specified |
64+
| DAG width | 1024 | 174 (but it's complicated*) | 1024 | 174 | not specified |
65+
| DAG layout | balanced | balanced | balanced | balanced | not specified |
66+
67+
* Kubo has 2 different default DAG widths:
68+
* For HAMT-sharded directories, the `DefaultShardWidth` [here](https://github.com/ipfs/boxo/blob/f1d5312e3be45d151bb9c8f11c9283820687bea3/ipld/unixfs/io/directory.go#L30) is 256.
69+
* For files, `DefaultLinksPerBlock` [here](https://github.com/ipfs/boxo/blob/v0.29.0/ipld/unixfs/importer/helpers/helpers.go#L30) is ~174
70+
71+
See related discussion at https://discuss.ipfs.tech/t/should-we-profile-cids/18507/
72+
73+
### User benefit
74+
75+
Reliable, deterministic CIDs allow independent verification of content across tools and ipmlementations.
76+
77+
### Compatibility
78+
79+
Implementations will need to (1) make CID generation settings configurable and (2) support user setting of profiles.
80+
81+
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.
82+
83+
### Security
84+
85+
TODO
86+
87+
### Alternatives
88+
89+
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.
90+
91+
## Test fixtures
92+
93+
TODO
94+
95+
List relevant CIDs. Describe how implementations can use them to determine
96+
specification compliance. This section can be skipped if IPIP does not deal
97+
with the way IPFS handles content-addressed data, or the modified specification
98+
file already includes this information.
99+
100+
### Copyright
101+
102+
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

0 commit comments

Comments
 (0)