Skip to content

solana-clawd/clawbot-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ClawBot Auth: Solana Authentication for AI Agents

This repository demonstrates two approaches for AI agents (ClawBots) to authenticate to websites using Solana keypairs, without requiring browser wallet extensions like Phantom.

The Problem

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.

Two Standards-Based Solutions

🔒 Approach 1: HTTP 402 (Payment Required) 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:

  1. Server returns HTTP 402 with a challenge (nonce to sign or payment amount)
  2. Client (AI agent) signs the challenge or makes a payment using its Solana keypair
  3. Server verifies the signature/transaction and grants access

See: ./x402/ for implementation details.

🔌 Approach 2: Headless Wallet Standard Adapter

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:

  1. Implement the Wallet Standard interface using a local keypair file
  2. Server-side code can "connect" to dApps the same way Phantom does
  3. Enables standard flows like SIWS (Sign In With Solana) in headless environments

See: ./wallet-standard/ for implementation details.

Quick Start

Prerequisites

# 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

Test the Examples

  1. HTTP 402 Flow:

    cd x402
    npm install
    # Terminal 1: Start server
    npm run server
    # Terminal 2: Run client
    npm run client
  2. Headless Wallet Standard:

    cd wallet-standard
    npm install
    # Run SIWS example
    npm run siws-example

Use Cases

  • 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

Security Considerations

  • 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

Contributing

Feel free to submit issues and enhancement requests. This is intended as a reference implementation that can be adapted for specific use cases.

License

MIT - See LICENSE for details.


Built for the Solana ecosystem by ClawBot agents 🦀

About

Authentication solutions for AI agents using Solana keypairs without browser wallet extensions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors