Warashibe Protocol

An agentic on-chain bartering platform. Start with a straw, let AI trade it up to a mansion.

Warashibe Protocol

Created At

Open Agents

Project Description

Warashibe Protocol is an agentic on-chain bartering platform inspired by the traditional Japanese folktale of the "Straw Millionaire." In the original story, a poor man starts with a single piece of straw and, through a series of serendipitous trades, eventually acquires a grand mansion. We are bringing this exact concept to the Ethereum ecosystem using autonomous AI agents.

Currently, on-chain bartering is highly fragmented. Users must manually search for matching peer-to-peer offers, calculate the value differences, and pay gas fees for every single step. Warashibe shifts this paradigm from "manual steps" to "intent-centric outcomes."

The workflow is simple: a user mints a free "Straw" NFT, sets their ultimate target asset (e.g., a high-value blue-chip NFT or a specific USDC amount), and delegates trading authority to their personal AI agent. The AI agent continuously monitors our custom on-chain escrow smart contract to discover active swap offers. Instead of relying on traditional AMM liquidity pools, the agent leverages decentralized social graphs—specifically Farcaster—to broadcast dynamically generated trade proposals.

When a human user clicks "Accept Swap" on their Warpcast feed, the escrow contract trustlessly exchanges the assets. By combining AI tool calling with smart accounts, Warashibe Protocol creates a magical consumer experience: humans simply define the goal, and the AI autonomously navigates the market to trade your assets up into a digital fortune.

How it's Made

Warashibe Protocol is structured as a modern Web3 monorepo, cleanly separating our on-chain execution layer from our off-chain AI and social layers.

Smart Contracts: We built the core infrastructure using Solidity and the Foundry framework. The heart of the protocol is WarashibeEscrow.sol, a highly optimized, trustless peer-to-peer settlement contract. It securely locks maker assets and executes atomic swaps only when the exact desired taker tokens are provided.

The AI Agent Brain: We utilized the Vercel AI SDK to build the off-chain intelligence. Instead of just mocking agent behavior with fixed strings, we implemented actual On-chain Tool Calling. The LLM is equipped with custom tools utilizing viem to read the live state of the WarashibeEscrow contract. The agent fetches active offers, calculates the best multi-hop bartering route, and autonomously structures the exact JSON payloads and calldata required for the next transaction.

Social Distribution (Farcaster): To solve the liquidity fragmentation problem, we integrated deeply with Farcaster Transaction Frames (v2). The Next.js frontend acts as an API backend that generates these Frames. A notably hacky and cool feature we built is using @vercel/og to dynamically render the Frame images on the fly. When the AI proposes a trade, the Frame visually displays the exact assets being swapped (e.g., Straw ➔ Apple) using query parameters, creating a highly engaging social feed experience.

Account Abstraction: To realize the true "Intent-centric" vision, we integrated Coinbase Smart Wallet via Wagmi. This allows the AI's prepared transactions to be executed seamlessly without complex seed phrase management, leaning into the ERC-4337 narrative to enable gasless, sponsored transaction loops in the future.

background image mobile

Join the mailing list

Get the latest news and updates