skills/blockchain/ipfs/SKILL.md
IPFS is a peer-to-peer protocol for decentralized storage and sharing of files in a distributed network.
npx skillsauth add alphaonedev/openclaw-graph ipfsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
IPFS (InterPlanetary File System) is a peer-to-peer protocol for storing and sharing files in a decentralized network, ensuring data persistence without central servers.
Use IPFS when building applications that require distributed storage for resilience, such as blockchain data archiving, peer-to-peer file sharing, or content delivery in unreliable networks. Apply it for scenarios involving large files or censorship-resistant data, like NFT metadata storage or decentralized apps.
ipfs config Addresses.Swarm --json '["/ip4/0.0.0.0/tcp/4001"]'.ipfs dag put to add a DAG node.ipfs pin add <CID> to prevent garbage collection.To add a file, run ipfs add path/to/file.txt from CLI, then reference it by CID. In code, use the Go IPFS library: import "github.com/ipfs/go-ipfs-api" and call sh := shell.NewShell("localhost:5001"); cid, err := sh.Add(strings.NewReader("data")). In scripts, wrap commands in try-catch for errors, e.g., check if the daemon is running with ipfs daemon first. For API calls, use HTTP endpoints like POST /api/v0/add with multipart form data.
ipfs add -r /path/to/dir (recursive flag for directories); API: POST /api/v0/add with body containing the file.ipfs cat <CID> to output to stdout; API: GET /api/v0/cat?arg=<CID>.ipfs pin ls --type=recursive; use with --enc=json for JSON output.ipfs config --json Datastore.StorageMax "10GB" to set storage limits; config file is JSON at ~/.ipfs/config.ipfs daemon --enable-pubsub for pubsub features; if API keys are needed (e.g., for enterprise gateways), set env var like export IPFS_API_KEY=$SERVICE_API_KEY and include in headers.
Code snippet for adding via curl:curl -X POST -F [email protected] http://localhost:5001/api/v0/add
Code snippet for Go:cid, err := sh.AddFile("/path/to/file.txt")Integrate IPFS with other tools by running the daemon locally or using public gateways (e.g., https://ipfs.io/ipfs/<CID>). For blockchain, link with Ethereum via IPFS for storing contract metadata; use web3.js to fetch CIDs. Set API endpoint in code: shell.NewShell("http://$IPFS_GATEWAY:5001") where $IPFS_GATEWAY is an env var. For authentication, if using a private API, add headers like Authorization: Bearer $IPFS_API_KEY. Handle multi-network setups by specifying swarm addresses in config, e.g., add ipfs bootstrap add /ip4/1.2.3.4/tcp/4001/ipfs/Qm... for custom peers.
Check for common errors like "daemon not running" by verifying with ipfs id first; if it fails, start with ipfs daemon. For network issues, use ipfs swarm connect /ip4/host/tcp/port to manually connect peers. Parse API errors: responses include JSON with "Message" field, e.g., {"Message": "file not found"}. In code, handle with:
if err != nil { log.Fatal(err) } after sh.Add(). For permission errors, ensure $IPFS_API_KEY is set and valid; retry with exponential backoff for transient failures. Validate CIDs before operations using ipfs validate <CID>.
ipfs add contract.json outputs a CID like Qmabcd. Store this CID in a smart contract. In Node.js:const ipfsApi = require('ipfs-api'); const ipfs = ipfsApi('localhost', '5001', {protocol: 'http'}); ipfs.add(Buffer.from('contract data')).then(response => console.log(response[0].hash));ipfs get Qmabcd -o output.txt. In a script, verify integrity: ipfs cat Qmabcd | sha256sum to match the original hash. For distributed apps, use in a loop: fetch multiple CIDs and handle missing ones with try-catch.tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui