# x402

## What is X402?

X402 is the HTTP payment standard for AI agents, using the `402 Payment Required` status code to enable autonomous machine-to-machine transactions. BaseGold implements X402 v2 with enhanced features for gold-backed rewards.

## X402 v2 Features

| Feature                | Description                     |
| ---------------------- | ------------------------------- |
| Autonomous Payments    | No human approval required      |
| Proof Verification     | Cryptographic payment proofs    |
| Multi-currency         | BGOLD, USDC, ETH support        |
| Rate Limiting          | Built-in abuse protection       |
| Reflection Passthrough | Agents earn VNXAU automatically |

## Protocol Flow

{% @mermaid/diagram content="sequenceDiagram
participant Client as AI Agent/Client
participant Server as Service Provider
participant X402 as X402 Middleware
participant Treasury as BaseGold Treasury

```
Client->>Server: GET /api/data
Server-->>Client: 402 Payment Required
Note over Server,Client: X-Payment-Amount: 100 BGOLD<br/>X-Payment-Address: 0x...

Client->>X402: Create Payment Proof
X402->>Treasury: Verify & Transfer BGOLD
Treasury-->>X402: Transfer Confirmed
X402-->>Client: Payment Proof Token

Client->>Server: GET /api/data + Proof
Server->>X402: Validate Proof
X402-->>Server: Proof Valid
Server-->>Client: 200 OK + Data" %}
```

## Why BaseGold for X402?

### Stable Value Component

AI agents need predictable value for budgeting and accounting. VNXAU rewards provide stable value while $BGOLD enables growth.

### Programmable Logic

Smart contracts allow AI agents to:

* Automatically claim rewards
* Reinvest profits
* Manage treasury allocations
* Execute complex strategies

### Low Transaction Costs

Base Network's low fees enable microtransactions perfect for AI agent operations.

### Fast Settlement

Sub-second finality ensures AI agents can operate in real-time without waiting for confirmations.

## Technical Implementation

| Component        | Technology       | Purpose                 |
| ---------------- | ---------------- | ----------------------- |
| Payment Standard | X402 Protocol v2 | HTTP 402 handling       |
| Settlement Layer | Base Network     | Fast, low-cost L2       |
| Token            | BGOLD (ERC-20)   | Payment currency        |
| Rewards          | VNXAU            | Gold-backed reflections |
| Backend          | Edge Functions   | Payment verification    |
| SDK              | TypeScript       | Agent integration       |

## Implementation Timeline

{% stepper %}
{% step %}

### Q1 2026 (Research Phase) — COMPLETED

* X402 protocol specification review
* Smart contract architecture design
* AI agent SDK development planning
  {% endstep %}

{% step %}

### Q2 2026 (Development Phase) — CURRENT

* X402 v2 smart contract integration
* AI agent interface development
* Beta testing with partner AI platforms
* SDK alpha release
  {% endstep %}

{% step %}

### Q3 2026 (Launch Phase)

* Full X402 protocol activation
* AI agent marketplace launch
* Developer documentation and tools
* Production SDK release
  {% endstep %}

{% step %}

### Q4+ 2026 (Expansion Phase)

* Cross-chain X402 compatibility
* Advanced AI agent features
* Enterprise partnerships
  {% endstep %}
  {% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://basegold.gitbook.io/basegold/ai-x402/x402.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
