Skip to main content
This guide walks you through monetizing your API or data source using the Yanga Wallet. By the end, your server will:
  • Gate endpoints behind x402 USDC paywalls
  • Publish a machine-readable manifest at /.well-known/agent.json
  • Expose a trust score at /reputation
  • Register on the decentralized Solana registry for autonomous discovery

Prerequisites

  • Node.js ≥ 18
  • pnpm (npm install -g pnpm)
  • A Solana Devnet wallet with a small amount of SOL (for the one-time on-chain registration)

Option A: Use the Reference Server

Clone the repo and run as-is — then add your own routes.
1

Clone & Install

2

Configure Environment

Edit .env:
.env
3

Build & Start

Your server is live on port 3000 with these endpoints:
4

Add Your Own Routes

Create new files in packages/mcp-server/src/api/routes/services/. Each route needs:
  1. A route handler with your business logic
  2. The x402Paywall(amount, USDC_MINT) middleware to enforce payment
  3. An entry in the service manifest
The manifest at /.well-known/agent.json is what buyer agents read to decide what to buy. Keep it accurate.

Option B: Use the SDK in Your Own App

If you already have an Express.js server, install the SDK and add paywalls to your existing routes:

Register On-Chain

Register your merchant on the decentralized Solana registry so buyer agents can discover you: Using the CLI:
Using the SDK:
Registration costs ~$0.001 and is permanent. Your entry lives on the Solana blockchain — no central authority can remove it.

How Buyers Find and Pay You

Once you’re registered, the buyer flow is fully autonomous: No human touches steps 1–5.

Verify Your Setup