Skip to main content

How It Works

ShadowFeed uses the x402 protocol — an HTTP-native payment standard that enables machines to pay for API access without API keys or subscriptions.

Payment Flow

Step-by-Step

1. Agent Requests Data

The agent makes a normal HTTP GET request to a paid feed endpoint:

2. Server Returns 402

Since no payment is included, the server responds with HTTP 402 Payment Required:
The payment-required header contains this as a base64-encoded string.

3. SDK Signs Payment

The SDK automatically:
  • Parses the 402 response
  • Creates a STX transfer transaction for the exact amount
  • Signs it with the agent’s private key
  • Retries the request with the signed transaction in the payment-signature header

4. Server Verifies & Settles

The server (or facilitator) verifies the signed transaction is valid:
  • Correct amount
  • Correct recipient
  • Valid signature
Then broadcasts it to the Stacks blockchain for settlement.

5. Data Delivered

Once payment is confirmed, the agent receives the requested data. The transaction is permanently recorded on-chain and verifiable on Hiro Explorer.

Key Concepts

Why x402?

  • No API keys — Payment is the authentication
  • Machine-native — Built for agent-to-agent commerce
  • Transparent — Every transaction is on-chain and verifiable
  • Micro-amounts — Feeds cost 0.003-0.08 STX (~0.0010.001-0.03)
  • Bitcoin-secured — Stacks settles on Bitcoin for maximum security