Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions ai/x402.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
---
x402 Protocol brings HTTP micro payments to Sei, enabling you to monetize APIs, premium content, and digital services with instant, low-cost payments. Whether you're building AI APIs, data feeds, or premium content platforms, x402 makes it simple to add payment gates to any HTTP endpoint.

**Works with Sei's advantages:** Sei's fast finality, low gas fees, and EVM compatibility make it perfect for micro payments. x402 leverages these features to enable seamless payment flows that complete in milliseconds.

Check warning on line 9 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L9

Use 'gas' instead of 'gas fees' (Sei terminology).


<Info>

**Why x402 on Sei?**

- **Fast & Cheap Payments**: Sei's 400ms finality and low gas fees make micropayments practical. Perfect for pay-per-request APIs and streaming content.

Check warning on line 16 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L16

Use 'gas' instead of 'gas fees' (Sei terminology).
- **EVM Compatible**: Use familiar tools like Viem, Ethers.js, and Hardhat. All existing Ethereum tooling works seamlessly on Sei.
- **Built-in Wallet Support**: Integrates with Sei wallets, MetaMask, and any EIP-6963 compatible wallet for smooth user experiences.

</Info>

## Use Cases on Sei

Check warning on line 22 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L22

Use sentence case for headings: 'Use Cases on Sei'.

The x402 protocol enables a wide range of monetization strategies for web services and APIs:

Expand All @@ -30,29 +30,29 @@

## sei-js Integration

