Skip to content

Authentication (x402 Protocol)

4SEC uses the x402 protocol for authentication and payment. No API keys, no signup — just your Ethereum wallet.

How It Works

Client          4SEC API          Base Chain

|                |                  |
| GET /price/ETH |                  |
|--------------->|                  |
|                |                  |
| 402 + payment  |                  |
| requirements   |                  |
|<---------------|                  |
|                |                  |
| Sign USDC      |                  |
| transfer       |                  |
|---------------------------------->|
|                |                  |
| Retry +        |                  |
| payment proof  |                  |
|--------------->| Verify payment   |
|                |----------------->|
|                | Confirmed        |
|                |<-----------------|
|                |                  |
| 200 + data     |                  |
|<---------------|                  |

No API Key Needed

You don't need:

  • API keys
  • OAuth tokens
  • Signup forms
  • Email verification
  • Credit card on file

You only need:

  • An Ethereum wallet (any wallet)
  • Some USDC on Base network
  • x402 client SDK

Wallet Requirements

RequirementDetails
NetworkBase (Chain ID: 8453)
TokenUSDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913)
Minimum balance$0.01 (one request)
GasSmall amount of ETH (~$0.001)

Payment Caching

  • First request: Pays $0.01 + signs transaction
  • Same request within 30s: FREE (cached payment proof)
  • After 30s: New payment required

Security

  • Your private key never leaves your machine
  • Payment is signed locally and sent as proof
  • The API verifies the signature on-chain
  • No custodial risk — you control your funds

Supported Wallets

Wallet TypeHow to Use
Private keyAccount.from_key("0x...")
MnemonicAccount.from_mnemonic("word1 word2 ...")
Hardware walletVia Web3 provider
MetaMaskExport private key
Coinbase WalletExport private key

WARNING

Never share your private key. Store it securely.

Released under the MIT License.