Skip to content

feat: migrate off-chain storage 0G → IPFS and remove 0G entirely#52

Open
Skanislav wants to merge 9 commits into
devfrom
feat/ipfs-storage-migration
Open

feat: migrate off-chain storage 0G → IPFS and remove 0G entirely#52
Skanislav wants to merge 9 commits into
devfrom
feat/ipfs-storage-migration

Conversation

@Skanislav

Copy link
Copy Markdown
Contributor

Summary

Migrates the off-chain encrypted-storage substrate from 0G to IPFS across every layer, then removes 0G from the project entirely (the 0G relationship ended). Adds a local deploy script, round-trip test coverage, and sweeps all docs. The repo now tells one story: Sepolia + Mainnet, IPFS for storage.

Storage migration (0G → IPFS)

  • FrontenduseIpfsStorage (replaces useZgStorage) uploads via the indexer pin-proxy (POST /storage/pin), reads from VITE_IPFS_GATEWAY; threads a bytes32 contentHash (sha2-256 multihash of a CIDv0) instead of a 0G rootHash. @0gfoundation/0g-ts-sdk dropped, multiformats added.
  • Indexer — pin-proxy extracted to a Ponder-free src/api/storage.ts sub-app (Pinata + local-FS fallback, CORS).
  • SDKStorageClient/OrgClient/EventIndexer redesigned to content-addressing (putEncrypted→contentHash, getDecrypted(contentHash)); dropped the mutable KV model + append-only Log; new cid.ts helpers.

0G removed entirely

  • Chain target — removed zgTestnet/16602 from chains.ts, wagmi.ts, wagmi.config.ts, foundry.toml (RPC + Etherscan), the deploy:*:0g-* scripts, and the live 16602-infrastructure.json artifact. Bindings regenerated.
  • Specs/docsspecs/07 neutralized: 0G Compute → provider-neutral verifiable-compute, ERC-7857 INFT → ERC-8004 agent identity. PRD + contract/sdk docs restated to IPFS. Remaining 0G mentions are intentional changelog/historical notes only.

Deploy

scripts/deploy-ipfs.sh: preflight → build → omnipin pin → emits Safe setContenthash calldata (never submits; ENS update is human-signed).

Tests & verification

New round-trip coverage: useIpfsStorage (frontend) + in-process pin-proxy (indexer) + rewritten SDK specs. 195 tests pass (hola-modern 51, indexer 51, SDK 72, + others). Build, lint, and repo-wide check-types all green.

Follow-up (manual)

apps/hola-modern/.env.example still has a VITE_INDEXER_URL_0G= line — env files are permission-protected in the dev sandbox; remove it on merge.

🤖 Generated with Claude Code

Skanislav and others added 9 commits June 9, 2026 17:01
Frontend now uploads encrypted blobs through the indexer's IPFS pin-proxy
(POST /storage/pin) and reads them back from VITE_IPFS_GATEWAY, replacing the
0G Storage SDK path.

- hola-modern: add useIpfsStorage (replaces deleted useZgStorage); thread a
  bytes32 contentHash (sha2-256 multihash digest of a CIDv0) instead of a 0G
  rootHash through useEncryptedStorage + the OKR/role-content hooks. Drop the
  @0gfoundation/0g-ts-sdk dep and node-fs-promises shim; add multiformats.
- hollab-indexing: pin-proxy with Pinata (PINATA_JWT) and a local filesystem
  fallback (LOCAL_IPFS_DIR) + GET /ipfs/:cid dev gateway, global CORS.
- 0G stays a *chain* target only (zgTestnet 16602 bindings in wagmi.config +
  generated). Only the storage substrate moved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Local-only deploy path (no CI secrets): preflights env + omnipin, builds the
SPA (incl. dist/404.html), pins dist/ to IPFS, and emits the encoded
setContenthash(node, hash) calldata for a human-signed Safe transaction that
updates the hollab.eth ENS contenthash. Never submits on-chain.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Restate the off-chain storage substrate as IPFS across README, specs, and the
docs site, now that the shipped path is the indexer pin-proxy. Preserve 0G as a
*chain* target and the 0G Compute inference layer (specs/07 §5.5) — only
storage moved.

- README + specs/05: ContentRef resolves via an IPFS CIDv0 multihash digest.
- specs/07 (v2/descoped design): storage substrate restated to IPFS with a
  dated migration note; 0G Compute kept intact.