The `sei-js` library provides a suite of packages to simplify working with x402 on Sei. You can find more details in the [sei-js x402 documentation](https://sei-js.docs.sei.io/x402/introduction).
The `sei-js` library provides a suite of packages to simplify working with x402 on Sei. You can find more details in the [sei-js x402 repository](https://github.com/sei-protocol/sei-x402).

### Core Concepts

Check warning on line 35 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L35

Use sentence case for headings: 'Core Concepts'.

- [**Protocol Overview**](https://sei-js.docs.sei.io/x402/overview): Learn about the architecture of x402.
- [**Quickstart Guide**](https://sei-js.docs.sei.io/x402/quickstart): Build your first paid API.
- [**Facilitators**](https://sei-js.docs.sei.io/x402/facilitators/introduction): Understanding payment facilitators.
- [**Client Integration**](https://sei-js.docs.sei.io/x402/clients/fetch): How to integrate x402 in your frontend.
- [**Protocol Overview**](https://github.com/sei-protocol/sei-x402/blob/main/docs/core-concepts/client-server.md): Learn about the architecture of x402.
- [**Quickstart Guide**](https://github.com/sei-protocol/sei-x402/blob/main/docs/getting-started/quickstart-for-sellers.md): Build your first paid API.
- [**Facilitators**](https://github.com/sei-protocol/sei-x402/blob/main/docs/core-concepts/facilitator.md): Understanding payment facilitators.
- [**Client Integration**](https://github.com/sei-protocol/sei-x402/blob/main/docs/getting-started/quickstart-for-buyers.md): How to integrate x402 in your frontend.

### Available Packages

Check warning on line 42 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L42

Use sentence case for headings: 'Available Packages'.

- [**x402**](https://sei-js.docs.sei.io/x402/packages/x402): The core protocol implementation.
- [**x402-fetch**](https://sei-js.docs.sei.io/x402/packages/x402-fetch): A fetch wrapper for making x402-compliant requests.
- [**x402-axios**](https://sei-js.docs.sei.io/x402/packages/x402-axios): Axios interceptors for x402 payments.
- [**x402-express**](https://sei-js.docs.sei.io/x402/packages/x402-express): Express middleware for serving paid content.
- [**x402-hono**](https://sei-js.docs.sei.io/x402/packages/x402-hono): Middleware for Hono applications.
- [**x402-next**](https://sei-js.docs.sei.io/x402/packages/x402-next): Components and utilities for Next.js applications.
- [**x402**](https://www.npmjs.com/package/@sei-js/x402): The core protocol implementation.
- [**x402-fetch**](https://www.npmjs.com/package/@sei-js/x402-fetch): A fetch wrapper for making x402-compliant requests.
- [**x402-axios**](https://www.npmjs.com/package/@sei-js/x402-axios): Axios interceptors for x402 payments.
- [**x402-express**](https://www.npmjs.com/package/@sei-js/x402-express): Express middleware for serving paid content.
- [**x402-hono**](https://www.npmjs.com/package/@sei-js/x402-hono): Middleware for Hono applications.
- [**x402-next**](https://www.npmjs.com/package/@sei-js/x402-next): Components and utilities for Next.js applications.

These packages help streamline both the client-side (paying) and server-side (charging) aspects of the protocol.

---

# Axiom Kit Integration

Check warning on line 55 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L55

Use sentence case for headings: 'Axiom Kit Integration'.

While you can build x402 integrations using standard tools and the libraries mentioned above, you can also optionally use Axiom Kit for a more agent-centric approach. This guide demonstrates an end-to-end x402 (HTTP 402 Payment Required) micropayment flow on the Sei testnet using AxiomKit.

Expand All @@ -60,7 +60,7 @@

x402 is an open standard protocol for internet-native payments that enables users to send and receive payments globally in a simple, secure, and interoperable manner. The protocol leverages the HTTP 402 status code ("Payment Required") to facilitate blockchain-based micropayments directly through HTTP requests.

### Key Features of x402:

Check warning on line 63 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L63

Use sentence case for headings: 'Key Features of x402:'.

- **HTTP-Native**: Uses standard HTTP status codes and headers
- **Blockchain Integration**: Supports multiple blockchain networks
Expand All @@ -68,7 +68,7 @@
- **Interoperable**: Works across different payment schemes and networks
- **Micropayment Support**: Designed for small, frequent transactions

## Protocol Overview

Check warning on line 71 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L71

Use sentence case for headings: 'Protocol Overview'.

The x402 protocol follows a specific flow:

Expand All @@ -82,18 +82,18 @@

Axiom is a blockchain interaction framework that provides tools and libraries for building decentralized applications. In this implementation, Axiom integrates with x402 to enable seamless blockchain payments within Sei network applications.

### Axiom Components Used:

Check warning on line 85 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L85

Use sentence case for headings: 'Axiom Components Used:'.

- **@axiomkit/core**: Core framework for building blockchain agents
- **@axiomkit/sei**: Sei blockchain integration
- **AxiomSeiWallet**: Wallet management for Sei transactions
- **Context and Actions**: Framework for building interactive blockchain agents

## Sei Blockchain Implementation

Check warning on line 92 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L92

Use sentence case for headings: 'Sei Blockchain Implementation'.

This implementation uses the Sei testnet for x402 payments with the following configuration:

### Network Configuration

Check warning on line 96 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L96

Use sentence case for headings: 'Network Configuration'.

```typescript
export const X402_CONFIG = {
Expand All @@ -107,11 +107,11 @@
};
```

## Technical Architecture

Check warning on line 110 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L110

Use sentence case for headings: 'Technical Architecture'.

The x402 implementation consists of several key components:

### 1. Payment Challenge Generation

Check warning on line 114 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L114

Use sentence case for headings: '1. Payment Challenge Generation'.

```typescript
function generatePaymentChallenge() {
Expand Down Expand Up @@ -142,7 +142,7 @@
}
```

### 2. Payment Verification

Check warning on line 145 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L145

Use sentence case for headings: '2. Payment Verification'.

```typescript
async function verifyPayment(paymentHeader: string) {
Expand All @@ -163,7 +163,7 @@
}
```

### 3. Axiom Agent Integration

Check warning on line 166 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L166

Use sentence case for headings: '3. Axiom Agent Integration'.

The Axiom agent handles the complete x402 flow:

Expand Down Expand Up @@ -201,16 +201,16 @@
});
```

## Payment Flow

Check warning on line 204 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L204

Use sentence case for headings: 'Payment Flow'.

### 1. Initial Request

Check warning on line 206 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L206

Use sentence case for headings: '1. Initial Request'.

```
Client → GET /api/weather
Server → 402 Payment Required + Payment Challenge
```

### 2. Payment Challenge Response

Check warning on line 213 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L213

Use sentence case for headings: '2. Payment Challenge Response'.

```json
{
Expand All @@ -236,7 +236,7 @@
}
```

### 3. Payment Execution

Check warning on line 239 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L239

Use sentence case for headings: '3. Payment Execution'.

The Axiom agent executes a USDC transfer on Sei testnet:

Expand Down Expand Up @@ -264,16 +264,16 @@
});
```

### 4. Payment Proof Submission

Check warning on line 267 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L267

Use sentence case for headings: '4. Payment Proof Submission'.

```
Client → GET /api/weather + X-Payment Header (base64 encoded payment proof)
Server → Verifies payment + Returns weather data
```

## Code Examples

Check warning on line 274 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L274

Use sentence case for headings: 'Code Examples'.

### Complete Weather API Implementation

Check warning on line 276 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L276

Use sentence case for headings: 'Complete Weather API Implementation'.

```typescript
export async function GET(req: NextRequest) {
Expand Down Expand Up @@ -309,7 +309,7 @@
}
```

### Axiom Agent Weather Action

Check warning on line 312 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L312

Use sentence case for headings: 'Axiom Agent Weather Action'.

```typescript
action({
Expand Down Expand Up @@ -392,29 +392,29 @@
});
```

## Security Considerations

Check warning on line 395 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L395

Use sentence case for headings: 'Security Considerations'.

### Payment Verification

Check warning on line 397 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L397

Use sentence case for headings: 'Payment Verification'.

- **On-chain Verification**: All payments are verified against the Sei blockchain.
- **Transaction Receipt Validation**: Ensures transaction success and proper recipient.
- **Payment Caching**: Prevents double-spending by caching verified payments.
- **Reference Validation**: Unique payment references prevent replay attacks.

### Network Security

Check warning on line 404 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L404

Use sentence case for headings: 'Network Security'.

- **HTTPS Required**: All API communications use secure connections.
- **Base64 Encoding**: Payment proofs are base64 encoded for safe transmission.
- **Timeout Handling**: Payment challenges include timeout mechanisms.
- **Error Handling**: Comprehensive error handling prevents information leakage.

### Wallet Security

Check warning on line 411 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L411

Use sentence case for headings: 'Wallet Security'.

- **Private Key Management**: Private keys are stored securely in environment variables.
- **Transaction Signing**: All transactions are properly signed before submission.
- **Balance Validation**: Sufficient balance checks before payment execution.

## Tutorials & Resources

Check warning on line 417 in ai/x402.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

ai/x402.mdx#L417

Use sentence case for headings: 'Tutorials & Resources'.

- **[Sei-js X402 Documentation](https://sei-js.docs.sei.io/x402/introduction)**: Comprehensive guide on using the x402 protocol with the sei-js library, including package details and examples.
- **[Sei-js X402 Repository](https://github.com/sei-protocol/sei-x402)**: Comprehensive guide on using the x402 protocol with the sei-js library, including package details and examples.
- **[AxiomKit X402 Demo Repository](https://github.com/AxiomKit/axiomkit-showcase)**: The complete source code for the Axiom integration demo used in this guide, including installation and configuration instructions.
2 changes: 1 addition & 1 deletion evm/usdc-on-sei.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
description: 'Guide to integrating USDC stablecoin on Sei using Viem and Node.js for transfers and balance checks.'
keywords: ['USDC', 'Sei', 'Circle', 'stablecoin', 'ERC-20', 'Viem', 'payments', 'token transfer', 'web3', 'cryptocurrency']
---
## Addresses and Decimals

Check warning on line 6 in evm/usdc-on-sei.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/usdc-on-sei.mdx#L6

Use sentence case for headings: 'Addresses and Decimals'.

- Testnet (atlantic-2) USDC: [`0x4fCF1784B31630811181f670Aea7A7bEF803eaED`](https://testnet.seiscan.io/address/0x4fCF1784B31630811181f670Aea7A7bEF803eaED)
- Mainnet (pacific-1) USDC: [`0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392`](https://seiscan.io/address/0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392)
Expand All @@ -22,11 +22,11 @@
- Node.js v18+ with "type": "module" in package.json
- viem and dotenv installed
- Sei wallet with USDC and SEI for gas on your selected network (default: testnet).
- To get testnet USDC on Sei, use the [Circle Faucet](https://faucet.circle.com) or use [Circle’s CCTP v2](https://replit.com/@buildoncircle/cctp-v2-web-app?v=1#README.md) Sample application to transfer USDC cross-chain to your Sei wallet.
- To get testnet USDC on Sei, use the [Circle Faucet](https://faucet.circle.com) or use [Circle’s CCTP v2](https://github.com/circlefin/circle-cctp-crosschain-transfer) Sample application to transfer USDC cross-chain to your Sei wallet.
- Private key and recipient address stored in a .env file
- Optional: set `SEI_NETWORK=testnet|mainnet` (defaults to `testnet`)

## Project Setup

Check warning on line 29 in evm/usdc-on-sei.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/usdc-on-sei.mdx#L29

Use sentence case for headings: 'Project Setup'.

Follow these steps to set up your project and environment:

Expand All @@ -48,7 +48,7 @@

- **Create the script file**: Create an index.js file in the project directory. We will build this script step by step in the next section. Ensure that your Node environment can handle ES module imports (the code uses import syntax).

## Script Breakdown

Check warning on line 51 in evm/usdc-on-sei.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/usdc-on-sei.mdx#L51

Use sentence case for headings: 'Script Breakdown'.

Open index.js in your editor and add the following sections. Each part of the script is explained below:

Expand Down Expand Up @@ -218,7 +218,7 @@

- Errors in the try/catch (for example, RPC issues or a transaction failure) will log “Transfer failed” with the error message. The script ends with process.exit(0) to terminate after completing the async function.

## Run the Script

Check warning on line 221 in evm/usdc-on-sei.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/usdc-on-sei.mdx#L221

Use sentence case for headings: 'Run the Script'.

With index.js completed, you can run the script from your terminal:

Expand All @@ -245,7 +245,7 @@

Continue building by checking for more information in the [Circle Developer Docs.](https://developers.circle.com/)

### Important Notes

Check warning on line 248 in evm/usdc-on-sei.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/usdc-on-sei.mdx#L248

Use sentence case for headings: 'Important Notes'.

- Testnet Only: Sei testnet USDC has no real value. Don’t use mainnet keys or expect real funds.
- Security: Store private keys in `.env`; never commit secrets. Use best practices for key management.
Expand Down
13 changes: 11 additions & 2 deletions lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ timeout = 20
# A real browser UA avoids naive bot-blocks.
user_agent = "Mozilla/5.0 (compatible; lychee link checker; +https://github.com/sei-protocol/sei-docs)"

# Treat rate-limiting / bot-challenge responses as OK rather than broken.
accept = ["200..=206", "301", "302", "304", "403", "429"]
# Treat rate-limiting / bot-challenge responses as OK rather than broken. 405
# (Method Not Allowed) covers JSON-RPC endpoints like evm-rpc.sei-apis.com that
# reject the checker's GET but are very much alive.
accept = ["200..=206", "301", "302", "304", "403", "405", "429"]

# Don't flag these — local/example hosts and domains that hard-block automated
# requests (so a failure here is a false positive, not real rot).
Expand All @@ -39,6 +41,13 @@ exclude = [
"^https?://(www\\.)?linkedin\\.com",
"^https?://(www\\.)?reddit\\.com",
"^https?://(t\\.me|discord\\.gg|discord\\.com)",
# Live sites that hard-block automated checkers (verified reachable in a browser):
# silostaking.io → 402 Payment Required to bots
# dashboard.pimlico.io → 404 to bots (client-rendered app shell)
# blog.thirdweb.com → cert chain rejected by lychee's TLS, fine in browsers
"^https?://(www\\.)?silostaking\\.io",
"^https?://dashboard\\.pimlico\\.io",
"^https?://blog\\.thirdweb\\.com",
]

# Don't check mailto: links (this is the default; set explicitly for clarity).
Expand Down
Loading