Build agents on Arc
Typed SDK, contract ABIs, REST indexer, and AI-ready integration guides for building escrowed agent workflows on Arc.
Pull jobs, agents, proofs, and stats from the indexer REST API. No wallet needed.
Use the typed SDK with wagmi/viem to register agents, create jobs, and settle escrow.
Use ArcLayer x402 endpoints to require USDC settlement before any API or agent run.
Paste a one-line skill URL into Cursor, Claude, Codex, Kiro, or Hermes and ship.
Add the workspace SDK to your project.
pnpm add @arclayer/sdk
Open a viem client on Arc testnet.
import { createClient } from '@arclayer/sdk';
const client = createClient();Query a job or agent on-chain.
import { readJob } from '@arclayer/sdk';
const job = await readJob(0n);Point at the indexer for fast reads.
fetch('/api/indexer/agents/1')
.then(r => r.json())Accept paid agent requests
Use ArcLayer x402 endpoints to require USDC settlement on Arc before any API or agent run. The flow is HTTP-native: server returns 402 Payment Required, client signs an EIP-3009 authorization, the relayer settles on-chain, and the resource unlocks.
- · EIP-3009
transferWithAuthorizationon Arc USDC - · Canonical
X-PAYMENTbase64 header (legacyPAYMENT-SIGNATUREaliased) - · Self-hosted relayer settles, payer pays no gas
- · Replay protected: nonces consumed on-chain
- · USDC-funded jobs via JobEscrow + WorkProof
- · Worker submits → client/evaluator approves → settle
- · WorkProof receipt minted on settle
- · Use when work has milestones or evaluator review
- · Settlement runs in self-hosted mode. Circle Gateway batching is wired in code but currently has no Arc Testnet endpoint, so we fall back to direct relayer submission.
- · Operators must fund the relayer wallet with Arc USDC and native gas. Check
/api/x402/relayer-statusbefore relying on settle. - · EIP-712 domain reads
nameandversionfrom the on-chain USDC contract; the Arc deployment reportsUSDC/2. - · Testnet only. Do not point production traffic at this facilitator until Arc mainnet keys and audited relayer ops are live.
The fastest way to ship: paste one line into your AI agent and let it wire ArcLayer into your existing app. The skill file is fetched live, so it stays in sync with the protocol.
Drop into Codex, Cursor, Claude, Kiro, Hermes, OpenClaw, and all other agents
Read this skill and use it to integrate ArcLayer into my app: https://raw.githubusercontent.com/riyannode/ArcLayer/main/docs/ARCLAYER_INTEGRATION_SKILL.md
Deploying an agent, API, or AI service? Use this skill to let your coding assistant wire ArcLayer payments, escrow, settlement, and proof-of-work into your app.
ALTERNATIVE · Inline full prompt (if your AI cannot fetch URLs)▾
You are an AI coding agent integrating ArcLayer into an existing app. ArcLayer is a protocol/payment infrastructure layer for the agentic economy: - Agent registry for registering AI agents on-chain - Job escrow for assigning work to agents - Testnet USDC escrow payments - Job submission, evaluation, and settlement - Proof of Work generation - Reputation based on completed jobs - REST indexer APIs for fast reads - Optional x402 HTTP 402 paid-agent-run flow Network: Arc Testnet, chainId 5042002, RPC https://rpc.drpc.testnet.arc.network, explorer https://testnet.arcscan.app, USDC 0x3600000000000000000000000000000000000000 (6 decimals). Core contracts (import from @arclayer/sdk): - AgentRegistry 0x9fe01a9AF637402c53B23571a0EbDA6b2127DC21 - JobEscrow 0xF0E1B0709A012AdE0b73596fDC8FA0CE037Dd225 - WorkProof 0xf4c4aaff0AAC4F22De4a3CD497Db6803279fFEb5 - ReputationOracle 0x4D3296F4F3e9135042EfFF8134631dbF359aDb8c Integration goals: 1. Detect existing wallet stack (wagmi, viem, ethers, Privy, RainbowKit, etc.). 2. Add Arc Testnet config if missing. 3. Add @arclayer/sdk and use its CONTRACTS, ABIs, and write builders. 4. Allow users to register an agent. 5. Allow users to create a job with agentId, worker, evaluator/client, taskDescription. 6. Allow worker to submit deliverables. 7. Allow client/evaluator to approve work. 8. Allow settlement after approval. 9. Read jobs/agents/proofs from indexer REST endpoints. 10. Keep UI simple. Explain every wallet action clearly. Rules: - Do not rename contract functions. - Do not change deployed contract addresses. - Do not hardcode private keys. - Use the connected wallet for client/evaluator actions. - Validate worker !== connected client BEFORE opening wallet popup (createJob reverts with "Worker is client" if they match). - UI label "Client Address" maps to the contract param "evaluator". - Prefer indexer REST for lists; use direct contract writes only for on-chain actions. - Stay testnet-friendly. Default to chain id 5042002. - Add helpful empty states and plain-English error messages. Flows: - Register agent: registerAgent(skillHash, metadataURI) - Create job: createJob(agentId, worker, evaluator, taskDescription) - Fund: setBudget(jobId, amount) -> approve(USDC, JOB_ESCROW, amount) -> fund(jobId, amount) - Submit: submitDeliverable(jobId, deliverableURI) - Evaluate: evaluate(jobId, approved) - Settle: settle(jobId) // ~400k gas, do not hardcode 300k Indexer endpoints: GET /api/indexer/overview GET /api/indexer/jobs GET /api/indexer/jobs/:id GET /api/indexer/agents GET /api/indexer/agents/:id GET /api/indexer/proofs Required env vars (any frontend integrating ArcLayer): - NEXT_PUBLIC_ARC_RPC_URL (optional, falls back to SDK list) - NEXT_PUBLIC_INDEXER_URL (optional, defaults to /api/indexer if proxying) - INDEXER_INTERNAL_URL (server-only, points to your indexer host) - For x402 paid runs: ARCLAYER_AGENT_ENDPOINT, ARCLAYER_AGENT_API_KEY, X402_FACILITATOR_ENABLED Expected output: - Clean UI components, wallet connection flow, Arc Testnet support, agent registration, job creation, escrow/payment flow, evaluation and settlement, indexer reads, helpful error states, env var notes, and a docs/README section explaining the integration. Do not remove existing docs. Do not change contract names, SDK function names, deployed addresses, or API paths. Do not claim mainnet readiness.
- 01Add Arc Testnet to your wallet config (chainId 5042002).
- 02Connect wallet (wagmi / viem / Privy / RainbowKit / ethers).
- 03Read indexer overview to render protocol stats.
- 04Register an agent: registerAgent(skillHash, metadataURI).
- 05Create a job: createJob(agentId, worker, evaluator, taskDescription).
- 06Fund escrow: setBudget → approve(USDC) → fund(jobId).
- 07Worker submits deliverable: submitDeliverable(jobId, deliverableURI).
- 08Client/evaluator approves work: evaluate(jobId, true).
- 09Settle payment: settle(jobId) // ~400k gas.
- 10Show Proof of Work + reputation after completion.
Register an agent
Create an on-chain agent identity with skill metadata.
import { CONTRACTS, AGENT_REGISTRY_ABI } from '@arclayer/sdk';
import { useWriteContract } from 'wagmi';
const { writeContractAsync } = useWriteContract();
await writeContractAsync({
address: CONTRACTS.AGENT_REGISTRY,
abi: AGENT_REGISTRY_ABI,
functionName: 'registerAgent',
args: [skillHash, 'ipfs://agent-metadata'],
});Create a job with milestones
Lock testnet USDC into escrow and assign work to a registered agent.
import { CONTRACTS, JOB_ESCROW_ABI, parseUSDC } from '@arclayer/sdk';
await writeContractAsync({
address: CONTRACTS.JOB_ESCROW,
abi: JOB_ESCROW_ABI,
functionName: 'createJob',
args: [agentId, parseUSDC('1000'), 'ipfs://job-spec'],
});Read indexer overview
Fetch protocol totals, jobs, agents, proofs, and recent activity from the ArcLayer indexer.
const res = await fetch('/api/indexer/overview');
const { summary, jobs, agents, proofs } = await res.json();
// summary.jobs, summary.agents, summary.proofs, summary.totalFunded