Onchain escrow
Processing scope: this reference describes the ordinary research/API contract. Browser-encrypted state, verified worker key delivery and hosted-model boundaries are documented in Privacy & confidential processing. Ordinary API/MCP access is not a private-project decryption interface.
Availability: This ordinary API is retired on both networks. Its testnet deployment was stopped on 26 Oct 2026, so the ordinary API/MCP examples below are historical reference and must not be used for new runs. Use private Dr. Nib on testnet or mainnet . Historical ordinary records are retained; direct legacy API reads need a reviewed restoration.
For runs where the budget must be enforceable by contract rather than by promise, Dr. Nib escrows the cap on Arc using an ERC-8183 (Agentic Commerce) plus a splitter contract. The network configuration selects the core, splitter, token and keeper required for funded runs.
The public testnet and mainnet flows require escrow before research starts. Ledger-only mode is for development; it does not represent a payment or onchain refund.
Operator prerequisite: escrow is only enabled when the dr-nib service has the keeper key set (ESCROW_KEEPER_KEY, also read from NIBGATE_KEEPER_PRIVATE_KEY) — plus ESCROW_CORE / ESCROW_SPLITTER on mainnet, which has no built-in defaults. Without the keeper key the escrow endpoints answer 501.
Roles
| Role | Who |
|---|---|
| Client | your wallet — funds the job, receives refunds |
| Provider | the run’s splitter contract — receives the deposited budget on completion, then divides it |
| Evaluator | the Nibgate keeper — attests completion against the run ledger |
Lifecycle
Open → Funded → Submitted → Completed → split
│ │ │ │ │
│ │ │ │ └─ operator (spent−1%), treasury (1%),
│ │ │ │ client (remainder), atomically
│ │ │ └─ keeper complete(reportHash), hook-free
│ │ └─ keeper relays submit(reportHash, spent)
│ └─ you sign setBudget + approve + fund
└─ you sign createJob(provider=splitter)- Open — your wallet opens the job at review (provider = splitter, evaluator = keeper). The backend supplies the parameters and registers the job ID from your confirmed transaction receipt.
- Fund — after opening the job you sign
setBudget+approve+fund, picking any amount from the plan estimate up. The deposit is one-shot (the core flips Open→Funded; no top-ups ever). Approve is then gated: the run only starts once the job reads Funded for at least the estimate, and the working cap aligns down to what landed. - Run — stages meter spend in the offchain ledger, exactly as without escrow. Pause at cap on an exhausted deposit ends (report kept) or restarts bigger as a new run — raising past the deposit is rejected everywhere.
- Submit — the worker submits
(reportHash, spentUsdc)through the splitter (the provider is a contract and cannot sign, so the keeper relays). - Complete — the keeper completes with the ledger-attested spend.
- Split — the backend relays the keeper-signed attestation immediately at settle (and
POST /escrow/completere-runs it idempotently): earned share minus 1% to the operator, 1% to treasury, remainder to your wallet — one atomic transaction, hash stored assplitTx.split()stays permissionless, so anyone can also execute a signed attestation directly.
Why a splitter instead of the spec’s hook: in the reference implementation complete() transfers the full budget before afterAction fires, so a hook can observe the payout but never redirect it. Setting the provider to the splitter lets the splitter handle allocation separately from the escrow core.
Rejected or expired jobs refund in full with no fee. After expiry, claimRefund is permissionless: anyone can trigger it, so funds are never hostage to a backend being alive. One upstream quirk to know: if client and evaluator are ever the same address, the core checks the client branch first, so use distinct roles.
Each wallet transaction must have a successful receipt before the next step starts. The job ID comes from the matching JobCreated event in that transaction, so concurrent runs cannot select each other’s jobs.
New job parameters are withheld if the contracts are missing, the RPC is on the wrong chain, or the keeper has less than 0.02 native USDC for settlement. Funded settlements retry every minute, with failed attempts moved behind other pending jobs; never-funded Open jobs do not occupy the retry queue. The owner can also retry from the receipt. A completed job with an unexecuted split remains retryable; a reverted transaction never counts as confirmation.
Backend endpoints
| Endpoint | Does |
|---|---|
POST /v1/runs/:id/escrow | return parameters for your wallet to open the job after a model-generated plan is ready (planned only); unavailable-model placeholder plans cannot be funded |
POST /v1/runs/:id/escrow/register | register the wallet-created job after validating its onchain client and provider |
GET /v1/runs/:id/escrow | local record + live onchain status |
POST /v1/runs/:id/escrow/complete | keeper submit + complete with ledger spend, then relay of the split; returns the split signature and splitTx |
Deployed addresses
| Network | Stock ERC-8183 core | NibgateRunSplitter (100 bps) | Funded runs |
|---|---|---|---|
| Arc testnet | 0x5135ae9be828be42b63f176848a7b720aedf4c58 | 0xFE5894a5A2fC4d7f6E0E70394209467D5A7bf1ef | Enabled |
| Arc mainnet | 0xF08bB50BC833C7Bff25b60Fe1456f1235A0a4037 | 0x1Ad56C6d8b85ac7167a227a3a520Eb5aD349a628 | Enabled; sustained mainnet wallet-flow soak remains open |
USDC on Arc is 0x3600000000000000000000000000000000000000 (6 decimals) on both networks. The escrow locks the funded amount; the splitter distributes the ledger-attested charge and returns the remainder. Partial funding aligns the working cap to the confirmed deposit. Jobs are one-shot: a settled deposit cannot be reused or topped up to continue spending.
The previous Arc testnet and mainnet splitters remain recorded for historical settlement verification. New admissions use the current address only after that network’s backend acceptance; existing jobs are always reconciled against the splitter stored with that job.