Inspiration
I was looking for ways to market my own product and kept coming back to clip campaigns — pay creators to cut your content into short clips and post them. It works, and the mechanics of running one are what put me off.
The hard part isn't finding clippers. It's everything after: someone has to watch each clip and decide whether it actually met the brief, then decide whether the views are real, then pay out. The platforms that do this take a percentage of the payout, which means they earn more when creators are paid more — so the incentive to check view counts honestly runs backwards. And creators wait days or weeks for money that arrives through rails many of them don't have good access to.
That is a problem an AI can do cheaply and a stablecoin can settle instantly. So instead of running a campaign, I built the thing I would have wanted to run one on.
What it does
A brand funds a campaign from its own wallet. Merlin Clips reads that wallet on-chain to confirm the pool is real before the campaign is ever listed — we never hold the money.
A creator clips the content, posts it, and submits the link. Gemini watches the video through Vertex AI and decides whether it meets the brief. That verdict is the gate: no human reviews it, and a clip that fails is never paid.
Views are then counted from YouTube's own Data API, repeatedly, across a 24-hour hold. The payable figure is the minimum of every observation, never the latest:
$$ \text{confirmed} = \min_{t \in T} v(t), \qquad \text{payable} = \text{confirmed} - \text{alreadyPaid} $$
$$ \text{earned} = \frac{\text{payable}}{1000} \times \text{cpm} $$
Because \( \text{confirmed} \) is a minimum, views purged as inauthentic never become payable — a count is only worth what every observation agreed it was. After the hold, USDC settles from the brand's wallet to the creator's on Base, and every payment sits on a public ledger.
YouTube is the platform this runs on today. X is measurable but not yet payable, and Instagram needs per-creator authorisation — both are deliberate exclusions rather than gaps, for reasons below.
No bank account. No invoice. No minimum payout. No human approving anything.
How we built it
The core is an append-only, hash-chained event log. Every campaign, clip, verdict, snapshot and payout is an event, and all state is rebuilt by replaying them — nothing is a stored summary that can disagree with the records it claims to add up.
Gemini runs through Vertex AI. The service runs on Cloud Run, state lives in Cloud Storage, and Cloud Scheduler fires the hourly tick that judges, counts and settles unattended.
The anti-fraud mechanic is four lines:
// Views that survive, not views that appeared.
const confirmed = snapshots.reduce((min, s) => (s.views < min ? s.views : min));
const payable = confirmed - alreadyPaid;
A payout passes ten gates before any USDC moves — verdict, dwell, per-creator cap, campaign pool, mandate, rolling window, absolute ceiling. When a clip earns more than the pool can still cover it is clamped rather than refused:
$$ \text{pay} = \min\big(\text{owed},\ \text{poolRemaining},\ \text{creatorCapRemaining}\big) $$
Creators prove their payout address by signing a server-issued challenge. A typed address is trusted on sight; a signature is proof.
Challenges we ran into
Almost every real defect was invisible to a passing test suite, and I found them by driving the running system rather than reading it.
Replay order was decided by a hash. Events are content-addressed, so listing them by id made a campaign's status resolve arbitrarily — an ended campaign came back to life on a cold start. My first test for it passed against the broken code, because the in-memory store happened to list in insertion order.
The payout address came from the request body. A creator could type forty hex characters and be paid to an address nobody holds. Adding the refusal broke no existing test, because every submission test posted without a session and never reached the check.
The chain default was mainnet on a testnet deployment. Coverage is a balance read on the campaign's chain, so the service read Base mainnet, found nothing, and reported "empty" for a wallet holding 236 USDC on Sepolia. The error blamed the wallet.
X does not expose view counts. Rather than argue from documentation, an agent paid $0.0025 through Circle's marketplace for one tweet lookup. The response carried like_count, reply_count, quote_count, retweet_count, bookmark_count — and no impression_count. X shows impressions only to a post's own author. That single transaction is why X clips are priced on engagement, weighted by effort:
$$ E = \text{likes} + 3\,\text{replies} + 5\,\text{quotes} $$
A like is one tap, a reply is a sentence, a quote is a sentence plus reposting to your own audience. A flat sum would price a bot's tap the same as a person's writing.
Accomplishments that we're proud of
The whole pipeline runs against live services with nothing mocked: Gemini judged a clip through Vertex, the YouTube Data API returned that video's real count, the hold applied, the payout gate computed the amount owed, and a hash chain closed over it. 853 tests, 333 commits, 257 deployed revisions in 14 days — for $80.69.
And the refusals work. The Circle CLI declined to settle a campaign with no funding wallet rather than falling back to a default. That refusal is worth more than any successful payment, because it is the failure mode that quietly drains a brand.
What we learned
Reading code tells you what should happen; driving it tells you what does. Roughly twenty production defects surfaced that way, and almost none would have been caught by more unit tests — several sat in code with full coverage of the wrong thing.
Where a platform won't give us a number we can verify, we don't invent a proxy and pay on it silently. That cost us Instagram and X views. Both were the right trade.
What's next for Merlin Clips
The goal is straightforward: get to the point where creators are actually being paid, regularly, by brands.
That starts with Eliza Labs. We're collaborating with them on the first campaigns, which solves the hardest problem a two-sided market has — the cold start. A brand with an existing audience brings its own creators, so we don't have to buy both sides at once.
Built With
- ai-agents
- base
- blockchain
- bun
- circle
- css
- docker
- eip-6963
- ethereum
- gemini
- google-cloud
- google-cloud-run
- google-cloud-scheduler
- google-cloud-secret-manager
- google-oauth
- html
- mcp
- typescript
- usdc
- vertex-ai
- viem
- web3
- x402
- youtube-data-api
Log in or sign up for Devpost to join the conversation.