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
| Requirement | Details |
|---|---|
| Network | Base (Chain ID: 8453) |
| Token | USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) |
| Minimum balance | $0.01 (one request) |
| Gas | Small 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 Type | How to Use |
|---|---|
| Private key | Account.from_key("0x...") |
| Mnemonic | Account.from_mnemonic("word1 word2 ...") |
| Hardware wallet | Via Web3 provider |
| MetaMask | Export private key |
| Coinbase Wallet | Export private key |
WARNING
Never share your private key. Store it securely.