Open
Conversation
alanshaw
reviewed
Apr 10, 2026
ae7ff67 to
0e83477
Compare
761736f to
957aa1e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
from the README:
Context
Headless library for migrating Storacha content to Filecoin on Chain (FOC) without re-uploading data.
Filecoin storage providers pull your data directly from Storacha's storage via the Curio pull API. Your data never moves through your machine.
How it works
Migration runs in three sequential phases:
1. Reader — inventory
Walks every space on the Storacha client, paginates all uploads, and queries the indexing service to resolve shards:
pieceCID— required by the Filecoin storage providersourceURL— the URL the SP will pull from (resolved by the chosen strategy)sizeBytes— derived from the piece itselfThe result is a
SpaceInventoryper space: a structured list of every upload and its resolved shards, with counts and byte totals pre-computed.2. Planner — cost calculation and approval
Takes space inventories, creates one StorageContext per space per copy (each context binds a payer, provider, and on-chain dataset via the Synapse SDK), and computes the single USDFC deposit needed across all spaces. Returns a MigrationPlan the consumer can display for user approval before any on-chain action.
3. Migrator — execution
Executes the approved plan as an
AsyncGenerator. YieldsMigrationEventobjects the consumer handles at its own pace: persisting state to disk, displaying progress, logging failures.Each space is processed upload-by-upload in configurable batches. Each batch runs three stages:
sourceURL; pieces are partitioned into succeeded/failedState is checkpointed after every batch with at least one commit, enabling crash recovery.
Prerequisites
@storacha/clientinstance with access to the spaces to migrate@filoz/synapse-sdkSynapseinstanceInstallation