Skip to content

tojunetwork/afara

toju — pay-as-you-go decentralized storage on IPFS

toju is a crypto-native onramp for decentralized storage on IPFS via Storacha. pay with SOL, USDFC, or USDC — no credit cards, no subscriptions. toju also supports agentic payments via the x402 protocol, enabling AI agents to pay for storage autonomously.

Features

  • Native SOL payments for storage — no credit cards, subscriptions, or off-chain billing
  • Filecoin-backed IPFS storage via Storacha, ensuring decentralized, verifiable persistence
  • Pay-as-you-go pricing, lowering friction for real storage usage and experimentation
  • Storage lifecycle management, including automatic cleanup of expired files
  • Email notifications before storage expiration to prevent unintended data loss
  • Developer-friendly SDK and CLI, designed for easy integration into Solana applications

Quick Start

Using the SDK

npm install @toju.network/sol

Direct Usage (Node.js / Server-side)

import { Client, Environment } from '@toju.network/sol';

const client = new Client({
  environment: Environment.testnet,
});

// Estimate storage cost
const cost = await client.estimateStorageCost([file], 30 * 86400); // 30 days in seconds
console.log(`Cost: ${cost.sol} SOL`);

// Upload a file
const result = await client.createDeposit({
  payer: publicKey,        // from wallet adapter
  file: [file],
  durationDays: 30,
  signTransaction,         // from wallet adapter
  userEmail: 'user@example.com', // optional, for expiry notifications
});

console.log(`File CID: ${result.cid}`);

React Hook

import { useDeposit } from '@toju.network/sol';
import { useWallet } from '@solana/wallet-adapter-react';

function UploadComponent() {
  const { publicKey, signTransaction } = useWallet();
  const client = useDeposit('mainnet-beta', false);

  const handleUpload = async (files: File[]) => {
    const cost = await client.estimateStorageCost(files, 30 * 86400);
    
    const result = await client.createDeposit({
      payer: publicKey,
      file: files,
      durationDays: 30,
      signTransaction,
    });

    console.log(`Uploaded: ${result.cid}`);
    console.log("cost", cost)
  };

  return (
    <button onClick={() => handleUpload([file])}>
      Upload
    </button>
  );
}

Using the Web App

Documentation

Full documentation available at docs.toju.network

Contributing

See CONTRIBUTING.md for development setup and guidelines.

Links

Production (Mainnet):

Staging (Testnet):

Resources:

Talk to us

License

Apache-2.0

Help us Scale

Support Storacha-Solana-SDK on drips.network

About

the onramp for pay-as-you-go decentralized storage on IPFS — SOL, USDFC, USDC, and x402 agent payments

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors