ChainsTestnets

Testnets

Testing T402 integration on testnet networks before production deployment.

Why Use Testnets?

  • Free tokens - No real funds required
  • Safe testing - No financial risk
  • Same behavior - Identical to mainnet
  • Debug easily - Block explorers available

EVM Testnets

Supported Networks

ChainNetwork IDFaucet
Sepoliaeip155:11155111sepoliafaucet.com
Base Sepoliaeip155:84532base.org/faucet
Arbitrum Sepoliaeip155:421614faucet.arbitrum.io
Optimism Sepoliaeip155:11155420faucet.optimism.io
Ink Sepoliaeip155:763373faucet.ink.xyz
Berachain bArtioeip155:80084faucet.berachain.com
Unichain Sepoliaeip155:1301faucet.unichain.org

RPC Endpoints

const testnetRpcs = {
  'eip155:11155111': 'https://rpc.sepolia.org',
  'eip155:84532': 'https://sepolia.base.org',
  'eip155:421614': 'https://sepolia-rollup.arbitrum.io/rpc',
  'eip155:11155420': 'https://sepolia.optimism.io',
};

Test USDT Addresses

ChainAddress
Sepolia0x... (deploy your own)
Base Sepolia0x... (deploy your own)

For EVM testnets, you may need to deploy your own test USDT contract or use existing test tokens.

Configuration Example

// testnet-config.ts
const testnetRoutes = {
  '/api/test/*': {
    accepts: [
      {
        scheme: 'exact',
        network: 'eip155:84532', // Base Sepolia
        payTo: '0xYourTestAddress',
        price: '$0.001',
      },
    ],
  },
};

TON Testnet

Network Details

PropertyValue
Network IDton:testnet
RPChttps://testnet.toncenter.com/api/v2/jsonRPC
Faucet@testgiver_ton_bot

Test USDT Jetton

PropertyValue
Jetton MasterkQD0GKBM8ZbryVk2aESmzfU6b9b_8era_IkvBSELujFZPsyy
Decimals6

Configuration

const tonTestnetConfig = {
  network: 'ton:testnet',
  jettonMaster: 'kQD0GKBM8ZbryVk2aESmzfU6b9b_8era_IkvBSELujFZPsyy',
  rpcUrl: 'https://testnet.toncenter.com/api/v2/jsonRPC',
};

TRON Testnets

Nile Testnet

PropertyValue
Network IDtron:nile
RPChttps://nile.trongrid.io
Faucetnileex.io/faucet

Shasta Testnet

PropertyValue
Network IDtron:shasta
RPChttps://api.shasta.trongrid.io
Faucetshasta.tronscan.org

Test USDT

NetworkContract
NileTXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf

Solana Testnets

Devnet

PropertyValue
Network IDsolana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1
RPChttps://api.devnet.solana.com
Faucetsolana airdrop 1 (CLI)

Test USDC

# Request devnet SOL
solana airdrop 1 --url devnet
 
# Test USDC on devnet
# Mint: 4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU

NEAR Testnet

Network Details

PropertyValue
Network IDnear:testnet
RPChttps://rpc.testnet.near.org
Faucetnear.org/wallet

Test USDT

PropertyValue
Contractusdt.fakes.testnet
Decimals6

Configuration

const nearTestnetConfig = {
  network: 'near:testnet',
  rpcUrl: 'https://rpc.testnet.near.org',
  tokenContract: 'usdt.fakes.testnet',
};

Aptos Testnet

Network Details

PropertyValue
Network IDaptos:2
RPChttps://fullnode.testnet.aptoslabs.com/v1
Faucetaptoslabs.com/faucet

Tezos Ghostnet

Network Details

PropertyValue
Network IDtezos:NetXnHfVqm9iesp
RPChttps://ghostnet.tezos.marigold.dev
Faucetfaucet.ghostnet.teznet.xyz

Polkadot Westend

Network Details

PropertyValue
Network IDpolkadot:e143f23803ac50e8f6f8e62695d1ce9e
Asset ID1984
Faucetfaucet.polkadot.io

Stacks Testnet

Network Details

PropertyValue
Network IDstacks:2147483648
RPChttps://api.testnet.hiro.so
Faucetexplorer.hiro.so/faucet

Cosmos Testnet (Noble Grand)

Network Details

PropertyValue
Network IDcosmos:grand-1
RPChttps://rpc.testnet.noble.strange.love
RESThttps://api.testnet.noble.strange.love
TokenUSDC (uusdc)

Testing Best Practices

1. Environment Variables

# .env.test
NODE_ENV=test
T402_NETWORK=eip155:84532
T402_RPC_URL=https://sepolia.base.org
T402_PAY_TO=0xYourTestAddress
T402_FACILITATOR_URL=https://facilitator.t402.io

2. Conditional Configuration

const isTestnet = process.env.NODE_ENV === 'test';
 
const config = {
  network: isTestnet ? 'eip155:84532' : 'eip155:8453',
  facilitator: 'https://facilitator.t402.io', // Same for both
};

3. Integration Tests

import { describe, it, expect } from 'vitest';
import { t402Client } from '@t402/core/client';
 
describe('T402 Integration', () => {
  it('should complete payment flow', async () => {
    const client = new t402Client();
    // ... setup with testnet
 
    const response = await client.fetch('https://api.example.com/test');
    expect(response.ok).toBe(true);
  });
});

4. Faucet Automation

// scripts/fund-test-wallet.ts
async function fundWallet(address: string, network: string) {
  switch (network) {
    case 'eip155:84532':
      // Base Sepolia faucet
      await requestBaseSepolia(address);
      break;
    case 'ton:testnet':
      console.log('Use @testgiver_ton_bot on Telegram');
      break;
    // ... other networks
  }
}

Facilitator Testnet Support

The public facilitator supports all testnets:

# Check supported networks
curl -s https://facilitator.t402.io/supported | jq '.kinds[] | select(.network | contains("testnet") or contains("sepolia"))'

The facilitator service handles both mainnet and testnet transactions. No separate testnet facilitator needed.