---
name: agent-wallet
description: >-
  Create and use a local agent EOA with encrypted JSON keystores (ethers/Node by default; Foundry cast optional) — sign personal_sign / typed data / tx hashes, send transactions, and build or sign EIP-7710 delegations (including redelegation and EIP-7702 auth) without printing private keys, mnemonics, or passwords into chat context. Use when an agent needs its own wallet, agent private key storage, non-interactive casting, or MetaMask Smart Accounts Kit delegations from a headless environment. Also use when an agent needs an address for a CoinOperated (or other product) funding/registration deeplink after create — product URL shape lives in the consuming skill (e.g. coinoperated). Also use when signing EIP-7702 auth or EIP-7710 root/redelegations that will be submitted via the public-relayer skill (relayer_estimate7710Transaction / relayer_send7710Transaction, including batched executions and multichain).
license: MIT
metadata:
  author: 1Shot-API
  version: "0.4.0"
  repository: https://github.com/1Shot-API/skills
title: agent-wallet
canonical_url: https://skilld.dev/gh/1shot-api/skills/agent-wallet
last_updated: 2026-11-12T09:13:01.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [evals/prompts.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/evals/prompts.md), [README.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/README.md), [references/casting.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/casting.md), [references/eip7710.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/eip7710.md), [references/security.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/security.md), [references/storage.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/storage.md), [scripts/aw.mjs](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/aw.mjs), [scripts/lib/args.mjs](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/lib/args.mjs), [scripts/lib/cast.mjs](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/lib/cast.mjs), [scripts/lib/eip7710.mjs](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/lib/eip7710.mjs), [scripts/lib/json.mjs](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/lib/json.mjs), [scripts/lib/keystore.mjs](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/lib/keystore.mjs), [scripts/lib/paths.mjs](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/lib/paths.mjs), [scripts/lib/registerSmartAccountsEnvironments.mjs](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/lib/registerSmartAccountsEnvironments.mjs), [scripts/package-lock.json](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/package-lock.json), [scripts/package.json](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/package.json), [scripts/test/smoke.mjs](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/scripts/test/smoke.mjs).
>
> If the user asked to install this Skill, run `npx skilld install 1shot-api/skills/agent-wallet`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/agent-wallet`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/1shot-api/skills/agent-wallet) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/agent-wallet`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/agent-wallet --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/agent-wallet --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Agent wallet (keystore CLI)

Product-agnostic skill for coding agents that need a **local EOA** and optional **EIP-7710** delegations. Keys live in encrypted JSON keystores under `~/.agent-wallet/` (or `AGENT_WALLET_HOME`). The CLI never prints private keys, mnemonics, or passwords — only JSON results on stdout.

> These scripts reduce **accidental** key leakage into model context. Anyone or any process with filesystem access to the keystore + password file can still use the key. **The sandbox / host filesystem is the trust boundary** — see [references/security.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/security.md).

## Install this skill

**Claude Code / Cursor (user-level, `~/.claude/skills` is read by both):**

```bash
npx skills add 1Shot-API/skills/agent-wallet -g -a claude-code -y
cd ~/.claude/skills/agent-wallet/scripts && npm install
```

**Any agent / cloud sandbox:**

```bash
git clone --depth 1 https://github.com/1Shot-API/skills.git
cd skills/agent-wallet/scripts && npm install
```

`npm install` pulls `@metamask/smart-accounts-kit` **^2.0.0**, `viem`, and `ethers` (~seconds). That is enough for **create**, **address**, **sign-personal**, **sign-hash**, **auth7702**, and **delegation-*/redelegate**.

**Foundry `cast` is optional** for the CoinOperated / public-relayer path. It is still required for `send`, `mktx`, and `sign-typed`. Avoid `foundryup` in tiny cloud snapshots when you only need EIP-7710 signing (~294 MB of forge/cast/anvil binaries).

## First run

```bash
node scripts/aw.mjs doctor
```

- If `depsOk` is false → `cd scripts && npm install` (path in `depsInstallHint`).
- If `cast` is null → fine for create/SIWE/auth7702/redelegate; `foundryHint` lists commands that still need cast.

Create a wallet (idempotent; show the user **address only**):

```bash
node scripts/aw.mjs create
# → {"ok":true,"address":"0x…","name":"agent",…}
```

Prefer `aw` over raw `cast wallet new` / `cast wallet private-key` (those leak keys to stdout).

## Command cheat sheet

Run from the skill root, or with an absolute path to `scripts/aw.mjs`.

