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.

The 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.

For 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.

Three signatures, three jobs

The whole design fits in one sentence: the worker signs the hours, the AI drafts, you sign the pay.

  1. The worker signs their own pay line. Each worker confirms their wallet once. After that, every pay line (who, how much, which period) is an EIP-712 signature from that wallet. It costs no gas.
  2. The AI drafts the run. The assistant reads the signed timesheet, checks it, and calls proposeRun. That is the only thing its key can do. It cannot approve, pay, withdraw or change its own limits.
  3. The employer signs the payment. After a review window, the owner sees each line, approves, and one transaction pays everyone, once.

Between 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.

Why worker signatures matter more than caps

Most "safe agent" designs put a cap on the bot. A cap says: you can lose at most this much.

Worker 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.

The AI's key is a session key, not a wallet

The 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.

The key holds no money and no gas. In the on-chain proof, its balance is zero before and after.

Payslips: proof of income nobody can fake

This 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.

So 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.

Why 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.

Proving it, not claiming it

I 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:

  • poisoned and inflated amounts, cap breaches
  • unconfirmed, look-alike and made-up payees
  • replays
  • the assistant key trying every owner power
  • copied invites and open invites
  • a payee's wallet swapped while a run waits
  • forged, tampered, reused and missing worker signatures
  • forged and transferred payslips
  • prompt-injected timesheets through the agent's own pipeline

Result: 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.

Refusing 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.

On 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.

What I learned

  • Put the guarantees in the contract. The agent checks signatures too, but that is a convenience. The contract is the only part an attacker cannot skip.
  • Prove the honest path as well as the attacks. A system that refuses everything is useless. Counting genuine runs paid made the test honest.
  • Make every refusal a named error. It made the attack test possible, and the web app turns each one into a plain-English sentence.
  • Small chains have quirks. Aevum does not run MCOPY, so everything compiles for the Shanghai EVM, and its RPC limits log queries to 1,000 blocks.

Try it

It 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.