- apps/docs ops pages repointed at scripts/deploy-ipfs.sh (the documented
  deploy-ipfs.yml Action never existed).
- apps/docs sdk/intro pages rewritten to IPFS as the target. NOTE: the
  hollab-sdk StorageClient code is still 0G-based (StreamId/KV+Log) — docs
  intentionally lead the code here; SDK migration is a follow-up.
- sprint doc: dated 0G→IPFS migration note; historical refs left as record.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pins down the cross-component contract of the 0G→IPFS migration: the bytes32
contentHash equals the sha2-256 digest the indexer hashes into its CID, and a
read reconstructs the exact CIDv0 the indexer stored. Simulates the pin-proxy's
CID derivation with the same multiformats primitives (no network), plus guards
for short hashes and pin-proxy errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move POST /storage/pin + GET /ipfs/:cid out of api/index.ts (which imports
ponder:* virtual modules) into a Ponder-free src/api/storage.ts, mounted via
app.route. Adds test/storage.spec.ts: an in-process round-trip against a temp
filesystem (pin → deterministic CIDv0 → gateway read returns identical bytes),
content-addressing dedup, and guards (empty/oversize/malformed/unknown CID,
pinata-mode gateway disabled). 51 indexer tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Full redesign of the private-data layer onto content-addressed IPFS, so the SDK
matches the shipped frontend + indexer pin-proxy (resolving the docs-lead-code
gap from the earlier doc sweep).

- IStorageClient is now content-addressed: putEncrypted(value, key) → bytes32
  contentHash; getDecrypted(contentHash, key) → bytes. Dropped the mutable
  (streamId, key) KV model and the append-only Log (the Ponder indexer is the
  queryable audit trail).
- StorageClient talks to the pin-proxy over fetch (POST /storage/pin, GET
  gateway/ipfs/<cid>), encrypting client-side; new lib/storage/cid.ts does the
  CIDv0 ⇄ bytes32 conversion (mirrors useIpfsStorage). Lib-agnostic FetchLike
  type so the SDK needs no DOM lib. Added multiformats dep.
- OrgClient set* now return a contentHash the caller persists on-chain; get*
  take one. shareCircle/RoleKey lose the recipientAddress (addressing) param.
- EventIndexer drops the storageClient dependency entirely (no more appendLog).
- Removed ZeroGKvClient/ZeroGLogClient/StorageConfig/LogEntry exports; added
  ContentHash/IpfsStorageConfig. Rewrote storageClient/orgClient/eventIndexer
  specs. 72 SDK tests pass; tsc + build + lint green. No downstream consumers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
StorageClient is now (keyManager, IpfsStorageConfig); document the
content-addressed put/get contract.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The 0G integration was one ecosystem bet — storage (already migrated to IPFS)
plus a chain deployment target. With the 0G relationship over, remove the chain
target too so the repo tells one story: Sepolia + Mainnet.

- Frontend: remove zgTestnet chain def + config from chains.ts/wagmi.ts.
- Contracts: drop 0g-testnet/0g-mainnet rpc_endpoints + etherscan entries from
  foundry.toml, the deploy:*:0g-* scripts, the DeployInfrastructure docblock
  line, and the live 16602-infrastructure.json artifact. Regenerated bindings
  (no 16602 addresses / 0G explorer links).
- CLAUDE.md: multi-chain line + deploy-target list now Sepolia + Mainnet only.

NOTE: apps/hola-modern/.env.example still has a VITE_INDEXER_URL_0G= line
(env files are permission-protected here) — remove it manually. specs/07 still
carries the 0G Compute v2 narrative; neutralize separately if desired.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With 0G fully out (storage → IPFS, chain target dropped), strip the last 0G
specifics from the design docs so the repo is vendor-neutral:

- specs/07: 0G Compute → provider-neutral "verifiable compute"; ERC-7857 INFT
  agent identity → ERC-8004 (the shipped standard). Header note records the
  full 0G removal.
- PRD public-private-tensions + meeting-factory/agent-sdk docs: 0G storage
  transport → IPFS.
- sprint log: update the migration note (0G chain target now also dropped).
- Remove an accidentally-tracked vocs build artifact.

Remaining 0G mentions are intentional changelog/historical notes only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Skanislav

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-06-10 at 19 56 36

it aint started lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant