Using Privy Server Wallets with OpenClaw
Enable your AI agent to autonomously execute onchain transactions using Privy server wallets. This recipe shows how to set up an OpenClaw agent with its own wallet, complete with policy-based guardrails.What is OpenClaw?
OpenClaw is an open-source framework for running AI agents that can interact with external tools and services. By combining OpenClaw with Privy server wallets, you can create agents that autonomously execute blockchain transactions within defined policy constraints.About OpenClaw: OpenClaw is a community-driven project. Privy does not maintain, endorse, or
provide support for OpenClaw. For OpenClaw-specific issues, please refer to their GitHub
repository and Discord
community.
Use Cases
What can autonomous agents do with their own wallets?- Trading & DeFi: Execute swaps, rebalance portfolios, compound yields
- Payments: Pay for API calls, tip creators, handle subscriptions
- On-chain Automation: Vote in governance, renew ENS domains, bridge assets
- Agent-to-Agent: Pay other agents for tasks, escrow funds, settle debts
- NFTs: Mint, purchase, and manage digital assets
Prerequisites
- A Privy account with API credentials (dashboard.privy.io)
- OpenClaw installed and configured
- Node.js 18+
Installation
Option 1: Install from ClawHub (Recommended)
The easiest way to install the skill:Don’t have ClawHub? Install it first:
npm i -g clawhubOption 2: Clone from GitHub
Alternatively, clone directly into your workspace:Configure Privy Credentials
Add your Privy credentials to your OpenClaw config (~/.openclaw/openclaw.json):
Restart OpenClaw
Usage
Once configured, your OpenClaw agent can interact with Privy wallets through natural language commands.Create a Wallet
Ask your agent:“Create an Ethereum wallet for yourself using Privy”The agent will call the Privy API to create a server wallet and return the address.
Create a Policy
Policies define guardrails for what the agent can do:“Create a policy that limits transactions to 0.1 ETH max, only on Base mainnet”
Attach Policy to Wallet
“Attach the spending limit policy to my wallet”
Execute a Transaction
“Send 0.01 ETH to 0x1234… on Base”The agent will execute the transaction through Privy’s RPC endpoint, subject to any attached policies.
Policy Examples
Spending Limit
Restrict maximum value per transaction:Chain Restriction
Lock the wallet to a specific chain:Contract Allowlist
Only allow interactions with specific contracts:How It Works
- Agent receives request: User asks the agent to perform a wallet operation
- Skill provides context: OpenClaw loads the Privy skill which teaches the agent how to use the API
- API authentication: Agent uses stored credentials to authenticate with Privy
- Policy enforcement: Privy validates the transaction against attached policies
- Transaction execution: If policies allow, Privy signs and broadcasts the transaction
- Result returned: Agent reports the transaction hash or error to the user
Security Considerations
Supported Chains
| Chain | chain_type | CAIP-2 |
|---|---|---|
| Ethereum | ethereum | eip155:1 |
| Base | ethereum | eip155:8453 |
| Polygon | ethereum | eip155:137 |
| Arbitrum | ethereum | eip155:42161 |
| Optimism | ethereum | eip155:10 |
| Solana | solana | solana:mainnet |
Testing
For testnet development:- Create wallets on Base Sepolia (chain ID 84532)
- Get testnet ETH from Base Sepolia Faucet
- Test transactions before moving to mainnet
Troubleshooting
“Credentials not configured”- Ensure
PRIVY_APP_IDandPRIVY_APP_SECRETare set in your OpenClaw config - Restart the gateway after config changes
- Check your policy conditions match the transaction parameters
- Verify chain_id matches the target network
- Confirm the wallet ID exists in your Privy dashboard
- Ensure you’re using the correct App ID

