Solana Kit

Overview

Understanding the Solana Kit architecture

The Shelby Protocol Solana Kit SDK is built to bridge the gap between Solana and the Shelby Protocol, enabling Solana developers to use their existing keypairs or wallet connections for decentralized blob storage.

Architecture

The SDK provides two entry points for different environments:

┌─────────────────────────────────────────────────────────────────────────┐
│                         Your Solana Application                          │
├─────────────────────────────────────────────────────────────────────────┤
│                      @shelby-protocol/solana-kit                         │
│                                                                          │
│  ┌─────────────────────────────┐    ┌─────────────────────────────────┐ │
│  │         /node               │    │           /react                │ │
│  │  ┌───────────────────────┐  │    │  ┌───────────────────────────┐  │ │
│  │  │   Shelby Client       │  │    │  │   useStorageAccount       │  │ │
│  │  │   (extends SDK)       │  │    │  │   (React Hook)            │  │ │
│  │  └───────────────────────┘  │    │  └───────────────────────────┘  │ │
│  │  ┌───────────────────────┐  │    │                                 │ │
│  │  │ ShelbyStorageAccount  │  │    │  Uses connected wallet for:    │ │
│  │  │ (Keypair → Account)   │  │    │  - Address derivation          │ │
│  │  └───────────────────────┘  │    │  - Transaction signing         │ │
│  └─────────────────────────────┘    └─────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────────────┤
│                         @shelby-protocol/sdk                             │
│  ┌───────────────────────────┐    ┌───────────────────────────────────┐ │
│  │   Coordination Layer      │    │   RPC Operations                  │ │
│  │   (Aptos Chain)           │    │   (Blob Storage)                  │ │
│  └───────────────────────────┘    └───────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘

Entry Points

Node.js (/node)

For server-side applications with direct access to Solana keypairs:

  • Shelby Client: Extends the core SDK with Solana-specific initialization
  • ShelbyStorageAccount: Converts a Solana Keypair into a Shelby signer
  • Use cases: Backend services, scripts, CLIs, automated uploads
import { Shelby, Network } from "@shelby-protocol/solana-kit/node";

React (/react)

For browser applications with wallet connections:

  • useStorageAccount Hook: Derives storage account from connected wallet
  • Wallet Integration: Works with Phantom, Solflare, and other Solana wallets
  • Use cases: React dApps, Next.js applications, browser-based uploads
import { useStorageAccount } from "@shelby-protocol/solana-kit/react";

Cross-Chain Flow

Both entry points use the same underlying cross-chain mechanism:

Node.js Flow

┌──────────────┐     ┌──────────────────────┐     ┌─────────────────┐
│   Solana     │────▶│ ShelbyStorageAccount │────▶│  Shelby Client  │
│   Keypair    │     │   (Signs with SIWS)  │     │  (Uploads blob) │
└──────────────┘     └──────────────────────┘     └─────────────────┘
  1. Solana Keypair → Provided directly (from file, env, etc.)
  2. ShelbyStorageAccount → Signs transactions with SIWS envelope
  3. Shelby Client → Submits to the coordination layer

React Flow

┌──────────────┐     ┌──────────────────────┐     ┌─────────────────┐
│   Wallet     │────▶│  useStorageAccount   │────▶│  Shelby Client  │
│  (Phantom)   │     │ (Prompts for sign)   │     │  (Uploads blob) │
└──────────────┘     └──────────────────────┘     └─────────────────┘
  1. Wallet → User connects via browser extension
  2. useStorageAccount → Derives address, prompts user to sign
  3. Shelby Client → Submits to the coordination layer

SIWS (Sign-In With Solana)

Both entry points use the SIWS envelope format for transaction signing:

  1. Transaction Data → Serialized Aptos transaction
  2. SIWS Message → Human-readable message wrapping the transaction
  3. Solana Signature → Ed25519 signature from Solana keypair/wallet
  4. Authenticator → Wrapped signature compatible with Aptos

This enables Solana identities to control accounts on the Aptos-based Shelby network.

Common Module

Both entry points share common functionality:

ExportDescription
NetworkNetwork configuration (currently SHELBYNET)
deriveStorageAccountAddressDerives Shelby address from Solana public key
createSiwsMessageCreates the SIWS message for signing
createAuthenticatorWraps signature in Aptos authenticator format

Choosing an Entry Point

RequirementUse Node.js (/node)Use React (/react)
Direct keypair access
Wallet popup for signing
Server-side execution
Browser environment
Automated/batch operations
User-initiated transactions