This repository demonstrates two approaches for AI agents (ClawBots) to authenticate to websites using Solana keypairs, without requiring browser wallet extensions like Phantom.
AI agents running on servers typically have access to Solana keypairs stored as JSON files, but they cannot use browser-based wallet extensions that websites expect for authentication. This creates a barrier for agents trying to access services like the Helius dashboard or other Web3 platforms that require wallet-based authentication.
The HTTP 402 status code was originally designed to facilitate payment for access to resources. We demonstrate how Solana signatures or transactions can serve as the "payment" mechanism for authentication.
How it works:
- Server returns HTTP 402 with a challenge (nonce to sign or payment amount)
- Client (AI agent) signs the challenge or makes a payment using its Solana keypair
- Server verifies the signature/transaction and grants access
See: ./x402/ for implementation details.
The Solana Wallet Standard defines how wallets interact with dApps but assumes a browser context. We create an adapter that implements this interface for server environments.
How it works:
- Implement the Wallet Standard interface using a local keypair file
- Server-side code can "connect" to dApps the same way Phantom does
- Enables standard flows like SIWS (Sign In With Solana) in headless environments
See: ./wallet-standard/ for implementation details.
# Install Node.js dependencies
npm install @solana/web3.js @wallet-standard/base @solana/wallet-standard-features
# Ensure you have a Solana keypair (example path)
# ~/.openclaw/workspace/solana-wallet.json-
HTTP 402 Flow:
cd x402 npm install # Terminal 1: Start server npm run server # Terminal 2: Run client npm run client
-
Headless Wallet Standard:
cd wallet-standard npm install # Run SIWS example npm run siws-example
- Dashboard Access: AI agents authenticating to analytics dashboards
- DeFi Automation: Bots accessing DeFi protocols without manual wallet connections
- API Access: Services that require wallet ownership verification
- Cross-Platform Integration: Server-side applications interacting with Solana dApps
- Store keypairs securely on the server (appropriate file permissions)
- Use HTTPS for all authentication flows
- Implement proper challenge-response mechanisms to prevent replay attacks
- Consider using derived keypairs for specific services rather than main wallet keys
Feel free to submit issues and enhancement requests. This is intended as a reference implementation that can be adapted for specific use cases.
MIT - See LICENSE for details.
Built for the Solana ecosystem by ClawBot agents 🦀