-
Notifications
You must be signed in to change notification settings - Fork 462
Add caveat about CID determinism #2217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+83
−11
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f2638c1
Add caveat about CID determinism
mishmosh 5d92167
Update how-ipfs-works.md
mishmosh a05e982
Merge branch 'main' into cid-clarifications
lidel 77dd841
docs: explain why CIDs are not file hashes
lidel 9c8406c
chore: add buzhash, codecs, deduplication to pln-ignore.txt
lidel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Vale Styles | ||
|
|
||
| This directory contains Vale linting configuration for ipfs-docs. | ||
|
|
||
| ## Spelling Rules | ||
|
|
||
| There are two spelling systems: | ||
|
|
||
| 1. **`Vocab/ipfs-docs-vocab/accept.txt`** - General Vale vocabulary | ||
| 2. **`pln-ignore.txt`** - Custom ignore file for `docs/PLNSpelling.yml` | ||
|
|
||
| ### Fixing PLNSpelling Errors | ||
|
|
||
| When CI fails with `[docs.PLNSpelling] Did you really mean 'word'?`: | ||
|
|
||
| 1. Add the word to **`pln-ignore.txt`** (lowercase) | ||
| 2. Do NOT add to `Vocab/accept.txt` - that file is for other Vale rules | ||
|
|
||
| The `PLNSpelling.yml` rule explicitly references `pln-ignore.txt`: | ||
|
|
||
| ```yaml | ||
| extends: spelling | ||
| ignore: | ||
| - pln-ignore.txt | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,22 +122,22 @@ Each method will return a **CID** (Content Identifier) for your uploaded file. S | |
|
|
||
| ## CIDs explained | ||
|
|
||
| In IPFS, every file and directory is identified with a Content Identifier ([CID](../concepts/content-addressing.md)). The CID serves as the **permanent address** of the file and can be used by anyone to find it on the IPFS network. | ||
| In IPFS, every file and directory is identified with a Content Identifier ([CID](../concepts/content-addressing.md)), a unique hash derived from the file's contents. The CID serves as the **permanent address** of the file and can be used by anyone to find it on any IPFS network or system. | ||
|
|
||
| When a file is first added to an IPFS node (like the image used in this guide), it's first transformed into a content-addressable representation in which the file is split into smaller chunks (if above ~1MB) which are linked together and hashed to produce the CID. | ||
| When you add a file to IPFS, the system generates its CID by hashing the contents. Larger files (above ~1MB) are split into smaller chunks, linked together, and hashed. | ||
|
|
||
| For example, a CID might look like: | ||
| The resulting CID might look like this: | ||
|
|
||
| ```plaintext | ||
| bafybeicn7i3soqdgr7dwnrwytgq4zxy7a5jpkizrvhm5mv6bgjd32wm3q4 | ||
| ``` | ||
|
|
||
| You can now share the CID with anyone and they can fetch the file using IPFS. | ||
| Once you have a CID, you can share it with anyone and they can fetch the file using IPFS. | ||
lidel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| To dive deeper into the anatomy of the CID, check out the [CID inspector](https://cid.ipfs.tech/#bafybeicn7i3soqdgr7dwnrwytgq4zxy7a5jpkizrvhm5mv6bgjd32wm3q4). | ||
| To explore the anatomy of a CID, check out the [CID Inspector](https://cid.ipfs.tech/#bafybeicn7i3soqdgr7dwnrwytgq4zxy7a5jpkizrvhm5mv6bgjd32wm3q4). To explore the anatomy of the DAG behind a CID, check out the [DAG Explorer](https://explore.ipld.io/#/explore/bafybeicn7i3soqdgr7dwnrwytgq4zxy7a5jpkizrvhm5mv6bgjd32wm3q4). | ||
|
|
||
| :::callout | ||
| The transformation into a content-addressable representation is a local operation that doesn't require any network connectivity. Many CLI tools perform this transformation locally before uploading. | ||
| **Important caveat:** Two identical files can produce different CIDs. The CID reflects the contents *and* how the file is processed: chunk size, DAG layout, hash algorithm, CID version, and other [UnixFS](https://specs.ipfs.tech/unixfs/) parameters. The same file processed with different parameters will produce different CIDs. See [CIDs are not file hashes](../concepts/content-addressing.md#cids-are-not-file-hashes) for details. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ we already had "CIDs are not file hashes" content elsewhere, so adjusted this to link there + expanded there |
||
| ::: | ||
|
|
||
| ## Retrieving with a gateway | ||
|
|
@@ -167,6 +167,8 @@ curl https://[BUCKET_NAME].ipfs.filebase.io/ipfs/[CID] | |
|
|
||
| ### Using public gateways | ||
|
|
||
| You can also use [public IPFS gateways](../concepts/public-utilities.md#public-ipfs-gateways): | ||
|
|
||
| ```shell | ||
| curl https://ipfs.io/ipfs/[CID] | ||
| # or | ||
|
|
@@ -192,4 +194,4 @@ Possible next steps include: | |
| - [Storacha CLI documentation](https://docs.storacha.network/cli/) | ||
| - [Pinata API documentation](https://docs.pinata.cloud/) | ||
| - [Filebase S3 API guide](https://docs.filebase.com/api-documentation/s3-compatible-api) | ||
| - [Filebase IPFS RPC API](https://docs.filebase.com/api-documentation/ipfs-rpc-api) | ||
| - [Filebase IPFS RPC API](https://docs.filebase.com/api-documentation/ipfs-rpc-api) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mishmosh @aschmahmann does this extra explainer sound good?
The main point I want to make here is that this is a feature, not a limitation. And at the end we mention community-provided profiles for cases where specific preset is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks for the add.