Skip to content

Feat: Adding Arweave storage via AR.IO Network#12

Open
kempsterrrr wants to merge 24 commits intoagent0lab:mainfrom
kempsterrrr:feat/ario-storage
Open

Feat: Adding Arweave storage via AR.IO Network#12
kempsterrrr wants to merge 24 commits intoagent0lab:mainfrom
kempsterrrr:feat/ario-storage

Conversation

@kempsterrrr
Copy link

Adds permanent storage option for agent registrations and feedback using Arweave via AR.IO Network's Turbo SDK.

What's new:

  • Agent.registerArweave() - Register agents with permanent Arweave storage
  • ArweaveClient - Upload and retrieve data from Arweave with parallel gateway fallback
  • Arweave-first feedback storage with IPFS fallback
  • Comprehensive tagging for searchability (12 tags for registrations, 7-14 for feedback)
  • Shared utilities - formatRegistrationFileForStorage() ensures consistent ERC-8004 formatting across both IPFS and Arweave

Usage

const sdk = new SDK({
  chainId: 11155111,
  rpcUrl: 'https://...',
  signer: privateKey,
  arweave: true, // Enable Arweave storage
});
await agent.registerArweave();

Key features

  • Free uploads <100KB via Turbo SDK (typical files: 1-4KB)
  • EVM signatures only (no Arweave JWK needed)
  • Parallel 4-gateway retrieval for reliability
  • Complete parity with IPFS implementation
  • No breaking changes (opt-in via config)
  • No code duplication between storage layers

Files changed

21 files: 5,807 additions, 288 deletions

  • 6 new files (ArweaveClient, utilities, tests)
  • Updated SDK, Agent, FeedbackManager
  • 46 unit tests added (all passing)

Dependencies

Added: @ardrive/turbo-sdk (^1.23.0)

William Kempster added 20 commits November 17, 2025 16:23
Phase 1 of Arweave integration - DRY principle implementation.

- Create src/utils/registration-format.ts with formatRegistrationFileForStorage()
- Refactor IPFSClient.addRegistrationFile() to use shared utility
- Reduces code duplication, preparing for ArweaveClient implementation
- No functional changes, pure refactoring

The shared utility will be used by both IPFSClient and ArweaveClient
to ensure consistent ERC-8004 formatting across storage backends.
…rieval

Phase 2 of Arweave integration - core client implementation.

- Add ArweaveClient class with Turbo SDK for uploads and parallel gateway fallback for retrieval
- Implement upload methods: add(), addJson(), addRegistrationFile()
- Implement retrieval methods: get(), getJson(), getRegistrationFile()
- Use EthereumSigner for EVM-based authentication
- Match IPFSClient pattern with Promise.allSettled for gateway fallback
- Add ARWEAVE_GATEWAYS constant with 4 gateway URLs
- Add ARWEAVE_GATEWAY and ARWEAVE_UPLOAD timeout constants
- Install @ardrive/turbo-sdk dependency (268 packages)
- Export registration-format utility

Files created: src/core/arweave-client.ts (177 lines)
Files modified: src/utils/constants.ts, src/utils/index.ts, package.json
Add Arweave storage support to SDK class with configuration, initialization,
and ar:// URI handling in registration file loading.

Changes:
- Add Arweave config fields to SDKConfig (arweave, arweavePrivateKey, arweaveToken, arweaveTestnet)
- Add _arweaveClient property and initialization in constructor
- Add _initializeArweaveClient() method (reuses signer or separate key)
- Update _loadRegistrationFile() to handle ar:// URIs with parallel gateway fallback
- Add arweaveClient getter for public access
- Import ArweaveClient and ARWEAVE_GATEWAYS constants

Implementation follows same pattern as IPFS integration for architectural
consistency. Uses ArweaveClient for parallel gateway fallback when configured,
falls back to direct arweave.net fetch otherwise.
- Add registerArweave() method to Agent class (lines 367-458)
- Export ArweaveClient and ArweaveClientConfig in src/index.ts
- Update ARWEAVE_INTEGRATION_PLAN.md with completion status

Follows identical pattern to registerIPFS() for consistency.
Handles both first-time registration and updates to existing agents.
Add test suite for Arweave storage functionality:

- Unit tests for shared ERC-8004 formatting utility (10 tests)
- Integration tests for Arweave registration (3 tests, mirrors IPFS pattern)
- Update test configuration with Arweave settings
- Update implementation plan with Phase 7 completion status

Test files achieve parity with existing IPFS test coverage.
- Add generateArweaveTags() utility for ERC-8004 metadata tagging
- Support 12 tag types: Essential, Capability Flags, Metadata
- All tags cryptographically signed via EthereumSigner (Turbo SDK)
- Update ArweaveClient to accept and apply tags on upload
- Add SDK_VERSION constant for versioned App-Name tags
- Add comprehensive unit tests (12/12 passing)

TEMPORARY: GraphQL type fixes in sdk.ts and subgraph-client.ts
for local testing - MUST BE REVERTED before final release
See Pre-Merge Checklist in ARWEAVE_INTEGRATION_PLAN.md
@ries9112
Copy link

ries9112 commented Nov 21, 2025

Worked great for me! https://arweave.net/-2SgZvrwECOTPv3cNpbBSLJQuG0LrEiAOvbHFmGs3xk

But on the subgraph side would need to make sure everything is working correctly as well, currently I see this with null on the registrationFile:
image

{
  agents(where: {agentId: 1196}) {
    id
    chainId
    agentId
    agentURI
    createdAt
    owner
    totalFeedback
    updatedAt
    agentURIType
    registrationFile {
      a2aEndpoint
    }
    operators
    lastActivity
  }
}

But as far as the changes relating to the ts library I didn't run into any problems at all 👍

@ries9112
Copy link

will try the subgraph PR as well and report back

@ries9112
Copy link

Left an update on the subgraph PR, unfortunately not working for me, but would love to figure out the issue together

William Kempster added 4 commits December 12, 2025 14:16
  - Convert ArweaveClient to use dynamic imports matching IPFSClient pattern
  - Add error state checking for Turbo SDK initialization
  - Move from eager to lazy initialization in constructor
  - Reduces bundle size by ~500KB for read-only use cases
@kempsterrrr
Copy link
Author

kempsterrrr commented Dec 17, 2025

Shipped a few updates to this PR after chatting with @MarcoMetaMask

  • removes enum for ArweaveClient
  • updates Turbo package with reduce bundle size and addedd dynmic imports so only included when arweave is used
  • some small error handling fixes

Not fixed is the if/else flow for selecting storage providers for feedback, still favours Arweave if it's available will raise this separately and change if preferred.

Jerry confirmed separately in TG the subgraph is working

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.

2 participants