Skip to main content
RelAI is a hosted facilitator service that simplifies x402 payment processing on SKALE Network. Instead of running your own facilitator infrastructure, you can use RelAI’s SDK to handle payment verification and settlement across multiple tokens.

Highlights

The RelAI facilitator has enabled BITE transactions for both SKALE Base and SKALE Base Sepolia. What does this mean?
  • When a merchant settles any x402 transaction through RelAI facilitator it gets automatically encrypted through BITE and only decrypted at the consensus level
For more inforamtion around BITE please check here.

Prerequisites

  • Node.js and npm installed
  • A wallet on SKALE Base or SKALE Base Sepolia
  • Basic understanding of x402 protocol

Configuration

Environment Variables

Create a .env file with RelAI configuration:
# Your wallet address to receive payments
PAYMENT_RECEIVER_ADDRESS=0xYourWalletAddressHere

# Private key for client (NEVER commit this!)
PRIVATE_KEY=0xYourPrivateKeyHere

# Server port
PORT=3000

# Price for premium endpoint (in USD)
PREMIUM_PRICE=0.01

Supported Networks and Tokens

RelAI supports the following SKALE networks:
NetworkTokens
SKALE Base SepoliaUSDC, USDT, ETH, SKL, WBTC
SKALE BaseUSDC, USDT, ETH, SKL, WBTC

Integration with RelAI

Make sure to install the RelAI SDK:
 npm install @relai-fi/x402
import express from 'express';
import cors from 'cors';
import dotenv from 'dotenv';
import Relai from '@relai-fi/x402/server';

dotenv.config();

const app = express();
const PORT = process.env.PORT || 3000;

// Middleware
app.use(cors());
app.use(express.json());

// Initialize RelAI SDK for SKALE Base Sepolia
const relai = new Relai({
  network: 'skale-base-sepolia',
  facilitatorUrl: 'https://facilitator.x402.fi'
});

// Public endpoint - no payment required
app.get('/api/public', (req, res) => {
  res.json({
    message: 'This is a public endpoint - no payment required',
    network: 'SKALE Base Sepolia'
  });
});

// Premium endpoint - protected by x402 payment
app.get(
  '/api/premium',
  relai.protect({
    payTo: process.env.PAYMENT_RECEIVER_ADDRESS!,
    price: parseFloat(process.env.PREMIUM_PRICE || '0.01'),
  }),
  (req, res) => {
    // Payment is automatically verified by the middleware
    // req.payment contains the payment details
    res.json({
      success: true,
      message: 'Premium data unlocked via RelAI!',
      payment: req.payment
    });
  }
);

// Start server
app.listen(PORT, () => {
  console.log(`Server running on http://localhost:${PORT}`);
});

Troubleshooting

Connection Issues

If you cannot connect to RelAI:
  1. Verify the facilitator URL is correct
  2. Check network connectivity
  3. Ensure your wallet has tokens for gas fees
  4. Review firewall settings

Payment Failures

Common causes and solutions:
IssueSolution
Invalid signatureVerify wallet configuration and signing
Insufficient balanceEnsure payer has enough tokens
Network mismatchCheck network matches configuration
Invalid receiverVerify PAYMENT_RECEIVER_ADDRESS is correct

Next Steps

Resources


This entity — RelAI — is deployed and actively supporting SKALE. These are 3rd party services that may have their own terms and conditions and privacy policies. Use these services at your own risk. AI and agents is a highly experimental space; the 3rd party software solutions may have bugs or be unaudited. You and your agents and your customers use all 3rd party services chosen at your own risk and per their terms.