Cogni is a decentralized platform for storing, sharing, and retrieving AI models, datasets, and files using IPFS (InterPlanetary File System). Built for scalability, immutability, and global collaboration, Cogni leverages the power of IPFS to ensure reliable, tamper-proof data storage.
This guide provides comprehensive instructions on how to set up Cogni’s IPFS node, configure it, and interact with it using the terminal.
- About Cogni
- Installation Guide
- Basic IPFS Commands
- Advanced IPFS Commands
- Configuration Guide
- Setting Up a Custom Gateway
- Examples
- Useful Resources
Cogni is designed for AI developers, researchers, and innovators who need reliable, decentralized storage for their AI artifacts, including:
- AI Models: Store and retrieve large pre-trained models for machine learning and AI applications.
- Datasets: Host large datasets with content-based addressing for global accessibility.
- Metadata: Ensure reproducibility by sharing experiment results, metadata, and model versions.
By leveraging IPFS, Cogni ensures:
- Decentralization: No single point of failure.
- Immutability: Files are identified by their content, ensuring they remain unchanged.
- Global Collaboration: Anyone can retrieve and pin data using Cogni’s custom IPFS gateway.
-
Download IPFS CLI:
- Visit the Go-IPFS Releases page.
- Download the latest version for Windows (
go-ipfs_vX.XX.X_windows-amd64.zip). - Extract the ZIP file to a directory (e.g.,
C:\ipfs).
-
Add IPFS to PATH:
- Open Environment Variables and add the extracted IPFS folder (containing
ipfs.exe) to thePathvariable. - Open a new terminal and run:
If it returns the version number, the installation was successful.
ipfs --version
- Open Environment Variables and add the extracted IPFS folder (containing
-
Initialize IPFS:
ipfs init
-
Start the IPFS Daemon:
ipfs daemon
-
Download the IPFS binary:
wget https://dist.ipfs.io/go-ipfs/v0.40.0/go-ipfs_v0.40.0_linux-amd64.tar.gz
-
Extract and install IPFS:
tar -xvzf go-ipfs_v0.40.0_linux-amd64.tar.gz cd go-ipfs sudo bash install.sh -
Verify the installation:
ipfs --version
-
Initialize IPFS:
ipfs init
-
Start the IPFS daemon:
ipfs daemon
-
Install IPFS using Homebrew:
brew install ipfs
-
Initialize IPFS:
ipfs init
-
Start the IPFS daemon:
ipfs daemon
ipfs add <file_name>This will return a unique Content Identifier (CID) for the file. You can use this CID to retrieve the file later.
ipfs cat <CID>This retrieves and displays the content of the file with the given CID.
ipfs ls <CID>Lists the contents of a directory CID.
Pinning ensures that a file remains available on your node and isn’t removed during garbage collection.
ipfs pin add <CID>Unpinning a file allows it to be garbage collected.
ipfs pin rm <CID>ipfs pin lsView all connected peers in the IPFS network.
ipfs swarm peersDisplay your node’s network addresses.
ipfs idBy default, the IPFS API only listens on 127.0.0.1 (localhost). To allow remote access, modify the configuration file:
-
Open the configuration file located at:
~/.ipfs/config -
Find the
"API"section and update it:"API": "/ip4/0.0.0.0/tcp/5001"
-
Restart the IPFS daemon:
ipfs daemon
To set up a custom gateway for Cogni using your domain (e.g., ipfs.cogni.host), follow these steps:
-
Set up Nginx as a reverse proxy:
server { listen 80; server_name ipfs.cogni.host; location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }
-
Enable HTTPS with Let’s Encrypt:
sudo certbot --nginx -d ipfs.cogni.host
ipfs add ai_model.h5This will return a CID, which can be shared globally for retrieving the model.
ipfs cat <CID> > ai_model.h5ipfs pin add <dataset_CID>Feel free to contribute by submitting issues or pull requests to improve this guide!