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.
Install this skill
Claude Code / Cursor (user-level, ~/.claude/skills is read by both):
npx skills add 1Shot-API/skills/agent-wallet -g -a claude-code -y
cd ~/.claude/skills/agent-wallet/scripts && npm installAny agent / cloud sandbox:
git clone --depth 1 https://github.com/1Shot-API/skills.git
cd skills/agent-wallet/scripts && npm installnpm 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
node scripts/aw.mjs doctor- If
depsOkis false →cd scripts && npm install(path indepsInstallHint). - If
castis null → fine for create/SIWE/auth7702/redelegate;foundryHintlists commands that still need cast.
Create a wallet (idempotent; show the user address only):
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
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.jsonDelegation input schema, scopes, amounts, and 7702: 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.
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) 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.
# 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
- Run
doctorbefore first use; fixnpm installfrom its hints. Install Foundry only if you needsend/mktx/sign-typed. - After
create, tell the user the address only — never open or dump the password file or keystore JSON into chat. - Do not run
cast wallet private-key,cast wallet newwithout--unsafe-password, or interactive password prompts. - For EIP-7710 submit/redeem, use skill public-relayer (
relayer_*) — notaw send. - Treat stdout as the only success channel; parse JSON (
ok: true). BigInts in auth are stringified safely.
Storage layout
See references/storage.md. Tier B only in v1: encrypted keystore + 0600 password file. OS keyring deferred.
See also
- references/casting.md — cast flag mapping (optional path)
- references/security.md — threat model
- 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