bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 52쪽 중 22쪽
at is the whole qualification - you have CIDs today, and you want all of them on Filecoin Onchain Cloud, migrated efficiently and resumably rather than one upload at a time.
It is a one-time tool. Once the existing IPFS content you care about is on Filecoin Onchain Cloud, IPFS2FOC is no longer needed.
{% hint style="info" %}
If you have no existing pins and simply want to start storing content on Filecoin, you do not need IPFS2FOC. Go straight to [Filecoin Pin](/build-on-filecoin/cookbook/filecoin-pin).
{% endhint %}
### Primary use cases
* **Teams migrating pinning providers** - Built for teams offboarding from traditional pinning services. If your content is already public and addressable on IPFS, re-uploading everything one-by-one is inefficient, time-consuming, and may end up storing the content using different hashing algorithms, resulting in broken links. IPFS2FOC manages this process for you.
* **Projects with immutable CIDs** - Essential for projects where changing a content identifier is simply not an option, including:
* **NFT metadata and media** - Smart contracts referencing fixed IPFS URIs that cannot be edited.
* **Dataset releases and scientific archives** - Published research data that must remain byte-for-byte identical for citation and reproducibility.
* **Documentation sites and web apps** - Published links, static assets, and embeds that would break if re-hashed.
* **Permanent archives** - Long-term historical data where address stability is critical.
***
## IPFS2FOC and Filecoin Pin
These two tools are companions, and it is worth being precise about which does what.
| | IPFS2FOC | Filecoin Pin |
| ------------------- | ----------------------------------- | --------------------------- |
| **Purpose** | Move content already pinned on IPFS | Pin new content |
| **When you use it** | Once, during your transition | Every day, ongoing |
| **Input** | A list of CIDs you already have | Files you are uploading now |
The intended path is a single handoff:
1. Move your existing pins across with **IPFS2FOC**.
2. From that point forward, everything new goes through **Filecoin Pin**.
That handoff is being collapsed into one tool: as noted above, bulk migration is moving into the native `filecoin-pin migrate` subcommand.
***
## Where your content is fetched from
The migration reads each CID from an HTTPS gateway, and that gateway has to return content in a **verifiable** form - bytes that re-hash back to the CID being requested. A gateway that reassembles content into an ordinary file response cannot be used, because the storage provider re-validates what it receives before committing anything.
Support varies by pinning provider. Some serve the required format out of the box, some depend on per-bucket or per-account configuration, and one cannot be used as a source directly at all.
| Where your pins live today | Gateway to pass to `--gateway` | Works as a source? |
| -------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **Pinata** | `https://gateway.pinata.cloud` | Yes. Both the shared gateway and dedicated `*.mypinata.cloud` hostnames. |
| **Public IPFS network** | `https://trustless-gateway.link` | Yes. A public, no-account trustless gateway, and the tool's default. |
| **Filebase** | `https://<bucket>.myfilebase.com` | Depends on the bucket's gateway configuration - some buckets return reassembled files. Probe each bucket before you run. |
| **Storj** | A gateway-MT share link | Only with share links generated for raw or trustless linksharing. Default share links return landing pages and do not work. |
| **nft.storage (classic)** | `https://nftstorage.link` | Mixed. Behavior changed across their own migration, so probe the specific CIDs you care about. |
| **web3.storage (w3up)** | None per account | Not directly - there is no per-account gateway to target. You'll need to expose the same CIDs through a gateway you control. |
| **Self-hosted Kubo** | Your own HTTPS host | Yes, on a public hostname with valid TLS, with `Gateway.DeserializedResponses` set to `false`, and holding the CIDs locally. |
On w3up, your options are a self-hosted Kubo node, a Pinata account pinning the same CIDs, or `trustless-gateway.link` if the content is on the public IPFS network.
### Probe before you plan a run
Confirm a gateway serves your content before spending anything. Check a single CID with `ipfs2foc probe <cid> --gateway <url>`, or pre-flight a whole list with `ipfs2foc analyze --cids cids.txt --gateway <url>` to get a pass rate.
| Result | What it means |
| ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OK` | The gateway serves verifiable content for that CID. Use it - pass it with `--gateway` on every command in your run. |
| `WARN` | The gateway responded, but not with verifiable content. It cannot be a source - pick another row from the table above. |
| `FAIL` | The request did not complete at all. This covers everything from a DNS failure to a blocked TLS connection, and public gateways are not reachable from every network. Try another gateway before assuming your content is at fault. |
***
## How a migration works
Four stages, all driven by one command.
1. **Read** - For each CID, the tool fetches the content from a public IPFS gateway and computes its Filecoin piece commitment. Nothing is uploaded and nothing is charged at this stage; it is a measurement pass.
2. **Pack** - Many objects are bundled into larger pieces before any onchain commitments are made. This is what makes the migration affordable, as onchain cost scales with the number of *pieces*, not with the number of CIDs. Packing thousands of small IPFS files costs roughly the same in onchain confirmation fees as migrating a single file.
3. **Upload** - Your machine streams each packed piece directly to a storage provider. By default your data is stored across two storage providers for redundancy. The primary provider receives the initial upload directly from your machine, while the secondary provider automatically pulls its copy from the primary. The data is deleted from your local machine as soon as it is confirmed as stored with a Filecoin Onchain Cloud storage provider.
4. **Commit** - The new pieces are committed and recorded onchain in batches. Upon completion, the tool outputs a summary containing your Data Set IDs and direct Filecoin explorer links. Once committed, storage providers must continuously generate cryptographic Proofs of Data Possession (PDP) on a recurring schedule to remain eligible for automated onchain payment.
Data sets are created automatically during the run with IPFS indexing enabled, which is what keeps every original CID retrievable by its own identifier afterwards.
***
## Next steps
* [**Migrate from the command line**](/build-on-filecoin/cookbook/filecoin-pin/migrate-ipfs-pins/command-line) - the full walkthrough, from install through to onchain verification.
* [**Filecoin Pin**](/build-on-filecoin/cookbook/filecoin-pin) - where all your new uploads should go once the migration is done.
* [**IPFS2FOC on GitHub**](https://github.com/FilOzone/ipfs2foc) - source code and full command reference.
* [**IPFS to Filecoin**](https://filecoin.cloud/ipfs2filecoin) - check a CID list and estimate what a migration costs before you install anything.
# Migrate from the command line
Migrate your IPFS pins to Filecoin Onchain Cloud from the terminal with the ipfs2foc CLI. The recommended path for any serious migration.
The `ipfs2foc` CLI migrates your pins in a single command. It handles files of any size, scales to large inventories, and requires nothing about your machine to be reachable from the internet.
This is the recommended path for any serious migration.
{% hint style="info" %}
**`ipfs2foc` is a bridge.** This migration logic is actively being moved into a native `filecoin-pin migrate` subcommand. Everything on this page works today, but once that subcommand lands it becomes the supported path, and migrating will be one command inside the [Filecoin Pin](/build-on-filecoin/cookbook/filecoin-pin) tool you already use for new uploads.
{% endhint %}
***
## What you need
* **Node.js 24 or newer.** Check with `node --version`.
* **A wallet** with FIL for gas and USDFC for storage. You will export its private key, so use one kept for this purpose.
* **A list of CIDs** to migrate.
* **Content that is fetchable from an IPFS gateway.** Support varies by pinning provider - check [Where your content is fetched from](/build-on-filecoin/cookbook/filecoin-pin/migrate-ipfs-pins#where-your-content-is-fetched-from) for yours.
The walkthrough below takes one CID end to end on Filecoin Mainnet. By the end you'll have measured a piece, uploaded it, committed it onchain, and confirmed it with `report`.
***
## Step 1: Install
```bash
npm install -g ipfs2foc
```
Confirm the install:
```bash
npm ls -g ipfs2foc
```
{% hint style="success" %}
You should see `ipfs2foc@0.8.1` or later.
{% endhint %}
***
## Step 2: Set your signing key
Export the private key of a Filecoin wallet funded with FIL and USDFC on Filecoin Mainnet. The key must be `0x` followed by 64 hex characters:
```bash
export PRIVATE_KEY=0x<your-private-key>
```
Verify the format. This must print `66`:
```bash
echo ${#PRIVATE_KEY}
```
{% hint style="danger" %}
**This one key does everything.** It signs every transaction in the migration and authorizes spending from your deposited balance. Use a dedicated wallet funded with roughly what the migration needs. Never use a wallet holding significant funds, and never paste this key into a web page.
{% endhint %}
Keep this terminal open for the rest of the guide - the variable is lost when you close it.
***
## Step 3: Check your gateway
Before spending anything, confirm a gateway serves your content in the verifiable form the migration requires. Pick any one CID from your list:
```bash
ipfs2foc probe <cid> --gateway https://trustless-gateway.link
```
{% hint style="success" %}
A working gateway returns a line beginning `OK` and ending `deterministic`:
```
OK https://trustless-gateway.link — CAR 663286 bytes, sha256 86c15ec1…, deterministic
```
{% endhint %}
{% hint style="warning" %}
**Seeing `FAIL` or `fetch failed`? Try a different gateway before assuming your content is at fault.** Public gateways are not reachable from every network. Try your own pinning provider's gateway instead:
`ipfs2foc probe <cid> --gateway https://gateway.pinata.cloud`
{% endhint %}
Whichever gateway returns `OK` is the one to use - pass it with `--gateway` on every command below. For what `WARN` and `FAIL` each mean, and the gateway to use for your provider, see [Where your content is fetched from](/build-on-filecoin/cookbook/filecoin-pin/migrate-ipfs-pins#where-your-content-is-fetched-from).
***
## Step 4: Fund your account
Two currencies do two different jobs. **FIL** pays gas on your own transactions. **USDFC** pays storage providers.
Confirm you have a sufficient balance before going further:
```bash
npx filecoin-pin@latest payments status
```
You should see a positive USDFC balance with approvals in place.
{% hint style="warning" %}
**Deposit a comfortable margin.** If your balance or allowance falls short, the migration fails at the commit stage, and the error may not tell you how much more is needed.
{% endhint %}
***
## Step 5: Build your CID list
One CID per line in a plain text file. Blank lines and lines beginning with `#` are ignored:
```bash
cat > cids.txt <<'END'
# my site assets
bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku
END
```
***
## Step 6: Migrate
One command runs the whole migration:
```bash
ipfs2foc upload --cids cids.txt --car-store ./cars --db migrate.db \
--gateway https://trustless-gateway.link
```
| Flag | Purpose |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--cids` | Your list of CIDs. |
| `--car-store` | **Required.** A working directory where content is staged. Files are deleted as each piece is confirmed, so it stays near 1 GiB rather than growing to the size of your migration. |
| `--db` | Progress file, so an interrupted run resumes instead of restarting. |
| `--gateway` | The gateway you validated in step 3. |
{% hint style="danger" %}
**Do not press Ctrl+C.** Interrupting between upload and onchain confirmation can leave a piece in an unconfirmed state needing manual recovery. If the run seems stuck, let it time out.
{% endhint %}
### What you'll see
The run reads and measures your content, packs it, then uploads and commits.
{% hint style="success" %}
You should see something like:
```
registered 1 CID(s) from cids.txt
packed 1 multi-root CAR(s) under ./cars
direct upload to 2 provider(s): primary 4 (https://…), secondary 12 (https://…)
parked bafkzcib… (647.74 KiB) on primary 4 in 18.7s
parked bafkzcib… on secondary 12 (pulled from primary)
flush [batch] provider 4: committing 1 piece(s)
committed 1 piece(s) on provider 4 (data set 25983)
direct upload finished in 2m 1s: 647.74 KiB stored
```
{% endhint %}
It finishes with a JSON summary of the run.
To store a single copy instead of two - cheaper, less redundant - add `--copies 1`.
***
## Step 7: Confirm it landed
Reconcile your local record against what is actually onchain:
```bash
ipfs2foc report --db migrate.db --data-set-id <your-data-set-id>
```
The line that matters is the CID count.
{% hint style="success" %}
You should see something like:
```
CIDs: 1/1 committed on chain, 0 pending, 0 failed, 0 oversized
```
{% endhint %}
**When committed equals your total and failed is zero, your migration succeeded.**
{% hint style="info" %}
**A "not yet proven" warning here is expected.** Committing your data onchain and *proving* it is stored are two separate events. Providers prove possession on a recurring schedule, and the first proof after your migration can be up to a couple of hours away. The command also exits with a non-zero code while that is pending.
If your CID count reads fully committed with zero failures, you are done. Run the same command again later and the warning clears.
{% endhint %}
***
## Step 8: Verify retrieval
The whole point is that nothing about retrieval changes. Fetch one of your CIDs the way you always have:
```bash
curl -sL -o /dev/null -w "%{http_code}\n" \
"https://trustless-gateway.link/ipfs/<your-cid>"
```
`200` means your content still resolves by its original CID.
***
## Now switch to Filecoin Pin
Your existing pins are on Filecoin Onchain Cloud, and this migration is a one-time job.
**From here, use Filecoin Pin for everything new.** IPFS2FOC is built for moving a backlog, not for day-to-day uploads. [Filecoin Pin](/build-on-filecoin/cookbook/filecoin-pin) is the ongoing workflow: it pins new content, gives the same verifiable Filecoin persistence, and works with the standard IPFS tooling you already use.
***
## Related
* [About migrating IPFS pins](/build-on-filecoin/cookbook/filecoin-pin/migrate-ipfs-pins) - what IPFS2FOC is and how a migration works.
* [IPFS to Filecoin](https://filecoin.cloud/ipfs2filecoin) - check a CID list and estimate what a migration costs before you install anything.
# Filecoin Pin GitHub Action
Host a static website with Filecoin Pin using GitHub Actions
`filecoin-pin` can be used in CI pipelines like GitHub Actions to upload assets to the Filecoin decentralized storage network. Static website assets are particularly good candidates, given the existing tooling within the IPFS ecosystem for static website retrieval.
The [Filecoin Pin repo](https://github.com/filecoin-project/filecoin-pin) has an [example upload to Filecoin GitHub Action](https://github.com/filecoin-project/filecoin-pin/tree/master/upload-action) that can be used directly or as a starting point for your own CI pipeline.
The example filecoin-pin upload action itself has a [usage example](https://github.com/filecoin-project/filecoin-pin/tree/master/upload-action/examples), and you can even see it in production as part of [filecoin-pin-website's CI pipeline](https://github.com/filecoin-project/filecoin-pin-website/tree/main/.github/workflows)!
Below is also a video walkthrough of the example GitHub Action in use!
Note: there is more work coming soon to add "filecoin-pin functionality" directly to the robust [ipshipyard/ipfs-deploy-action](https://github.com/ipshipyard/ipfs-deploy-action) ([tracking issue](https://github.com/ipshipyard/ipfs-deploy-action/issues/39)).
# Filecoin Pin dApp Demo
See an example of Filecoin Pin working end to end within a web context.
## What You'll Build
In this walkthrough, you’ll build a simple drag-and-drop file uploader that:
* Stores IPFS files directly on Filecoin with built-in payments, all in browser!
* Tracks real-time upload progress through each step
* Retrieves data easily from IPFS Mainnet and the underlying Filecoin Service Provider
* Verifies persistent storage with on-chain Filecoin proofs
* Multi-user support with session-based authentication
* Seamlessly integrates with React, TypeScript, and Vite
## Walkthrough Recording
{% embed url="<https://www.youtube.com/embed/UElx1_qF12o?si=ppmzrl6psMRqwNQh>" %}
## Setup
We will start building by [forking the \*filecoin-pin-website demo repo](https://github.com/filecoin-project/filecoin-pin-website/fork).\* Make sure you have **Node.js 24+** and **npm 9+** installed. The dapp works with Filecoin Calibration testnet.
This will take \~10min. ⏲️
### Step 1: Fork, Clone, and Install Dependencies
```bash
# Fork the repo using the command below
# or visit [https://github.com/filecoin-project/filecoin-pin-website/fork](https://github.com/filecoin-project/filecoin-pin-website/fork)
gh repo fork filecoin-project/filecoin-pin-website
git clone https://github.com/YOUR-USERNAME/filecoin-pin-website.git
cd filecoin-pin-website
npm install
```
### **Step 2: Set Up Your Filecoin Wallet**
A Filecoin wallet is needed to send transactions on Filecoin and pay for the Filecoin storage service.
This demo dapp supports two authentication methods:
* **Private Key:** easiest for local development and learning.
* **Session Key:** recommended for production deployments - allows multiple users to share one wallet safely.
💡 The demo repo supports deployment with a shared session key, allowing multiple users to safely upload files using the same wallet. It has hardcoded DEFAULT\_WALLET\_ADDRESS and DEFAULT\_SESSION\_KEY that are ready to go, but please do NOT use it for production. You can override these defaults with env vars, see instructions [here](https://github.com/filecoin-project/filecoin-pin-website/blob/main/CONTRIBUTING.md#local-setup)!
**2.1 Get test FIL and test USDFC**
If you are using your own wallet, you need to get test FIL and test USDFC to pay for the Filecoin storage service and transactions.
1. Create or use an existing Filecoin wallet on the **Calibration testnet** ([such as MetaMask](/networks-and-tools/assets/metamask-setup)).
2. Visit the [Filecoin Calibration Faucet](https://faucet.calibnet.chainsafe-fil.io/funds.html) to get free test FIL (to pay for transaction gas).
3. Visit the [Filecoin USDFC faucet](https://forest-explorer.chainsafe.dev/faucet/calibnet_usdfc) to get test USDFC, which is a USD stablecoin backed by FIL that can be used to pay for services.
### **Step 3: Run Your dApp**
Fire up your local development server:
```bash
npm run dev
```
Visit `http://localhost:5173` and you should see your dApp running! That is all it takes t프로젝트로 돌아가기