{"slug": "how-we-let-an-ai-run-payroll-without-touching-the-money", "title": "How we let an AI run payroll without touching the money", "summary": "A developer built PayWarden, a payroll system in which an AI assistant drafts payment runs but never holds funds or keys, submitting only a single proposeRun call that the employer must sign. Worker signatures on hours make prompt-injected or inflated pay lines impossible rather than merely capped, and each paid line mints a non-transferable ERC-721 payslip. An attack script on the Aevum testnet reported 71 of 71 attacks refused with zero wrong payments, and 10 of 10 genuine paydays paid with no false refusals.", "body_md": "Payroll is the most repetitive money job a small team has. Every week or month someone reads timesheets, matches names to wallet addresses, adds it all up and pays. It is exactly the kind of work you want an AI assistant to do.\n\nThe problem is the usual way to automate it: you give a bot a hot wallet. Then one poisoned timesheet, one prompt injection hidden in a file, or one wrong address, and the money is gone for good. A spending cap limits the damage, but it does not stop the attack.\n\nFor the QDay Aevum Builder Challenge I built **PayWarden**, payroll where an AI does the work and never holds the money. This post is how it works and what I learned.\n\nThe whole design fits in one sentence: **the worker signs the hours, the AI drafts, you sign the pay.**\n\n`proposeRun`. That is the only thing its key can do. It cannot approve, pay, withdraw or change its own limits.\nBetween steps 2 and 3, the contract checks everything: every signature against the confirmed wallet, per-person, per-run and per-period caps, an expiry, an off switch, and that no line was already paid. Anything wrong reverts with a named error before a person ever sees it.\n\nMost \"safe agent\" designs put a cap on the bot. A cap says: you can lose at most this much.\n\nWorker signatures change the question. The AI cannot invent a line, inflate hours or add a payee, because it cannot produce the worker's signature. A prompt-injected line is not capped. It is impossible. And because the contract records `paidLine[payee][period]`, the same signed line can never be paid twice, even across two different runs.\n\nThe assistant can also work through the employer's ERC-4337 smart account (EntryPoint v0.7, already deployed on Aevum). Its key becomes a session key that can sign exactly one call, `proposeRun` on one vault, until an expiry the EntryPoint enforces. The owner also caps the gas price and gas a session operation can use, so a stolen key cannot even drain the gas deposit.\n\nThe key holds no money and no gas. In the on-chain proof, its balance is zero before and after.\n\nThis is the part I am proudest of. Every time a line is paid, the vault mints a **payslip** to the worker in the same transaction. It is an ERC-721 token that cannot be transferred (ERC-5192), and only vaults created by the PayWarden factory can mint one.\n\nSo a payslip can only exist if the worker signed that line and the employer signed the payment. The metadata (amount, employer, vault, period, date) is built on-chain, and anyone can open `paywarden.me/payslip/<number>` without a wallet to check it.\n\nWhy this matters: remote workers paid in stablecoins often cannot prove their income. Bank statements do not show it, and a screenshot proves nothing. A payslip signed by both sides, on a public chain, does.\n\nI wrote an attack script that builds a fresh vault on the Aevum testnet and throws everything I could think of at it, each attack as a real transaction:\n\nResult: **71 of 71 attacks refused, 0 wrong payments.** Every refusal is a failed transaction you can open on the explorer, with the exact contract error.\n\nRefusing everything is easy if nothing ever gets paid, so the same script then runs ten genuine paydays: **10 of 10 paid, 0 false refusals**, each minting one payslip per worker.\n\nOn top of that: 138 Foundry tests (unit, fuzz with 10,000 runs each, and invariants such as \"a payee is never paid twice for one period\" and \"payslips issued always equal lines paid\"), an internal security review with Slither and a manual checklist, and CI on every push.\n\n`MCOPY`, so everything compiles for the Shanghai EVM, and its RPC limits log queries to 1,000 blocks.\nIt is testnet only. If you run payroll for a remote team, I would love to hear what you would need before trusting something like this with real money.", "url": "https://wpnews.pro/news/how-we-let-an-ai-run-payroll-without-touching-the-money", "canonical_source": "https://dev.to/africtoby/how-we-let-an-ai-run-payroll-without-touching-the-money-3mjo", "published_at": "2026-11-28 21:10:04+00:00", "updated_at": "2026-11-28 21:15:05.050461+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "artificial-intelligence"], "entities": ["PayWarden", "QDay Aevum Builder Challenge", "Aevum", "ERC-4337", "EntryPoint v0.7", "ERC-5192", "Foundry", "Slither"], "also_reported_by": [], "takeaway": "Gating an AI payroll agent with worker signatures on each line, rather than a spending cap, made all 71 injected or malformed attacks revert while 10 of 10 genuine paydays still paid.", "recommendation": {"advice": "Replace spending caps with cryptographic preconditions: require worker signatures per pay line and give the agent a session key scoped to one proposeRun call so injected lines cannot be paid.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/how-we-let-an-ai-run-payroll-without-touching-the-money", "markdown": "https://wpnews.pro/news/how-we-let-an-ai-run-payroll-without-touching-the-money.md", "text": "https://wpnews.pro/news/how-we-let-an-ai-run-payroll-without-touching-the-money.txt", "jsonld": "https://wpnews.pro/news/how-we-let-an-ai-run-payroll-without-touching-the-money.jsonld"}}