Comfy-Org / Comfy-Org/ComfyUI

Feature Request: Add **IPFS Loader** Node – banish binary baggage, boost workflow portability

Open
#8,663 0 comments 0 reactions 0 assignees View on GitHub
Feature
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Feature Idea

## Summary

Introduce an **IPFS Loader** node that fetches any file addressed by an [IPFS](https://ipfs.tech) content identifier (CID) and streams it into ComfyUI’s graph. This empowers creators to share workflows that depend on external binary assets—custom checkpoints, LoRAs, VAEs, reference images—without bundling or manually downloading gigabytes of data. The `.json` workflow alone carries all the information needed; assets are pulled on‑demand from the decentralized IPFS network.

## Motivation

1. **One‑click reproducibility** – Run a workflow instantly; no asset‑hunting hurdles.
2. **Decentralized distribution** – Content‑addressed storage, community pinning, zero 404s.
3. **Lean repos, lighter commits** – Keep binaries out of Git; store immutable CIDs instead.
4. **Node‑centric philosophy** – Abstract asset fetches just like any other processing step.

## Proposed Design

| UI Field | Type | Description |
| ---------------------- | ------------- | ---------------------------------------------------- |
| **CID / URI** | text | Raw CID (`bafy…`) or `ipfs://` URI. |
| **Output Path** | optional text | Custom filename; defaults to `{cid}_{orig_name}`. |
| **Gateway (fallback)** | dropdown/text | First try local daemon; else selected HTTPS gateway. |
| **Pin?** | checkbox | Re‑pin file locally after download to aid sharing. |

**Implementation sketch** (Python):

```python
import ipfshttpclient
client = ipfshttpclient.connect() # /dns/localhost/tcp/5001/http
client.get(cid, target=output_path)
```

Fallback: stream via gateway `https://w3s.link/ipfs/{cid}` with progress callbacks.

**Outputs**

- `file_path` (str)
- `asset_bytes` (`io.BytesIO`) – optional in‑memory stream for downstream nodes.

## Example Workflow Snippet

```json
{
"IPFS_Load": {
"cid": "bafybeie7pmkw6q…nqa",
"pin": true
},
"CheckpointLoader": {
"ckpt_path": "@IPFS_Load.file_path"
}
}
```

## Potential Challenges

- **Availability** – IPFS assets remain online as long as at least one node pins them. For open‑source ComfyUI workflows, **web3.storage gives *****free, indefinite***** hosting** backed by Filecoin storage deals. The default allowance is roughly **5 GiB** storage plus egress, *but* projects that are clearly “doing good” can request extra room through the **Storage‑Limit Increase Request** form (linked throughout the docs).

- **Security** – Assets on web3.storage are world‑readable; never upload private or licensed checkpoints unless encrypted. While ComfyUI workflows already execute arbitrary Python, IPFS introduces a **supply‑chain risk**—a forked workflow could swap CIDs to poisoned models. Mitigations: embed the expected CID/SHA‑256 in the workflow, retrieve downloads into a sandbox directory and sanitize filenames, validate MIME/type and file size before loading.

- **Large Files** – Allow streamed downloads with a progress bar and configurable chunk/timeouts to prevent UI freezes, and warn users if an asset exceeds their predefined size limit before retrieval.

## Alternatives Considered

- Embedding base64 blobs inside workflow JSON (bloats file; not human‑friendly).
- Git LFS – centralized, requires auth, not peer‑to‑peer.

## Additional Context

- Mirrors patterns of the Hugging Face Hub Loader node—IPFS offers vendor‑agnostic, peer‑to‑peer power.
- Python clients: `ipfshttpclient`, `py-ipfs`; shell fallback via `subprocess`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.