Inspiration
AgentEscrow is motivated by the need for autonomous agents to transact reliably on‑chain without trusting each other. Existing payment HTLCs enable atomic swaps for value; I wanted to design an equivalent primitive for computation. By using a bonded commit‑reveal mechanism, I ensure that a worker only gets paid when they reveal the correct output hash and that any malicious actions are economically disincentivized.
What it does
The system is a smart contract on the MNEE network that provides a hash‑locked escrow for deterministic outputs. A requester creates a task with an expected output hash and commits funds plus a bond. A worker commits to perform the task by submitting a commitment hash and posting a bond. If the worker reveals the correct output bytes, the payment plus their bond are released; otherwise their bond is slashed. The protocol resists reveal front‑running and commit griefing, maintains liveness, and provides theft resistance.
How I built it
I implemented the core escrow contract in Solidity with Hardhat for compilation, deployment, and testing. TypeScript scripts handle deployment and a local demo, including agents for the requester, worker and attacker. Extensive tests (≈ 89) verify the state machine, timing boundaries, and attack scenarios. A small dashboard in HTML monitors on‑chain events, and utility modules handle RFC 8785 canonicalization and hash encoding. The codebase is organized into contracts, scripts, agents, and test suites.
Challenges I ran into
Designing a grief‑resistant commit‑reveal scheme required careful game‑theoretic analysis. I had to ensure that the bond is high enough to deter griefing but not prohibitively expensive. Preventing reveal front‑running demanded binding the reveal to the original worker and using preimages instead of just hashes. I also spent time optimizing on‑chain gas costs and designing a smooth UX for autonomous agents. Ensuring liveness under various network conditions and attack scenarios required complex state machine tests.
Accomplishments that I'm proud of
I achieved a fully trustless settlement mechanism for verifiable outputs and proved its resistance to common attacks. My test suite covers timing boundaries, attack vectors, and state transitions. I produced a polished PRD, a clear one‑sentence pitch, and an organized codebase with a working demo. The dashboard visualization makes it easy to follow the escrow lifecycle. I also integrated MNEE stablecoin seamlessly.
What I learned
Building a grief‑resistant escrow primitive taught me about cryptographic commitments, bonding economics, and autonomous agent design. I gained experience with Solidity, Hardhat, and TypeScript tooling. Analyzing edge cases for commit‑reveal protocols deepened my understanding of on‑chain adversarial behaviour.
What's next for AgentEscrow: Griefing‑Resistant Settlement Primitive
I plan to extend the primitive to support optional off‑chain verification for non‑deterministic tasks, explore multi‑party settlements, and integrate with broader agent frameworks. I will also investigate dynamic bond sizing and additional liveness guarantees. More user‑friendly developer tooling and a hosted demo site are on my roadmap.
Built With
- agentescrow
- dashboard
- demo
- ethers.js
- hardhat
- node.js
- solidity
- typescript
Log in or sign up for Devpost to join the conversation.