Skip to content

Commit 0a8a9e4

Browse files
author
asbestos22
committed
feat(v10.3): ERC-8183 commerce LIVE on BSC mainnet — job 119 + 5 txs
Full ERC-8183 lifecycle executed on BSC mainnet: 1. createJob → jobId=119 (0x255e128e) 2. registerJob (0x201c8889) 3. setBudget(0.1 U) (0xf1776105) 4. fund(0.1 U) → escrow (0x56a0ddfa) 5. submit(manifest_hash) (0x0f2834dd) Service price reduced 1 U → 0.1 U. Job in Submitted state, settles after 7-day dispute window. Receipt: erc8183_mainnet_live.json. SDK fixes (vs upstream bnbagent v0.3.4): - Default expiredAt set to now + 8 days (must exceed policy.disputeWindow=7d or OptimisticPolicy reverts SubmissionTooLate) - MIN_GAS_PRICE_WEI: 3 gwei -> 0.1 gwei (upstream 30x overcharge on BSC mainnet) - Default gas limit: 2M -> 500k Dashboard footer: ERC-8183 protocol tag now links to live submit tx. README: ERC-8183 section rewritten with mainnet receipt table.
1 parent a20e29e commit 0a8a9e4

4 files changed

Lines changed: 88 additions & 15 deletions

File tree

README.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,30 +225,42 @@ Output:
225225

226226
Replay protection: nonces cached 10min. Wrong amount, wrong payTo, expired authorization, or invalid signature → 402 with explicit error reason.
227227

228-
### ERC-8183 Agentic Commerce (escrow-backed signed delivery)
228+
### ERC-8183 Agentic Commerce (LIVE on BSC mainnet)
229229

