Repository navigation
Operator Quickstart
Get your AI agent protected in under 5 minutes.
- Node.js 20+
- An AI agent that signs Ethereum transactions (via ethers.js, viem, or MCP tools)
npm install @wardexai/core @wardexai/signer
# Optional: on-chain intelligence
npm install @wardexai/intelligenceimport { createWardex, defaultPolicy } from '@wardexai/core';
const wardex = createWardex({
policy: defaultPolicy(),
signer: { type: 'isolated-process', endpoint: '/tmp/wardex-signer.sock' },
mode: 'adaptive',
});That's it. Your agent now has a full security evaluation pipeline.
Every transaction your agent wants to sign should go through Wardex first:
const verdict = await wardex.evaluate({
to: '0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45', // Uniswap V3
value: '100000000000000000', // 0.1 ETH
chainId: 1,
});
if (verdict.decision === 'approve') {
// Safe to sign and send
} else if (verdict.decision === 'advise') {
// Warn user, ask for confirmation
console.log('Risks:', verdict.reasons.map(r => r.message));
} else {
// Block or freeze - do NOT proceed
console.log('BLOCKED:', verdict.reasons.map(r => r.message));
}If your agent gets instructions from LLM conversations or MCP tools, pass the context:
const verdict = await wardex.evaluateWithContext(transaction, {
messages: conversationHistory,
source: {
type: 'mcp-server',
identifier: 'defi-skill',
trustLevel: 'medium',
},
toolCallChain: recentToolCalls,
});Wardex detects 10 injection patterns including "ignore previous instructions", base64 encoded commands, role overrides, and cross-MCP manipulation.
Prevent your agent from leaking keys or seed phrases in its responses:
const filtered = wardex.outputFilter.filterText(agentResponse);
// Any private keys, seed phrases, or keystore data → [REDACTED BY WARDEX]
const safeResponse = filtered.filtered;Wrap your existing ethers.js or viem provider — zero code changes required:
import { wrapEthersSigner } from '@wardexai/core';
const protectedSigner = wrapEthersSigner(existingSigner, wardex);
// Use protectedSigner exactly like your original signer
// All sendTransaction calls are automatically evaluatedimport { wrapViemWalletClient } from '@wardexai/core';
const protectedClient = wrapViemWalletClient(existingClient, wardex);
// Use protectedClient exactly like your original clientScope your agent's signing authority with time-bounded, contract-limited sessions:
import { SessionManager } from '@wardexai/signer';
const sessions = new SessionManager();
const session = sessions.createSession({
allowedContracts: ['0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45'], // Uniswap only
maxValuePerTx: '1000000000000000000', // 1 ETH max per tx
maxDailyVolume: '10000000000000000000', // 10 ETH daily cap
durationSeconds: 3600, // 1 hour session
forbidInfiniteApprovals: true, // Block unlimited approvals
});
// Validate every transaction against session limits
const check = sessions.validateTransaction(session.id, tx.to, tx.value);
if (!check.valid) {
console.log('Session rejected:', check.reason);
}claude mcp add wardex npx @wardexai/mcp-servernpm install @wardexai/claude-skill
# Merge settings-template.json into your .claude/settings.jsonThe hooks automatically intercept wallet MCP tool calls (mcp__wallet__*, mcp__eth__*, etc.) and evaluate them before execution.
Deploy the WardexValidationModule to your ERC-4337 smart account for defense in depth:
cd packages/contracts
forge build
forge script script/Deploy.s.sol --rpc-url $RPC_URL --broadcastEven if the SDK is bypassed, on-chain spending limits and approval verification hold.
const policy = defaultPolicy();
policy.allowlists.contracts.push(
'0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', // Uniswap V2
);policy.denylists.addresses.push(
'0xdead000000000000000000000000000000000001',
);// Make the Guardian tier (default: $100-$10K) stricter
policy.tiers[2].enforcement.blockThreshold = 50; // Block at score 50 (default 70)policy.limits.maxTransactionValueWei = '5000000000000000000'; // 5 ETH max per tx
policy.limits.maxDailyVolumeWei = '50000000000000000000'; // 50 ETH dailyconst wardex = createWardex({
policy,
signer: { type: 'isolated-process', endpoint: '/tmp/signer.sock' },
mode: 'adaptive',
intelligence: {
rpcUrl: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
chainId: 1,
denylistPath: './denylist.json',
explorerApiKey: 'YOUR_ETHERSCAN_KEY',
},
});const wardex = createWardex({
// ...config
onBlock: (event) => {
// Alert your monitoring system
alertSlack(`Transaction blocked: ${event.verdict.reasons[0].message}`);
},
onFreeze: (event) => {
// Emergency: agent is under attack
alertPagerDuty(`WARDEX FREEZE: ${event.reason}`);
},
onThreat: (event) => {
// Threat intelligence signal
logThreat(event.threatType, event.severity, event.details);
},
});| Tier | Value at Risk | Mode | Blocks? | Human Required? |
|---|---|---|---|---|
| Audit | < $1 | Log only | Never | No |
| Co-pilot | $1 - $100 | Advisory | No | No |
| Guardian | $100 - $10K | Full eval | Score > 70 | On block only |
| Fortress | > $10K | Full eval + delay | Always | Always |
| Freeze | Active attack | Emergency halt | Everything | Required to resume |
Critical override: Prompt injection, denylisted addresses, and SELFDESTRUCT contracts are blocked at Guardian tier and above regardless of composite score.
- Infinite token approvals (
type(uint256).max) - Transactions to known exploit addresses
- Prompt injection in MCP tool outputs
- Private key / seed phrase leakage in agent responses
- Behavioral anomalies (sudden value spikes, unusual contracts)
- Unverified proxy contracts with SELFDESTRUCT or unsafe delegatecall
- Cross-MCP source manipulation
- Social engineering escalation patterns
- Daily volume limit breaches
Getting Started
Concepts
Guides
- Guide: Protect an Ethers Agent
- Guide: Protect a Viem Agent
- Guide: Session Keys
- Guide: Delegation Framework
- Guide: MCP Server
- Guide: Claude Code Skill
- Guide: Custom Middleware
- Guide: Custom Policies
- Guide: Contract Deployment
API Reference
Security