Prerequisites
Ensure you have Bun v1.3.1 or newer installed on your machine. You’ll also need a funded wallet with SKALE Credits (CRED) and AxiosUSD tokens on SKALE Base Sepolia Testnet.- Install Bun, prefer the most recent version when possible
- A private key to represent yourself as the facilitator
- SKALE Credits (CRED) for gas fees - request from the SKALE Base Sepolia Faucet
- AxiosUSD tokens for payment facilitation - request from TheGreatAxios or join the FAIR + SKALE Builders Telegram
Step 1: Clone and Setup the Facilitator Project
Fork and clone your fork of the facilitator project and install dependencies:Step 2: Set Up Your Wallet
Add your private key to the.env file:
Step 3: Start the Facilitator
Run the facilitator using Bun’s development mode:Step 4: Verify the Facilitator is Running
Check that the facilitator is working correctly:How It Works
The facilitator acts as the payment processor in the x402 protocol:- Client Request: A buyer makes a request to a paid API endpoint
- Payment Required: Server responds with
402 Payment Requiredand payment details - Payment Authorization: Client signs a payment authorization using EIP-3009
- Payment Submission: Client submits the signed authorization to the facilitator
- Payment Processing: Facilitator validates and executes the transfer (gasless for clients)
- Access Granted: Server grants access to the protected resource
Configuration Options
The facilitator is pre-configured for SKALE Base Sepolia Testnet with Axios USD token support. Key configuration details:- Chain ID:
2140350733(SKALE Base Sepolia Testnet) - RPC URL:
https://base-sepolia-testnet.skalenodes.com/v1/basic-defiant-hadar - Token: Axios USD at
0x61a26022927096f444994dA1e53F0FD9487EAfcf - Forwarder: Same address (EIP-3009 compliant for gasless transfers)
Error Handling
Common issues and solutions:-
“EVM_PRIVATE_KEY is not set”
- Ensure your
.envfile exists and contains the private key - Verify the key starts with
0xand is 64 characters long
- Ensure your
-
“EVM_PRIVATE_KEY is not a valid hex string”
- Check that the private key contains only valid hexadecimal characters
- Ensure no extra spaces or characters are present
-
“Insufficient funds for gas”
- Fund your wallet with SKALE Credits (CRED) from the faucet
- The facilitator needs CRED to pay for transaction gas fees
-
“Execution reverted”
- Ensure your wallet has sufficient AxiosUSD balance
- Verify the token contract address is correct
Next Steps
Once your facilitator is running:- Create SKALE services using Faremeter middleware
- Create Base Sepolia services using x402-hono middleware
- Buy from x402 services using the Faremeter client SDK
- Contract Dirt Road Dev for support, questions, or to request a quote for work