Getting Started

This guide will help you get started with Shade402, whether you're building an API that requires payments or creating a client that consumes paid APIs.

Prerequisites

Before you begin, ensure you have:

  • Node.js 18.0.0 or higher

  • pnpm 8.0.0 or higher (or npm/yarn)

  • A Solana wallet (for testing, you can generate one)

  • Access to a Solana RPC endpoint (devnet for testing, mainnet for production)

Installation

Install Shade402 packages using your preferred package manager:

# For API providers (server-side)
pnpm add @shade402/express @shade402/core

# For API consumers (client-side)
pnpm add @shade402/client @shade402/core

# For AI agent integrations
pnpm add @shade402/langchain @shade402/langgraph

Quick Start: API Provider

Create a simple Express.js server that requires payment for an endpoint.

Step 1: Install Dependencies

Step 2: Create Server

Create a file server.ts:

Step 3: Set Environment Variables

Create a .env file:

Step 4: Run the Server

Quick Start: API Consumer

Create a client that automatically pays for API access.

Step 1: Install Dependencies

Step 2: Create Client

Create a file client.ts:

Step 3: Set Environment Variables

Step 4: Run the Client

Testing with Devnet

For testing, use Solana devnet:

  1. Get devnet SOL from the faucet: https://faucet.solana.com

  2. Get devnet USDC tokens (if needed)

  3. Use devnet RPC: https://api.devnet.solana.com

Production Setup

For production:

  1. Use mainnet RPC endpoint (consider using a provider like Helius, QuickNode, or Alchemy)

  2. Use real USDC token mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

  3. Set network: 'solana-mainnet'

  4. Store wallet private keys securely (environment variables, key management service)

  5. Enable auto-verification for payment security

  6. Monitor payment transactions and set up alerts

Next Steps

Last updated