IPFS Network¶
How TruSpace uses IPFS for decentralized storage.
What is IPFS?¶
IPFS (InterPlanetary File System) is a peer-to-peer protocol for storing and sharing data in a distributed file system.
Content Addressing¶
Instead of location-based URLs, IPFS uses Content IDs (CIDs) - hashes of the content itself:
This means: - Same content = same CID everywhere - Content can be fetched from any peer - Built-in integrity verification
TruSpace IPFS Architecture¶
flowchart LR
subgraph Node1["TruSpace Node 1"]
I1[IPFS Node]
C1[IPFS Cluster]
end
subgraph Node2["TruSpace Node 2"]
I2[IPFS Node]
C2[IPFS Cluster]
end
I1 <-->|Bitswap| I2
C1 <-->|CRDT Sync| C2
IPFS Cluster¶
IPFS Cluster coordinates pinning across multiple nodes:
- Automatic replication: Content pinned on one node replicates to others
- Consensus: CRDT-based for availability over consistency
- Pin management: Track what should be stored where
Connecting Nodes¶
Automatic Connection¶
# Generate connection details on Node A
./scripts/fetch-connection.sh -e
# Connect from Node B
./scripts/connectPeer-automatic.sh .connection .connection.password
Manual Connection¶
./scripts/connectPeer-manually.sh \
<peer_ip> \
<ipfs_peer_id> \
<cluster_peer_id> \
<ipfs_container> \
<cluster_container>
Private Networks¶
For private deployments:
- Generate a swarm key
- Share only with trusted peers
- Configure IPFS to use private mode
Data Flow¶
Upload¶
- Document encrypted by backend
- Added to local IPFS node → CID generated
- Cluster pins the content
- Replicates to connected peers
Retrieval¶
- Request by CID
- Local check first
- If not found, fetch from peers
- Decrypt and serve to user
Configuration¶
Key IPFS settings in environment: