agentleFS
dAAAbdAAAb/agent-skills/skills/base-wallet/SKILL.md

base-wallet

Skill2 starsChanged 8 months agoMITView on GitHub

πŸ” Base Wallet - Crypto Identity for AI Agents. Create wallets, sign messages (SIWE), send transactions programmatically. No browser extensions, no human intervention. The foundation for autonomous Web3 agents.

  • Reads credentials
  • Installs packages

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • β‰ˆ0

    Common Β· estimate

    Many files like this have a rule of this kind.

  • β‰ˆ2

    Distinctive Β· estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create and manage Base chain (Ethereum-compatible) wallets programmatically.

    line 19
  2. Distinctive:

    If you must store to file (not recommended):

    line 175
  3. Very specific:

    Add to your project's .gitignore:

    line 194

β‰ˆ β€œCommon” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. β€œVery specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

πŸ” Base Wallet - Crypto Identity for AI Agents

Every autonomous agent needs a wallet. Create one without human help.

TL;DR: Programmatic wallet creation on Base/Ethereum. SIWE auth, balance checks, transactions.

Why Base Wallet?

  • True autonomy β€” Your agent creates and controls its own wallet
  • No browser needed β€” Pure CLI, no extensions or popups
  • SIWE ready β€” Sign-In with Ethereum for Web3 services
  • Secure by default β€” Environment variables, no plaintext keys

Create and manage Base chain (Ethereum-compatible) wallets programmatically.


⚠️ Security First

βœ… DO❌ DON'T
Use environment variables for private keysStore private keys in plain text files
Set wallet files to chmod 600Commit wallet files to git
Use --env mode (recommended)Use console.log(privateKey)
Back up mnemonics offlineShare private keys or mnemonics

Quick Start

Create a New Wallet (Recommended)

# Output as environment variable format (safest)
node scripts/create-wallet.js --env

# Output example:
# export WALLET_ADDRESS="0x..."
# export PRIVATE_KEY="0x..."

Then copy to your shell or .env file.

Create with File Storage (Opt-in)

# Only if you need file-based storage
node scripts/create-wallet.js --managed my-agent

⚠️ This stores private key in ~/.openclaw/wallets/my-agent.json


Usage Examples

Load Wallet from Environment

const { ethers } = require('ethers');

// βœ… SECURE: Load from environment variable
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY);
console.log('Address:', wallet.address);
// ❌ NEVER: console.log('Private Key:', wallet.privateKey);

Load from Mnemonic

const wallet = ethers.Wallet.fromPhrase(process.env.MNEMONIC);

Check Balance

const provider = new ethers.JsonRpcProvider('https://mainnet.base.org');
const balance = await provider.getBalance(wallet.address);
console.log('Balance:', ethers.formatEther(balance), 'ETH');

Sign Message (SIWE)

const message = `example.com wants you to sign in with your Ethereum account:
${wallet.address}

Sign in message

URI: https://example.com
Version: 1
Chain ID: 8453
Nonce: ${nonce}
Issued At: ${new Date().toISOString()}`;

const signature = await wallet.signMessage(message);

Send Transaction

const provider = new ethers.JsonRpcProvider('https://mainnet.base.org');
const connectedWallet = wallet.connect(provider);

const tx = await connectedWallet.sendTransaction({
  to: recipientAddress,
  value: ethers.parseEther('0.001')
});

const receipt = await tx.wait();
console.log('TX Hash:', tx.hash);

Scripts

ScriptDescription
create-wallet.js --envCreate wallet, output as env vars (recommended)
create-wallet.js --managed [name]Create wallet, save to file (opt-in)
create-wallet.js --jsonCreate wallet, output as JSON
basemail-register.js [name]Register for BaseMail email
check-balance.js [address]Check wallet balance

BaseMail Integration

Register for a @basemail.ai email using your wallet signature.

# If using environment variable:
PRIVATE_KEY="0x..." node scripts/basemail-register.js

# If using managed wallet:
node scripts/basemail-register.js my-agent

Network Configuration

NetworkChain IDRPC URL
Base Mainnet8453https://mainnet.base.org
Base Sepolia84532https://sepolia.base.org

πŸ“ Audit Logging

Operations are logged to ~/.base-wallet/audit.log.


Secure Storage Pattern

// βœ… Recommended: Use environment variables
const privateKey = process.env.PRIVATE_KEY;
if (!privateKey) {
  throw new Error('PRIVATE_KEY environment variable not set');
}
const wallet = new ethers.Wallet(privateKey);

// ❌ Avoid: Storing private keys in code or files

If you must store to file (not recommended):

const fs = require('fs');
const path = require('path');

// Store with restricted permissions
const filepath = path.join(process.env.HOME, '.openclaw', 'wallets', 'wallet.json');
fs.writeFileSync(filepath, JSON.stringify({ 
  address: wallet.address,
  // Only store if absolutely necessary
  privateKey: wallet.privateKey
}), { mode: 0o600 }); // Owner read/write only

.gitignore

Add to your project's .gitignore:

# Wallet files - NEVER commit!
.openclaw/
*.wallet.json
*.mnemonic
private-key*

Dependencies

npm install ethers

Changelog

v1.1.0 (2026-02-08)

  • πŸ” Security: Changed create-wallet.js to opt-in file storage
  • ✨ Added --env mode (recommended)
  • πŸ“ Added audit logging
  • ⚠️ Removed console.log(privateKey) from examples
  • πŸ“„ Enhanced security documentation

v1.0.0

  • πŸŽ‰ Initial release

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.