Storage·Solana
Shadow Drive
Decentralized object storage on Solana from GenesysGo (shdwDrive). Storage accounts are onchain Solana accounts paid in SHDW; SDK and S3-compatible API for uploads with native Solana wallet auth.
- 01Solana-native NFT metadata + media
- 02Solana dApp asset hosting
- 03wallet-authenticated uploads
- 04low-cost object storage paid in SHDW
- 05frontend hosting for Solana apps
- pnpm add @shadow-drive/sdk @solana/web3.js
| Variable | Scope | Description |
|---|---|---|
| SOLANA_RPC_URL | Client | Solana RPC endpoint (Helius/QuickNode/Triton recommended; public RPCs are rate-limited). |
| SHDW_DRIVE_KEYPAIR | Server | Base58 / JSON-array Solana keypair funded with SOL (for tx fees) and SHDW (for storage). Server-side only. |
Install `@shadow-drive/sdk` and `@solana/web3.js`. Initialize on the server with `const connection = new Connection(process.env.SOLANA_RPC_URL); const wallet = new NodeWallet(Keypair.fromSecretKey(decodeKeypair(process.env.SHDW_DRIVE_KEYPAIR))); const drive = await new ShdwDrive(connection, wallet).init();`. Create a bucket once with `const { shdw_bucket, transaction_signature } = await drive.createStorageAccount('my-bucket', '10MB', 'v2')` — costs SOL for tx fees and SHDW for the storage allocation. Upload via `drive.uploadFile(new PublicKey(shdw_bucket), file)` (returns `{ finalized_locations }`); read at `https://shdw-drive.genesysgo.net/${shdw_bucket}/${file_name}`. To grow storage call `drive.addStorage(bucket, '10MB')`; to make immutable call `drive.makeStorageImmutable(bucket)`. For browser uploads use the user's connected wallet (`@solana/wallet-adapter`) so they sign their own bucket + upload txs.
- ⚑Storage accounts require BOTH SOL (for Solana transaction fees) AND SHDW (for storage allocation) — `createStorageAccount` will fail with cryptic errors if either balance is insufficient.
- ⚑Bucket sizes are fixed at creation; growing requires `addStorage` (which charges more SHDW). You cannot shrink without deleting and re-creating.
- ⚑File names are unique per bucket — uploading the same name overwrites unless the bucket is immutable. Use deterministic, content-hashed names if you need versioning.
- ⚑Once a bucket is made immutable via `makeStorageImmutable`, files cannot be deleted or replaced and storage cannot be reduced — only grown. Verify before flipping the flag.
- ⚑Reads go through the centralized `shdw-drive.genesysgo.net` gateway — there is no IPFS or multi-gateway fallback. Plan for gateway outages or self-host a proxy.
- ⚑SHDW token availability and DEX liquidity drive the effective storage price — top up bucket SHDW before going viral; an empty SHDW balance halts new uploads to the bucket.