x402 Explorer
A sample app demonstrating Quicknode's x402 protocol for pay-per-request blockchain API access. Connect your wallet, authenticate with SIWE, and call RPC/REST methods across multiple chains with EVM payment signatures.

Overview
This sample app demonstrates Quicknode's x402 protocol for pay-per-request blockchain API access. The x402 protocol enables seamless micropayments for API calls β each request is paid for with an EVM signature, removing the need for traditional API keys or subscription plans.
Connect your wallet, authenticate with Sign-In with Ethereum (SIWE), and request testnet USDC from the faucet. When you execute blockchain methods, if you don't have enough credits, the app will automatically purchase test credits using your testnet USDC. Execute RPC/REST methods across multiple networks including Ethereum, Base Sepolia, Arbitrum, Polygon, and Aptos.
Architectureβ
Wallet βββΊ SIWE Auth βββΊ JWT Token
β
βΌ
x402 Fetch Wrapper (JWT + EVM payment signature)
β
βΌ
Quicknode x402 API βββΊ Blockchain RPC / REST
Each API request is wrapped by @x402/fetch, which automatically signs a payment authorization using your connected wallet. The x402 backend verifies the signature, deducts credits, and proxies the request to the target blockchain network.
Featuresβ
- Wallet Connection via ConnectKit (MetaMask, Coinbase Smart Wallet, etc.)
- SIWE Authentication to receive a session JWT
- Testnet USDC Faucet on Base Sepolia β credits are automatically purchased with testnet USDC when needed
- Multi-Chain RPC/REST Execution across Ethereum, Base Sepolia, Arbitrum, Polygon, and Aptos
- Payment Metadata Inspection returned with each response
- JSON-RPC, REST, gRPC-Web, and WebSocket method support
Supported Methodsβ
As all JSON-RPC, REST, gRPC-Web, and WebSocket methods are supported, you can call any method available on the target network. For demonstration, the app includes buttons for popular methods:
| Method | Protocol | Network |
|---|---|---|
eth_blockNumber | JSON-RPC | Base Sepolia, Arbitrum, Polygon |
eth_gasPrice | JSON-RPC | Base Sepolia |
eth_chainId | JSON-RPC | Ethereum |
| Ledger Info | REST | Aptos |
| Block by Height | REST | Aptos |
Prerequisitesβ
Project Structureβ
src/
βββ app/ # Next.js App Router (pages & layouts)
βββ components/
β βββ providers.tsx # Wagmi + React Query + ConnectKit providers
β βββ wallet-connection-shell.tsx
βββ hooks/
β βββ use-x402-auth.ts # SIWE authentication state
β βββ use-credits.ts # Credit balance fetching
β βββ use-x402-fetch.ts # Authenticated fetch wrapper
βββ lib/
βββ constants.ts # x402 URLs, chain IDs, contract addresses
βββ methods.ts # Available RPC/REST method definitions
βββ types.ts # TypeScript types
βββ x402.ts # Core x402 logic (auth, credits, execution)
Environment Variablesβ
| Variable | Default | Description |
|---|---|---|
NEXT_PUBLIC_X402_BASE_URL | https://x402.quicknode.com/ | x402 API base URL |
Create a .env.local file to override, but the default points to the public x402 endpoint which you can use for testing without any setup.
NEXT_PUBLIC_X402_BASE_URL=https://x402.quicknode.com/
Getting Startedβ
1. Clone the repositoryβ
git clone https://github.com/quiknode-labs/qn-guide-examples.git
cd qn-guide-examples/sample-dapps/x402-quicknode
2. Install dependenciesβ
pnpm install
3. Start the development serverβ
pnpm dev
Open http://localhost:3000 in your browser. Connect your wallet, authenticate with SIWE, request testnet USDC from the faucet, and start making pay-per-request API calls β credits are automatically purchased with your testnet USDC when needed.
Preview

- Fork the repository
- Create a feature branch:git checkout -b feature/amazing-feature
- Commit your changes:git commit -m "Add amazing feature"
- Push your branch:git push origin feature/amazing-feature
- Open a Pull Request.