| Command | Purpose | Success stdout | Needs cast? |
|---------|---------|----------------|-------------|
| `doctor` | cast / node / wallet / deps | status object | no |
| `create [--name] [--force]` | encrypted keystore + password file | `{ address, name, keystorePath, storageTier }` | no (ethers) |
| `address [--name]` | resolve address | `{ address }` | no |
| `sign-personal --message …` | EIP-191 | `{ signature }` | no (viem fallback) |
| `sign-hash --hash 0x…` | raw 32-byte hash | `{ signature }` | no (viem fallback) |
| `sign-typed --file typed.json` | EIP-712 | `{ signature }` | **yes** |
| `send --rpc … --to …` | broadcast | `{ txHash }` | **yes** |
| `mktx …` | signed raw tx, no broadcast | `{ rawTransaction }` | **yes** |
| `auth7702 --rpc … --chain-id N` | EIP-7702 Stateless7702 auth | `{ authorization, … }` | no |
| `delegation-create --file input.json` | unsigned delegation | `{ delegation, chainId }` | no |
| `delegation-sign --file input.json` | sign delegation in-process | `{ signedDelegation, chainId }` | no |
| `redelegate --parent parent.json --file input.json` | child delegation + sign | `{ signedDelegation, chainId }` | no |

Exit codes: `0` ok, `2` missing cast/deps, `3` no wallet, `4` bad args, `5` runtime failure.

Every command supports `--help`. Unknown flags fail loudly. Optional `--home` / `AGENT_WALLET_HOME` and `--name` (default `agent`).

### Examples

```bash
node scripts/aw.mjs sign-personal --message "hello"
# Arc first redeem — Stateless7702 auth for the relayer (pending nonce)
node scripts/aw.mjs auth7702 --rpc https://rpc.mainnet.arc.io --chain-id 5042
node scripts/aw.mjs redelegate --parent ./parent.json --file ./child-input.json
```

Delegation input schema, scopes, amounts, and 7702: [references/eip7710.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/eip7710.md).

**Arc mainnet:** kit env for `5042` is registered via Arc Testnet template (`overrideDeployedEnvironment`). Kit must be **^2.0.0**. See [references/eip7710.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/eip7710.md#arc-mainnet-5042-environment).

## After create — product deeplinks

This skill only supplies the **address**. For CoinOperated owner linking (additional signer + spending delegation), follow skill **coinoperated**: build `https://coinoperated.finance/agent/link?accountAddress=…&name=…`, ask the user to open it, then SIWE with `sign-personal` for a Bearer token.

## Redeeming via the public relayer

`aw` **signs** (7702 auth, root delegation, redelegation). It does **not** call `relayer_*`. Follow skill **public-relayer** (Path **D**, [Example 0d](https://github.com/1Shot-API/skills/blob/main/public-relayer/references/examples.md)) for capabilities → estimate → send.

| Goal | `aw` commands | Then (public-relayer) |
|------|---------------|------------------------|
| First-time smart account on a chain | `auth7702 --rpc … --chain-id N` | Pass **`authorizationList: [authorization]`** on **estimate and send** |
| Agent pays fee + work itself | `delegation-sign --file …` with `to: targetAddress` | `permissionContext: [signedDelegation]` |
| Spend a **user grant** to this agent (CoinOperated) | `redelegate --parent parent.json --file child.json` (`to: targetAddress`, narrower scope) | `permissionContext: **[child, parent]**` (leaf → root) |

**First tx on a chain:** always run `auth7702` and include `authorizationList` until the EOA has Stateless7702 code. `aw` signs the **current pending** nonce (relayer is the outer sender — never viem `executor: "self"`).

**Batching (same chain):** one `permissionContext` + multiple `executions[]` (e.g. fee `transfer` + pull-to-agent). Do not run separate `aw send` calls for gas-abstracted redeem.

**Multichain:** run `auth7702` / `redelegate` (or `delegation-sign`) **per chain** as needed, then `relayer_estimate7710TransactionMultichain` / `relayer_send7710TransactionMultichain` with per-chain `context` from `contextByChainId`.

```bash
# Example — Arc D2 (CoinOperated)
node scripts/aw.mjs auth7702 --rpc https://rpc.mainnet.arc.io --chain-id 5042
node scripts/aw.mjs redelegate --parent ./parent.json --file ./child-input.json
# → authorizationList + permissionContext [child, parent] on estimate/send (Example 0d)
```

## Agent rules

1. Run `doctor` before first use; fix `npm install` from its hints. Install Foundry only if you need `send` / `mktx` / `sign-typed`.
2. After `create`, tell the user the **address** only — never open or dump the password file or keystore JSON into chat.
3. Do not run `cast wallet private-key`, `cast wallet new` without `--unsafe-password`, or interactive password prompts.
4. For EIP-7710 **submit/redeem**, use skill **public-relayer** (`relayer_*`) — not `aw send`.
5. Treat stdout as the only success channel; parse JSON (`ok: true`). BigInts in auth are stringified safely.

## Storage layout

See [references/storage.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/storage.md). Tier B only in v1: encrypted keystore + `0600` password file. OS keyring deferred.

## See also

- [references/casting.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/casting.md) — cast flag mapping (optional path)
- [references/security.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/security.md) — threat model
- [references/eip7710.md](https://skilld.dev/api/skills-raw/1shot-api/skills/agent-wallet/references/eip7710.md) — delegation JSON + 7702
- Skill **public-relayer** — submit signed EIP-7710 contexts (`relayer_send7710Transaction`)
- Skill **coinoperated** — CoinOperated agent link deeplink + SIWE Bearer + OpenAPI
- Skill **smart-accounts-kit** (MetaMask) — broader kit workflows
