VVERSE/OS
VVerseOS Docs

Buy a VerseOS License in 5 Minutes

This guide uses the fastest fully exercised developer path: x402 agent licensing on Solana devnet.

At the end, your script will discover a right, pay the x402 challenge, and receive an active LIC-... record.

Minute 0 — What you need

  • VerseOS running locally at http://localhost:3000
  • a VerseOS API key with rights:read and licenses:write
  • a throwaway Solana devnet wallet
  • devnet USDC
  • Node.js 20+

Minute 1 — Create the project

cd C:\Users\YOU\Downloads
mkdir my-first-verseos-license
cd my-first-verseos-license
npm init -y
npm install @x402/core@2.19.0 @x402/svm@2.19.0 @x402/fetch @solana/kit @scure/base

Minute 2 — Pick a right

Use the VerseOS rights catalog:

$headers = @{
  Authorization = "Bearer $env:VERSEOS_API_KEY"
}

Invoke-RestMethod `
  -Method GET `
  -Uri "http://localhost:3000/v1/rights?medium=game" `
  -Headers $headers

Choose an available RGT-... public ID.

Example from the private-beta test catalog:

RGT-794B30A19A22

Minute 3 — Create the buyer

Create:

New-Item -ItemType File -Name "buy.mjs"

Paste:

import { wrapFetchWithPayment } from '@x402/fetch';
import { x402Client, x402HTTPClient } from '@x402/core/client';
import { ExactSvmScheme } from '@x402/svm/exact/client';
import { createKeyPairSignerFromBytes } from '@solana/kit';
import { base58 } from '@scure/base';

const apiKey = process.env.VERSEOS_API_KEY;
const secret = process.env.SVM_PRIVATE_KEY;
const rightId = process.env.VERSEOS_RIGHT_ID || 'RGT-794B30A19A22';

if (!apiKey) throw new Error('VERSEOS_API_KEY is missing.');
if (!secret) throw new Error('SVM_PRIVATE_KEY is missing.');

const signer = await createKeyPairSignerFromBytes(
  base58.decode(secret)
);

const client = new x402Client();
client.register('solana:*', new ExactSvmScheme(signer));

const fetchWithPayment = wrapFetchWithPayment(fetch, client);

const response = await fetchWithPayment(
  'http://localhost:3000/v1/agent-licenses',
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${apiKey}`,
      'Content-Type': 'application/json',
      'Idempotency-Key': `first-license-${Date.now()}`,
    },
    body: JSON.stringify({ right_id: rightId }),
  }
);

const body = await response.json();
console.log('HTTP:', response.status);
console.dir(body, { depth: null });

if (response.ok) {
  const httpClient = new x402HTTPClient(client);
  const settlement = httpClient.getPaymentSettleResponse(
    (name) => response.headers.get(name)
  );
  console.dir(settlement, { depth: null });
}

Minute 4 — Set credentials

$env:VERSEOS_API_KEY = "vos_live_YOUR_TEST_KEY"
$env:SVM_PRIVATE_KEY = "YOUR_THROWAWAY_DEVNET_BASE58_SECRET_KEY"
$env:VERSEOS_RIGHT_ID = "RGT-794B30A19A22"

Do not put the Solana private key directly in buy.mjs.

Minute 5 — Buy

node buy.mjs

Success looks like:

HTTP: 201

and:

{
  "object": "agent_license",
  "x402": true,
  "payment": {
    "status": "settled"
  },
  "license": {
    "public_id": "LIC-...",
    "status": "active"
  }
}

You now have a VerseOS license created from a machine-readable right and paid through x402 on Solana devnet.

What happened under the hood

GET /v1/rights
      ↓
choose RGT-...
      ↓
POST /v1/agent-licenses
      ↓
402 PAYMENT-REQUIRED
      ↓
x402 client signs + pays
      ↓
VerseOS verifies/settles
      ↓
LIC-... issued

Next

Read the complete x402 Quickstart for quote recovery and fee-policy details, or SDK Quickstart for the standard app checkout architecture.