How To Share Files On IPFS: A Practical Guide To Decentralized File Sharing

How To Share Files On IPFS: A Practical Guide To Decentralized File Sharing

 

Internet runs on location-based addressing, when you visit a website, your browser asks a server at a specific IP address for a file at a specific path. It works, but it creates a fundamental vulnerability: the file only exists as long as that server exists. Change the server, break the link. Take the server down, lose the file.

IPFS — the InterPlanetary File System — takes a different approach. Instead of asking “where is this file?”, it asks “what is this file?”. The answer is a cryptographic hash called a Content Identifier (CID). Share the CID, and anyone on the IPFS network can retrieve the file from whichever peer happens to have it.

This guide walks through the practical steps of sharing files on IPFS, explains the underlying mechanics, and compares IPFS-based sharing with traditional methods like HTTP downloads, BitTorrent, and cloud storage links.

What Is IPFS?

IPFS is a distributed, peer-to-peer protocol for storing and sharing files. Think of it as a single, global filesystem that every peer contributes to and can access — without a central server. 

Key properties:

  • Content-addressed — files are identified by their cryptographic hash (CID), not their location
  • Decentralized — no single point of failure; files can be served by any peer that has them
  • Versioned — like Git for files, IPFS tracks changes and history
  • Resilient — data persists as long as at least one peer on the network hosts it

IPFS vs Traditional File Sharing

 
Dimension IPFS HTTP/HTTPS BitTorrent Cloud Storage (Google Drive, Dropbox)
Addressing Content-based (CID) Location-based (URL) Infohash (similar to content-addressing) Location-based (URL + auth)
Central point of failure No — any peer can serve Yes — server must be online No — swarm-based Yes — provider controls access
Link permanence Permanent as long as data is pinned Broken if server moves or deletes Permanent as long as swarm exists Broken if file is deleted or sharing expires
Privacy (default) Public — anyone with CID can retrieve Depends on server config Public — anyone with torrent/magnet can download Granular access controls
Speed Depends on peer proximity and replication Server bandwidth-bound Swarm-scaled — more peers = faster Provider CDN-scaled
Offline-first Yes — data can be shared locally between peers without internet No Partially — P2P but requires tracker/DHT No
Setup complexity Moderate (install IPFS software) Zero (browser-based) Moderate (torrent client) Zero (web-based)

How IPFS File Sharing Works

The core innovation in IPFS is content addressing. In HTTP, you request:

GET https://example.com/images/photo.jpg

This is location-based: the server at example.com has a file at the path /images/photo.jpg. If the server goes down, the file is unreachable. If someone modifies photo.jpg, you can’t tell — the URL is the same.

In IPFS, you request:

GET /ipfs/QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco

That string — QmXo...6uco — is the Content Identifier (CID), a cryptographic hash of the file’s content. It’s generated using the SHA-256 algorithm. Two properties make this powerful:

  1. Immutability — if the file changes, the hash changes, generating a new CID. The old CID still points to the old file.
  2. Verifiability — anyone can hash the file they receive and confirm it matches the CID. No tampering, no MITM attacks.

The Node Network

An IPFS node is simply a machine running IPFS software and connected to the network. When you upload a file to IPFS:

  1. The file is split into smaller chunks (typically 256 KB each)
  2. Each chunk is hashed, and a Merkle DAG (Directed Acyclic Graph) is built linking them together
  3. The root hash of this DAG becomes the file’s CID
  4. Your node announces to the network that it has this CID
  5. Other nodes can request the CID and retrieve chunks from your node (or any other node that has them)

If your node goes offline, the file may become unreachable — unless another node has pinned it. Pinning tells your node to keep a file and serve it to others. Services like Pinata, Filebase, and Web3.storage (now Storacha, covered in a previous article) offer pinning as a service.


Step-By-Step: Sharing A File On IPFS

Prerequisites

  • A computer (Windows, macOS, or Linux)
  • The IPFS Desktop application or Kubo CLI

Step 1: Install IPFS Software

Option A: IPFS Desktop (recommended for beginners)

  1. Visit https://docs.ipfs.tech/install/ipfs-desktop/
  2. Download the installer for your operating system
  3. Run the installer and follow the prompts
  4. Launch IPFS Desktop — it starts a local IPFS node automatically

Option B: Kubo CLI (for developers)

# macOS (Homebrew)
brew install ipfs

# Linux (binary download)
wget https://dist.ipfs.tech/kubo/v0.29.0/kubo_v0.29.0_linux-amd64.tar.gz
tar -xvzf kubo_v0.29.0_linux-amd64.tar.gz
cd kubo
sudo bash install.sh
ipfs init
ipfs daemon

Step 2: Import A File

With IPFS Desktop:

  1. Open IPFS Desktop
  2. Navigate to the Files tab in the left sidebar
  3. Click Import → select a file from your local system
  4. A green checkmark confirms the file is uploaded and available on your node

With the CLI:

ipfs add myfile.pdf
# Returns: added QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco myfile.pdf

