How credits are created
1
Send SOL to the gateway
Transfer SOL to the gateway wallet address. The amount you send becomes your credit balance, denominated in lamports.
2
Helius webhook records the payment
The gateway listens for your transfer via the Helius webhook at
/api/payments/helius-webhook. Once the transaction is confirmed, a pending claim row is created in Postgres with a plaintext API key.3
Sign the challenge and claim
Use the challenge-response flow to prove wallet ownership. The server releases the API key and moves it from pending to active.
Key lifecycle
How spending works
The gateway applies a flat price per paid call: 2,200,000 lamports (0.0022 SOL). TherequirePayment middleware checks your key on every request:
- Free tier first: New keys get up to 50 lifetime free calls and 15 per day. The middleware consumes a free call when available.
- Paid tier after free: Once free calls are exhausted, the middleware deducts 2,200,000 lamports from
credit_balance_lamports. - Insufficient balance: If your balance is below the flat fee, the request is rejected with HTTP 402 and instructions to top up.
The gateway stores only a SHA-256 hash of your key for lookups. The plaintext key is kept in
pending_claims until you claim it, after which you must store it securely. If you lose it, send more SOL and claim again.