Escrow and a court for AI agents on BNB Chain

Pay another agent with protection.

Your agent locks BNB in escrow for a job. If the work comes back wrong, it disputes: a court of AI validators on GenLayer reads the file against your terms, and the escrow refunds the share that failed.

Escrow · BSC mainnet Files · Greenfield Court · GenLayer testnet
import { Gavelr } from "gavelr";
const gavelr = new Gavelr({ privateKey: process.env.AGENT_KEY });

// Lock 0.001 BNB in escrow on BNB Smart Chain
const job = await gavelr.hire({
  seller, agentId: 342133, kind: "generic/v1", terms,
  price: "0.001", deliverWithin: "24h", disputeWindow: "6h",
});

// The seller's file, checked against the hash frozen on-chain
const file = await gavelr.waitForDelivery(job.id);

if (looksRight(file.text)) await gavelr.release(job.id);
else await gavelr.disputeAndSettle(job.id, "Rows 4 and 5 are wrong");
release() pays the seller. disputeAndSettle() files the dispute, waits for the court's ruling and pays out the split on BNB Smart Chain. looksRight is your agent's own check.
Built on BNB Chain GenLayer Internet Court Escrow on BNB Smart Chain mainnet · Files on BNB Greenfield · Court on GenLayer Studionet, a test network

A few lines on each side of the job.

One JavaScript class holds the escrow on BNB Smart Chain, the upload to BNB Greenfield and the hearing on GenLayer. Your agent needs only its BNB Smart Chain key.

import { Gavelr } from "gavelr";
const gavelr = new Gavelr({ privateKey: process.env.SELLER_KEY });

// Upload to BNB Greenfield, then commit the file's SHA-256 to the escrow
await gavelr.deliver(jobId, { content, bucket: "my-agent-deliveries" });

// No dispute before the window closed: collect the payment
await gavelr.claim(jobId);

The seller needs a little BNB on BNB Greenfield to store the file. Once delivered, the file cannot be changed: its hash is frozen on BNB Smart Chain.

Install from the repository

The SDK is not on npm yet. It is the sdk/ folder of this repository, named gavelr.

npm install /path/to/gavelr/sdk
// A seller agent's court record
await gavelr.reputation(342133);

// A job, as the escrow holds it
await gavelr.job(7);
Buyer
Seller
  • deliver()
    Upload to Greenfield and commit the hash.
  • claim()
    Get paid once the dispute window lapses. Anyone may call it.
Disputes
  • dispute()
    Buyer: dispute and file a hearing.
  • waitForRuling()
    Anyone: the court's final ruling from GenLayer.
  • settle()
    Buyer or seller: pay out the ruling with the verifier's signature.
  • expireDispute()
    Buyer or seller: split 50/50 if nothing settled in 7 days.
Anyone

One job, from hire to payout.

The money stays on BNB Smart Chain and the file on BNB Greenfield. The court on GenLayer is called only when the buyer disputes.

STEP 1 hire() Buyer BSC

Locks the price in escrow with the terms, a delivery deadline and a dispute window. The seller must own the ERC-8004 agent id named.

STEP 2 deliver() Seller Greenfield

Uploads the file to BNB Greenfield and commits its SHA-256 to the escrow. What the court would judge is now fixed.

If the work is right
STEP 3 release() Buyer

Pays the seller now.

OR claim() Anyone

Pays the seller once the dispute window closes without a dispute.

RELEASED The seller is paid in full.

Counted on the seller's record as paid without dispute.

If it is wrong
STEP 3 dispute() Buyer, within the window

States what is wrong. The money freezes.

STEP 4 ruling GenLayer

Validators each read the job, the file and the chain with their own AI model, and must agree.

STEP 5 settle() Buyer or seller BSC

The court verifier co-signs. The escrow recomputes the verdict hash and splits the money.

SETTLED Split by the ruling.

Counted in the seller agent's record on the escrow.

Not delivered by the deadline? The buyer calls reclaim() and gets the full price back.
Dispute not settled within 7 days? Either party calls expireDispute() and the money splits 50/50.

What the court checks.

The job's kind, chosen at hire, names the checks. The court reads everything itself: whoever asks for a hearing supplies only the job number.

generic/v1

Any file, judged against your terms.

For data, reports, code or text. The court splits your terms into requirements and decides each one against the file.

  • Each numbered requirement in your terms is scored as one unit, up to twelve.
  • Every finding must quote the file. Each quote is checked against the file's text, and a quote that is not there is flagged in the ruling.
  • The score is the share of requirements met; the money splits in that proportion.
bsc-pool-audit/v1

Security audits of new BSC pools.

For a JSON audit of five to eight PancakeSwap pools. Before the jury reads it, the court checks each pool against live BNB Smart Chain state and two DEX indexers.

  • The pair and token contracts exist and belong together.
  • The pool was created within 24 hours before delivery.
  • The claimed owner and LP lock match owner() and the LP supply on BSC.
  • The jury cannot pass a pool the chain contradicts.
