Getting Started with x402-hub

Overview

x402-hub is the foundational payment infrastructure service that implements the x402 protocol for blockchain payments. It provides protocol endpoints, wallet authentication, and transaction history.

Multi-Chain Support: x402-hub supports both EVM networks (Ethereum, Base) and Solana networks, allowing you to process payments across multiple blockchains using a single, consistent API.

Base URL

  • Production: https://hub.sigwei.com

All endpoints use standard x402 protocol paths or /api/v1/ prefix for hub-specific features.

Integration Options

You can integrate with x402-hub in three ways:

  1. HubClient SDK (Go) - Recommended for Go applications

  2. REST API - For any language with HTTP support

  3. x402 Protocol - Standard x402-compatible clients

Quick Start with HubClient (Go)

Installation

Basic Usage

See HubClient SDK Documentation for complete SDK usage.

Quick Start with REST API

Prerequisites

  • Wallet: Ethereum-compatible wallet with private key

  • USDC Balance: USDC on Base blockchain for transfers

  • HTTP Client: curl, axios, requests, or similar

1. Authentication Flow

Get Authentication Message

Response:

Sign Message with Wallet

Use your wallet software (ethers.js, web3.py, etc.) to sign the message:

Login with Signature

Response:

2. Query Transaction History

Response:

3. Execute Transfer

Core Endpoints

x402 Protocol Endpoints

x402-hub implements the standard x402 protocol:

  • GET /supported - Query supported networks and schemes

  • POST /verify - Verify payment without settling

  • POST /settle - Settle payment on blockchain

  • POST /transfer - Convenient transfer endpoint

Hub-Specific Endpoints

Authentication and history (require /api/v1/ prefix):

  • GET /api/v1/auth/message - Get authentication message

  • POST /api/v1/auth/login - Login with wallet signature

  • POST /api/v1/auth/refresh - Refresh access token

  • GET /api/v1/auth/me - Get current user

  • POST /api/v1/auth/logout - Logout

  • GET /api/v1/history - Query transaction history

Common Use Cases

For Payment Processors

Build payment-enabled applications that verify and settle blockchain payments:

For Transaction Tracking

Query and monitor blockchain transactions:

For Gasless Transfers

Execute USDC transfers without gas fees:

Network Support

x402-hub supports both EVM and Solana networks:

EVM Networks

  • Base Mainnet (network: "base")

    • Chain ID: 8453

    • USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

  • Base Sepolia Testnet (network: "base-sepolia")

    • Chain ID: 84532

    • USDC: 0x036CbD53842c5426634e7929541eC2318f3dCF7e

Solana Networks

  • Solana Devnet (network: "solana-devnet")

    • USDC Mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

  • Solana Mainnet (network: "solana-mainnet")

    • USDC Mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

Authentication

x402-hub uses two authentication methods:

  1. Wallet Signature (SIWE) - For user authentication

    • Used by Auth endpoints (/api/v1/auth/*)

    • Used by History endpoint (/api/v1/history)

    • Returns JWT access tokens

  2. No Authentication - For protocol endpoints

    • Used by x402 protocol endpoints (/verify, /settle, /transfer, /supported)

    • Public endpoints for payment processing

Error Handling

All errors return structured responses:

Common HTTP status codes:

  • 400 - Bad Request (validation errors)

  • 401 - Unauthorized (missing or invalid authentication)

  • 403 - Forbidden (insufficient permissions)

  • 404 - Not Found

  • 500 - Internal Server Error

Next Steps

Need Help?

Check out our Support & Resources section for troubleshooting and additional resources.

Last updated