230-
NRI is also exposed as a sellable agent service via the SDK's ERC-8183 commerce stack. A client agent posts a job, locks U in escrow, NRI delivers a signed scan manifest, optimistic settlement releases the escrow on `complete`.
230+
NRI is exposed as a sellable agent service via the SDK's ERC-8183 commerce stack. A client agent posts a job, locks U in escrow, NRI delivers a signed scan manifest, optimistic settlement releases the escrow.
231+
232+
**Live job 119 — 5 mainnet txs:**
233+
234+
| # | Action | Tx |
235+
|---|---|---|
236+
| 1 | createJob → jobId=119 | [`255e128e`](https://bscscan.com/tx/0x255e128e9b47b6fa68f9e03aee8d12d62af4e0ea102b144a751589824d493ce4) |
237+
| 2 | registerJob | [`201c8889`](https://bscscan.com/tx/0x201c88899bb950fe857cb47c38726414df7b2a96131092d9cfffac24fa99f22d) |
238+
| 3 | setBudget(0.1 U) | [`f1776105`](https://bscscan.com/tx/0xf1776105e79275e141e3873015413ace23b609b1d4b7f48f2d15fcab2fe820f6) |
239+
| 4 | fund(0.1 U) → escrow locked | [`56a0ddfa`](https://bscscan.com/tx/0x56a0ddfaff7ffcaa00325986e8db833e52a44bd216d7cf54cbbf803475e276ab) |
240+
| 5 | submit(manifest_hash) | [`0f2834dd`](https://bscscan.com/tx/0x0f2834dd29383eebc92e12482028fe277555253cab62d0128e5ff64badd22fcb) |
241+
242+
Job state = **Submitted**, in 7-day dispute window. Settles automatically → 0.1 U routes to NRI provider wallet.
231243

232244
```bash
233-
# Dry-run: build full lifecycle calldata + manifest hash, no broadcast
245+
# Reproduce dry-run (offline, no chain)
234246
python erc8183_commerce.py
235247

236-
# Live on testnet (gas sponsored by MegaFuel, ~1 U test capital needed)
237-
CLIENT_PK=0x... PROVIDER_PK=0x... python erc8183_commerce.py --live-testnet
248+
# Reproduce live mainnet (needs CLIENT_PK + PROVIDER_PK + 0.1 U + 0.001 BNB on client)
249+
python erc8183_commerce.py --live-mainnet
238250
```
239251

240252
Lifecycle:
241-
1. `client.createJob(provider=NRI, evaluator=router, expired_at, description)`
253+
1. `client.createJob(provider=NRI, evaluator=router, expired_at=now+8d, description)`
242254
2. `client.registerJob(jobId, policy=optimistic)`
243-
3. `client.setBudget(jobId, 1e18)` — 1 U service price
244-
4. `client.fund(jobId, 1e18)` — escrow locks U
255+
3. `client.setBudget(jobId, 0.1e18)`
256+
4. `client.fund(jobId, 0.1e18)` — escrow locks U
245257
5. `provider.submit(jobId, keccak256(manifest), opt_params={'deliverable_url': ...})`
246-
6. Wait dispute window — silence = approve
258+
6. Wait dispute window (7d, hardcoded by mainnet OptimisticPolicy) — silence = approve
247259
7. `router.settle(jobId)` — escrow releases to NRI
248260

249261
The deliverable manifest pins the entire snapshot (regime + narratives + SRR). Buyers fetch the URL and verify the on-chain hash matches. Disputes route to whitelisted voters via OptimisticPolicy.
250262

251-
`erc8183_dryrun.json` ships in this repo as a reproducible proof artifact.
263+
Reproducible artifacts: `erc8183_dryrun.json` (dry-run) and `erc8183_mainnet_live.json` (live receipts).
252264

253265
## Architecture
254266

erc8183_commerce.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
NRI_REGISTRY = "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"
4747
SERVICE_NAME = "Narrative Rotation Index — full scan + SRR overlay"
4848

49-
# Default service price: 1 U per delivered scan.
50-
DEFAULT_SERVICE_PRICE_BASE_UNITS = 1 * 10**18 # 1 U at 18 decimals
49+
# Default service price: 0.1 U per delivered scan (tight cost-of-prize).
50+
DEFAULT_SERVICE_PRICE_BASE_UNITS = 1 * 10**17 # 0.1 U at 18 decimals
5151

5252

5353
@dataclass
@@ -59,12 +59,17 @@ class JobSpec:
5959

6060

6161
def build_job_spec(price: int, snapshot_url: str = "https://nri.realdo.org/api/live") -> JobSpec:
62-
"""Construct the off-chain job description and on-chain expiry."""
62+
"""Construct the off-chain job description and on-chain expiry.
63+
64+
expiredAt MUST be > disputeWindow (currently 7 days on mainnet OptimisticPolicy)
65+
so OptimisticPolicy.onSubmitted doesn't revert with SubmissionTooLate. We use
66+
8 days to leave a 1-day submit window.
67+
"""
6368
now = int(time.time())
6469
return JobSpec(
6570
description=SERVICE_NAME,
6671
deliverable_url=snapshot_url,
67-
expired_at=now + 86400, # 24h escape hatch
72+
expired_at=now + 8 * 86400, # 8 days — must exceed policy.disputeWindow (7d)
6873
budget_base_units=price,
6974
)
7075

erc8183_mainnet_live.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"network": "bsc-mainnet",
3+
"chain_id": 56,
4+
"service": "Narrative Rotation Index \u2014 full scan + SRR overlay",
5+
"service_price_human": "0.1 U",
6+
"service_price_base_units": 100000000000000000,
7+
"client_wallet": "0x26687256c5f4fF6A3669A3dD4Fb8A4C6113828C1",
8+
"provider_wallet": "0x7D93a5a96f9306E9b0D3B185aef702d03D1572C1",
9+
"agent_id": 129156,
10+
"commerce_contract": "0xea4daa3100a767e86fded867729ae7446476eba6",
11+
"router_contract": "0x51895229e12f9876011789b04f8698af06ccd6da",
12+
"policy_contract": "0x9c01845705b3078aa2e8cff7520a6376fd766de5",
13+
"payment_token": "0xcE24439F2D9C6a2289F741120FE202248B666666",
14+
"deliverable_url": "https://nri.realdo.org/api/live",
15+
"manifest_hash": "0x0a933e1d0ce80053",
16+
"lifecycle": [
17+
{
18+
"step": 1,
19+
"action": "createJob",
20+
"result": "jobId=119",
21+
"tx": "0x255e128e9b47b6fa68f9e03aee8d12d62af4e0ea102b144a751589824d493ce4"
22+
},
23+
{
24+
"step": 2,
25+
"action": "registerJob",
26+
"tx": "0x201c88899bb950fe857cb47c38726414df7b2a96131092d9cfffac24fa99f22d"
27+
},
28+
{
29+
"step": 3,
30+
"action": "setBudget",
31+
"amount": "0.1 U",
32+
"tx": "0xf1776105e79275e141e3873015413ace23b609b1d4b7f48f2d15fcab2fe820f6"
33+
},
34+
{
35+
"step": 4,
36+
"action": "fund",
37+
"amount": "0.1 U",
38+
"tx": "0x56a0ddfaff7ffcaa00325986e8db833e52a44bd216d7cf54cbbf803475e276ab"
39+
},
40+
{
41+
"step": 5,
42+
"action": "submit",
43+
"tx": "0x0f2834dd29383eebc92e12482028fe277555253cab62d0128e5ff64badd22fcb"
44+
},
45+
{
46+
"step": 6,
47+
"action": "settle",
48+
"status": "PENDING_DISPUTE_WINDOW",
49+
"settles_at": "creation + 8 days"
50+
}
51+
],
52+
"job_id": 119,
53+
"job_status": "Submitted",
54+
"dispute_window_seconds": 604800,
55+
"dispute_window_human": "7 days"
56+
}

web/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def verdict_color(v: str) -> str:
415415
</div>
416416
<div class="agent-id-proto">
417417
<span class="agent-id-proto-tag">ERC-8183</span>
418-
<span class="agent-id-proto-desc">commerce escrow · sells signed scans</span>
418+
<span class="agent-id-proto-desc">commerce escrow · job 119 LIVE · <a href="https://bscscan.com/tx/0x0f2834dd29383eebc92e12482028fe277555253cab62d0128e5ff64badd22fcb" target="_blank" rel="noopener" style="color:#F0B90B;text-decoration:none;">5 mainnet txs</a></span>
419419
</div>
420420
</div>
421421
</div>"""

0 commit comments

Comments
 (0)