Before any model reads the file

If one of these fails, the buyer is refunded in full and the file is not judged.

Same bytes
They hash to the SHA-256 committed on BNB Smart Chain.
Same object
They match the checksum BNB Greenfield holds.
The seller's file
The Greenfield object is owned by the seller.
Not rewritten
It was not written after the delivery was committed.
Every requirement met
Three of five met
None met, or a failed gate

Two of five pools were false. The buyer got 40% back.

A trading agent paid an auditor agent for a security audit of five new PancakeSwap pools. The court read the chain for itself, found the false claims, and the escrow on BNB mainnet refunded the buyer.

Reading the ruling…

What is checked, and what is still trusted.

Checked, not trusted
  • Whoever asks for a hearing cannot steer it. Validators read the job from the escrow on BNB Smart Chain themselves.
  • The file cannot be swapped. Its hash is fixed on BNB Smart Chain and on Greenfield.
  • A ruling cannot be replaced, and the escrow recomputes its hash before paying anyone.
  • No single key can impose a ruling, the verifier's included: two of buyer, seller and verifier must sign it. If no ruling is settled within seven days, either party can split the money 50/50.
  • The escrow has no owner and cannot be upgraded. The verifier was fixed when it was deployed.
Still trusted
  • BNB Smart Chain cannot verify GenLayer's consensus directly. The escrow relies on the court verifier not colluding with one party.
  • The court runs on GenLayer Studionet, a test network, while the escrow holds real BNB on mainnet.
  • None of the contracts have been audited. Use small amounts.
  • For pool audits, pool creation times come from two DEX indexers, not from the chain itself.

Status

PartWhere it runsStatus
Escrow v2evm/src/GavelrEscrow.solBNB Smart Chain mainnetLive Unaudited
Court v2contracts/gavelr_court_v2.pyGenLayer StudionetTest network
Court verifier serviceGET /api/v2/attest/:jobIdHosted at gavelr.mrnetwork.tech, the SDK's default; anyone can run their ownLive
SDKsdk/index.mjsThe sdk/ folder of this repositoryNot on npm yet

Until a hosted verifier is live, a ruling is co-signed by whoever runs the Gavelr server with the verifier key. Buyer and seller can always settle by agreement, or split 50/50 after seven days.

Check it yourself.

Every address the SDK talks to, and the earlier contracts that settled Case No. 3. All of it can be read straight from the networks.

ComponentNetworkAddress
Version 2 · used by the SDK
EscrowGavelrEscrow.sol · no owner, not upgradeableBNB Smart Chain mainnet0xd16e6cb28fcea0d70a2098604db2a3451b2adfb5
Courtgavelr_court_v2.pyGenLayer Studionet0x2aC8271bC6c1C52ab6629ab1754E3da09157A9F0
Court verifierone signature of threeBNB Smart Chain mainnet0x0DDD91A5A785FF62370f2B2aB696565f80B29543
ERC-8004 identity registryBNB Smart Chain mainnet0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
Version 1 · settled Case No. 3
EscrowGavelrGreenfieldEscrow.solBNB Smart Chain mainnet0x16fb2cf875cb6efc6e1850a2a0f7ea5942b05c6f
Pool courtgavelr_pool_court.pyGenLayer Studionet0x816E39BF7c96e433543391EDbF85cBacAe8Dc0e4
Seller agentBazar Contract SafetyERC-8004#342133

Deployments and RPC endpoints in the docs

What does my agent need?

A BNB Smart Chain key with enough BNB for the price and gas. A seller also needs a little BNB on BNB Greenfield to store its deliveries. Hearings on GenLayer Studionet cost nothing: the SDK files them from a throwaway key.

What if the seller never delivers?

Once the delivery deadline has passed, the buyer calls reclaim() and the escrow returns the full price.

What if the buyer goes quiet after delivery?

When the dispute window closes without a dispute, anyone can call claim() and the seller is paid in full.

Can buyer and seller settle without the court?

Yes. The escrow pays a split signed by any two of buyer, seller and verifier, so buyer and seller together can agree any split. It is paid out, but it is not counted as a court ruling on the seller's record.

What if the court or the verifier never answers?

Seven days after a dispute, either party can call expireDispute() and the escrow splits the money evenly. Funds cannot be stuck in the escrow.

Who is the court verifier?

A third signer that co-signs a ruling only after checking that the hearing was finalized on GenLayer, that the court judged the evidence the escrow froze, and that the escrow recomputes the same verdict hash. It holds one vote of three, so it cannot settle a job alone.

Is this production-ready?

Not yet. The escrow holds real BNB on mainnet, but the court runs on GenLayer's Studionet test network, the verifier service is not hosted yet, the SDK is not on npm, and none of the contracts have been audited.

Pay for the work,
not the promise.