Bridge IPFS content to Filecoin Onchain Cloud using familiar tools.
Filecoin Pin provides two ways to store data on Filecoin:
- IPFS Pinning Service - Use
ipfs pin remote
commands to pin content to Filecoin - Direct CAR Import - Upload existing CAR files directly to Filecoin
Both methods use Synapse SDK to handle Filecoin storage deals, providing persistent storage with cryptographic proofs.
Requires Node.js 24+
npm install -g filecoin-pin
Before storing data, configure your Filecoin payment approvals:
# Check your current payment status
filecoin-pin payments status
# Interactive setup (recommended)
filecoin-pin payments setup
# Or automated setup
filecoin-pin payments setup --deposit 100 --storage 10TiB --auto
You'll need:
- A private key with USDFC tokens on Calibration testnet
- Get test USDFC from the faucet
# Start the daemon
PRIVATE_KEY=0x... filecoin-pin daemon
# In another terminal, configure IPFS
ipfs pin remote service add filecoin http://localhost:3456 any-token
# Pin content
ipfs pin remote add --service=filecoin QmYourCID
# Import a CAR file
filecoin-pin import /path/to/file.car --private-key 0x...
Runs the IPFS Pinning Service API server.
Options:
--port <number>
- Server port (default: 3456)--host <string>
- Server host (default: localhost)--database <path>
- SQLite database location--car-storage <path>
- CAR file storage directory
Check payment configuration and balances.
Options:
--private-key <key>
- Ethereum private key--rpc-url <url>
- Filecoin RPC endpoint
Configure payment approvals for Filecoin storage.
Options:
--private-key <key>
- Ethereum private key--rpc-url <url>
- Filecoin RPC endpoint--deposit <amount>
- USDFC amount to deposit--storage <size>
- Storage allowance (e.g., "10TiB" or "5000" for USDFC/epoch)--auto
- Run without prompts
Import an existing CAR file to Filecoin.
Options:
--private-key <key>
- Ethereum private key--rpc-url <url>
- Filecoin RPC endpoint
Output includes:
- Piece CID for retrieval
- Storage provider details
- Direct download URL
# Required for daemon
PRIVATE_KEY=0x... # Ethereum private key with USDFC
# Optional
RPC_URL=wss://... # Filecoin RPC (default: calibration websocket)
PORT=3456 # Daemon port
DATABASE_PATH=./pins.db # SQLite database
CAR_STORAGE_PATH=./cars # CAR file directory
LOG_LEVEL=info # Logging level
When not specified, data is stored in:
- Linux:
~/.local/share/filecoin-pin/
- macOS:
~/Library/Application Support/filecoin-pin/
- Windows:
%APPDATA%/filecoin-pin/
- Receive pin request from IPFS
- Create CAR file with root CID
- Fetch blocks via Bitswap
- Stream blocks directly to CAR
- Upload CAR to Synapse
- Return Filecoin piece CID
- Validate CAR file format
- Extract root CIDs
- Upload to Synapse
- Display storage provider info
# Clone and install
git clone https://github.com/filecoin-project/filecoin-pin
cd filecoin-pin
npm install
# Run development server
npm run dev
# Run tests
npm test
# Build for production
npm run build
npm run test # All tests
npm run test:unit # Unit tests only
npm run test:integration # Integration tests
npm run lint:fix # Fix formatting
This project includes comprehensive examples for integrating with the Synapse SDK. See the src/synapse
directory for:
- Service initialization with lifecycle management
- Upload patterns for CAR files with progress tracking
- Payment operations including deposits and approvals
- Production patterns for error handling and resource cleanup
These examples demonstrate best practices for building applications on Filecoin Onchain Cloud.
Dual-licensed under MIT + Apache 2.0