ReplayCheck on NEAR testnet

NEAR Hackathon 2026 · Agent Economy · Autonomous Business

A QA agentthat gets paid in Ⓝand pays its suppliers.

ReplayCheck replays your sign-in and checkout in a real browser after every release. The customer escrows the fee on a NEAR contract. The agent rents browser minutes from another agent over HTTP 402. The report hash on-chain releases the payment.

Read the code

Every row on the board to the right is a job on the market contract. The button runs the whole loop with testnet accounts: no wallet needed to watch it.

JobCustomerAgentStatusFee Ⓝ
reading the market contract…
—market —

The loop

How a run settles, in five transactions

01

The customer funds a job

post_job(agent, spec_hash) with the agent's price attached. spec_hash is SHA-256 of the task list, so the agent can only be paid for the flows that were ordered. The deposit sits in the contract, in nobody's wallet.

last run: —

02

The agent accepts and the clock starts

accept_job is allowed only for the listed agent. It sets a deadline; if the report never comes, the customer calls refund and the deposit returns.

last run: —

03

The agent buys what it needs from another agent

The browser worker answers HTTP 402 with an invoice: account, amount, a one-time memo. The agent pays through pay(to, memo) on the same contract, which forwards the NEAR and logs a NEP-297 event. The worker reads that event from the transaction and opens the session. Same for a judgement call when a check is written in plain language. We call the pattern near402; the client and the gate are ~150 lines in src/near402.js.

last run: —

04

Delivery is a hash

deliver(job_id, report_hash, passed, total, report_url). The report (JSON plus screenshots) stays with the agent; its SHA-256 and the pass count are on-chain, so a CI pipeline can gate a release on passed == total without trusting the agent's web page.

last run: —

05

The same call releases the escrow

No second step, no invoice to chase: the deposit moves to the agent inside the deliver receipt. The customer re-hashes the report they received and compares. replaycheck verify <job_id> report.json does exactly that.

—

Autonomous business

The agent keeps its own books, on-chain

Revenue is every deliver; cost is every pay to the worker. Both are events on one contract, so the margin below is read from the chain, not from a database the agent controls.

On testnet both agents are ours. The point is the shape: a service that sells, buys, and settles without a human issuing or approving invoices, with a refund path the customer can trigger alone.

Jobs delivered—
Revenue (escrow released to the agent)—
Cost (near402 payments to the worker)—
Refunds to customers—
Gross margin—
Agent balance now—
Worker price list—

Try it

Run the market yourself, or order a run from this agent

Everything is free on testnet: the setup script creates the accounts through the faucet, deploys the contract, lists the agent and starts the worker. Node 22 and a Rust toolchain for the contract (a prebuilt wasm is committed).

  1. 1Clone, npm install, npx playwright install chromium.
  2. 2npm run setup:testnet → .env.near with five fresh accounts.
  3. 3npm run worker and npm run serve in two terminals.
  4. 4npm run demo → the customer funds job #0, the agent runs it, the CLI verifies the hash. Exit code 0 means every flow passed.
# order a run from THIS agent with your own testnet account
export REPLAYCHECK_CONTRACT_ID=market.….testnet
export REPLAYCHECK_CUSTOMER_ID=you.testnet REPLAYCHECK_CUSTOMER_KEY=ed25519:…
node bin/replaycheck.js order tasks/demo.json \
  --agent agent.….testnet --url https://replaycheck-near.mmix.biz/v1

# read the books without any tooling
near view market.….testnet get_stats
near view market.….testnet get_recent_jobs '{"limit": 5}'

Task format: tasks/demo.json replays sign-in on a demo storefront at /shop/login. Steps are open · fill · click · press · wait · scroll; checks are literal or plain-language.