The string QmXo...6uco is the file’s CID.

Step 3: Share The File

You have three options:

Option 1: Share the CID directly

Send the CID to someone. They can retrieve the file using:

ipfs get QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco

Or via the IPFS Desktop (Files → Import → From IPFS).

Option 2: Share an IPFS gateway link

An IPFS gateway translates IPFS content to HTTP. The most common is:

https://ipfs.io/ipfs/QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco

Public gateways include:

  • https://ipfs.io/ipfs/<CID>
  • https://cloudflare-ipfs.com/ipfs/<CID>
  • https://dweb.link/ipfs/<CID>

Note: Gateway links are convenience only. The gateway provider can block or throttle access. For true decentralization, use the CID directly.

Option 3: Use IPNS (InterPlanetary Name System)

CIDs change when files change. IPNS assigns a mutable pointer (a peer ID) that you can update to point to a new CID while keeping the same shareable identifier.

ipfs name publish QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco
# Returns: Published to k51qzi5uqu5d... : /ipfs/QmXoy...

Now share /ipns/k51qzi5uqu5d... instead — you can repoint it later without breaking links.

Step 4: Ensure Availability Via Pinning

By default, your file is only available while your node is online. For permanent availability:

  • Pin it yourself — IPFS Desktop automatically pins imported files by default
  • Use a pinning service — Pinata, Filebase, Storacha, and others offer paid pinning
  • Use a public pinning cluster — Services like dWeb’s Pinning Cluster or Protocol Labs’ ipfs-cluster
# Check if file is pinned
ipfs pin ls | grep QmXo...

Encryption: A Critical Note

IPFS is a public network by default. Anyone with the CID can retrieve the file. It’s not encrypted at the protocol level.

For private file sharing, you need to encrypt the file before uploading to IPFS:

Option 1: Asymmetric encryption (PGP-style)

  1. Encrypt the file with the recipient’s public key before uploading
  2. Upload the encrypted file to IPFS
  3. Share the CID with the recipient
  4. Only the recipient can decrypt with their private key
# Encrypt with recipient's public key
gpg --encrypt --recipient recipient@example.com myfile.pdf
# This creates myfile.pdf.gpg

# Upload encrypted file to IPFS
ipfs add myfile.pdf.gpg
# Returns CID of encrypted file — safe to share publicly

Option 2: Symmetric encryption (shared secret)

# Encrypt with AES-256
openssl enc -aes-256-cbc -salt -in myfile.pdf -out myfile.pdf.enc
# You'll be prompted for a password

# Upload to IPFS
ipfs add myfile.pdf.enc
# Share both the CID and the password (via a different channel!)

This is a critical point that beginners often miss: IPFS provides content addressing and decentralization, not privacy. If you’re sharing sensitive documents, always encrypt before uploading.


Real-World Use Cases

IPFS file sharing is already powering production workflows:

  • NFT metadata — Nearly all major NFT projects (Bored Ape Yacht Club, Art Blocks, etc.) store metadata and images on IPFS via pinning services
  • Decentralized websites — Unstoppable Domains and ENS use IPFS (via IPNS) to host websites that can’t be censored at the DNS level
  • Scientific data — CERN, the Internet Archive, and academic institutions use IPFS for large dataset distribution
  • Supply chain — Pharmaceutical and food supply chains use IPFS to share provenance data across partners without central infrastructure
  • Mesh networking — IPFS works offline, making it viable for disaster response and disconnected environments

Limitations And Considerations

Availability requires pinning. IPFS is not a permanent storage solution out of the box. If nobody pins your file, it disappears when your node goes offline. You need a pinning strategy (self-hosted or paid service).

No built-in access control. IPFS is public. If you need private sharing, you must add encryption on top. This adds complexity for non-technical users.

Gateway centralization. Many users access IPFS through HTTP gateways (ipfs.io, cloudflare-ipfs.com). This reintroduces the centralization IPFS was designed to avoid. Always prefer direct node connections when possible.

CID management. CIDs are long and unfriendly. IPNS helps, but the ecosystem around human-readable naming (ENS, DNSLink) is still maturing.

Performance. First-time retrievals can be slow if no nearby peer has the content. Content discovery over the DHT (Distributed Hash Table) adds latency compared to a CDN hit.


IPFS vs. The Alternatives — Choosing Your Tool

Need Best Fit
“I want to share a file with a friend quickly” Google Drive, Dropbox, or Magic Wormhole
“I want to share a large file with many people” BitTorrent (torrent file or magnet link)
“I want verifiable, tamper-proof content distribution” IPFS
“I want permanent archival storage” IPFS + Filecoin or Arweave
“I want private file sharing with specific people” Encrypted IPFS or Signal/Firefox Send
“I want a website that can’t be taken down” IPFS + IPNS + ENS/DNSLink

Where To Go From Here

Blockcritics Alerts / Sign-up to get alerts on hackathons, new products, apps, contracts, protocols and breakthroughs in web 3.0.