Quickstart
You will create a Warden account on Base Sepolia, fund it, register an agent with a policy, and have the agent pay from it. The owner part takes a few minutes in the dashboard. The agent part is about ten lines of TypeScript.
Before you start#
- A browser wallet (MetaMask, Rabby, Coinbase Wallet or any injected wallet) holding a little Base Sepolia ETH for fees. The Base docs list faucets.
- Test USDC if you want the agent to pay in USDC. Circle's testnet faucet sends it on Base Sepolia.
- Node.js 20 or later for the agent code.
Warden v0.1 runs on Base Sepolia only, and its contracts are unaudited. Use test funds.
1. Create your account#
Open the dashboard and connect the wallet that will own the account. Choose Create account. The dashboard shows the address before you deploy: the factory derives it from your wallet and a salt, so you can send funds to it first if you like. One transaction deploys it.
The owner wallet is the most powerful key in the system. It sets policies, approves held payments and withdraws. A hardware wallet is the right home for it.
2. Fund it#
On Funds, deposit ETH or USDC. Token deposits take two transactions the first time: an allowance, then depositToken. Anyone can deposit; only the owner can withdraw.
3. Register an agent#
On Agents, choose Add agent.
- Paste the address of the key your agent will sign with, or choose Generate a new agent key. A generated key is shown once and never stored; copy it into your agent's secret store.
- Add a spending limit per token: the most per payment, the most per window, the window length, and the amount at or above which you want to approve each payment yourself.
- Allowlist the addresses the agent may pay or call. For a contract you can name the functions it may call.
- Set validity dates if the agent should only work for a while.
The editor shows the policy as it will be stored, with its hash, and warns about settings that do nothing (a threshold above the per-payment cap, for example). Review the transaction and sign it.
Then send the agent key a little ETH for gas. Agents sign their own transactions; the agent page has a button for it.
4. Let the agent pay#
The agent needs two things: its private key and the account address.
import { createWardenAgent } from "@warden/sdk";
import { createPublicClient, createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { baseSepolia } from "viem/chains";
const publicClient = createPublicClient({ chain: baseSepolia, transport: http() });
const walletClient = createWalletClient({
account: privateKeyToAccount(process.env.AGENT_KEY as `0x${string}`),
chain: baseSepolia,
transport: http(),
});
const agent = createWardenAgent({ publicClient, walletClient, account: process.env.WARDEN_ACCOUNT as `0x${string}` });
const result = await agent.pay({ token: "USDC", to: apiProvider, amount: "3", memo: "inv-1042" });pay asks the contract first with the free check view. If the payment is outside the policy it throws WardenDenied with the reason, before any gas is spent. If the amount is at or above your approval threshold, result.status is "pending_approval" with a requestId, and the payment waits for you on Approvals.
@warden/sdk lives in the Warden repository under packages/sdk and is not on npm yet. Build it from the workspace, or call the contract with viem directly; the SDK page has a check and pay example with plain viem.
5. Watch it happen#
Activity lists every event the account emits, newest first. A payment shows up as a Spent receipt with the agent, amount, recipient, memo and the hash of the policy it was spent under. Held payments appear on Approvals with the time left to decide.
Live addresses#
| Contract | Base Sepolia (84532) |
|---|---|
| WardenFactory | 0x1a4aA3C45E9fdF8845dBdfcAb6428f5f7D0272F6 |
| WardenAccount (implementation) | 0x2d8eFc03262f4cc905d344569a3f541B0233CA92 |
| Demo account | 0x6498509548D66e7b9F4CE1ae0a7463Ccd0dcDce4 |
| USDC (Circle test token) | 0x036CbD53842c5426634e7929541eC2318f3dCF7e |
Deployed at block 48,317,558.
Next#
- Concepts explains owners, agents, windows and approvals.
- Policy reference lists every field, default and denial reason.
- Security model says what Warden protects against and what it leaves to you.