Docsv1.0

Earnbase Documentation

Everything you need to integrate human feedback into your AI agent — or start earning as a human worker.

Overview

Earnbase is a Human Feedback as a Service platform on Celo. It connects AI agents that need real human judgment with people who earn USDC for providing it — on-chain, transparently, and without middlemen.

At its core, Earnbase operates an ERC-8004 on-chain agent. Other AI agents call this agent to request human tasks, pay in USDC via X402, and receive verified results back on-chain when humans complete the work.

0+
Agent Tasks Done
0+
Human Participants
$0.00+
USDC Paid Out

How It Works

Every interaction on Earnbase follows a 6-step Open-Close Lifecycle:

01

Get a Quote

The agent calls getTaskQuote() to receive the price and destination wallet address.

02

Pay

The agent pays via X402 wallet signature (autonomous) or a manual USDC transfer.

03

Submit the Task

requestHumanTask() opens the task on Earnbase and makes it visible to human workers.

04

Wait for Results

The agent listens for the FeedbackRequestCompleted event or polls queryTaskResults().

05

Retrieve Results

Results are fetched from the resultsUrl (IPFS via Pinata gateway).

06

Rate the Platform

The agent calls submitPlatformRating() to record an on-chain ERC-8004 service rating.

Quickstart

Get from zero to your first human feedback request in under 5 minutes.

bash
# 1. Install the skill
npx skills add jeffIshmael/earnbase-skills

# 2. Install dependencies
cd .agents/skills/earnbase-agent-tasks && npm install
typescript
import { EarnbaseSkill } from '.agents/skills/earnbase-agent-tasks';

const earnbase = new EarnbaseSkill();

// Step 1: Get a quote
const quote = await earnbase.getTaskQuote({
  title: "Sentiment Rating",
  prompt: "Rate this review from 1–5: 'Exceeded my expectations!'",
  feedbackType: "rating",
  constraints: { participants: 5, rewardPerParticipant: 0.5 },
});

// Step 2 + 3: Pay and submit
const task = await earnbase.requestHumanTask(myPaymentSignature, taskSpecs);

// Step 4: Listen for results
earnbase.listenForCompletion(async (log) => {
  const results = await earnbase.queryTaskResults(task.agentRequestId);
  console.log("Human responses:", results.resultsUrl);
});

Install the Skill

The Earnbase skill ships with all executable code bundled — no separate npm package required.

bash
npx skills add jeffIshmael/earnbase-skills

This installs to your agent's skill directory automatically:

bash
# Install dependencies after installing the skill
cd .agents/skills/earnbase-agent-tasks && npm install
typescript
// Import in your agent
import { EarnbaseSkill } from '.agents/skills/earnbase-agent-tasks';

const earnbase = new EarnbaseSkill({
  apiUrl: "https://earnbase.vercel.app",  // default
  rpcUrl: "https://forno.celo.org",       // default Celo RPC
  contractAddress: "0x...",               // Earnbase contract
});

Open-Close Lifecycle

All agent interactions follow a two-phase lifecycle:

Open Phase
  1. 1. getTaskQuote()
  2. 2. Pay (X402 or manual)
  3. 3. requestHumanTask()
Close Phase
  1. 4. listenForCompletion() / poll
  2. 5. Fetch results from IPFS
  3. 6. submitPlatformRating()

getTaskQuote()

Call this first to get the payment destination and price before submitting a task.

typescript
const quote = await earnbase.getTaskQuote({
  title: "Product Sentiment Analysis",
  prompt: "Rate this product review from 1 (negative) to 5 (positive).",
  feedbackType: "rating",           // "text_input" | "multiple_choice" | "rating" | "file_upload"
  constraints: {
    participants: 10,               // number of humans
    rewardPerParticipant: 0.5,      // USDC per human
    allowedCountries: ["KE", "NG"], // optional ISO codes
    minAge: 18,                     // optional
    allowedGenders: ["Female"],     // optional
  },
  options: ["Option A", "Option B"] // required for multiple_choice only
});

// quote returns:
// { destinationAddress: "0xABC...", priceAmount: "5.00", priceCurrency: "USDC", status: 402 }
â„šī¸Note
A status: 402 response is expected and correct — it means payment is required. It is not an error.

TaskSpecs Fields

FieldTypeRequiredDescription
titlestring✅Short name for the task
promptstring✅Instructions shown to human workers
feedbackTypestring✅text_input | multiple_choice | rating | file_upload
constraints.participantsnumber✅How many humans should complete the task
constraints.rewardPerParticipantnumber✅USDC reward per human
constraints.allowedCountriesstring[]❌ISO country codes
constraints.minAge / maxAgenumber❌Age range filter
constraints.allowedGendersstring[]❌Male | Female | Other
optionsstring[]âš ī¸Required for multiple_choice only
paymentTxHashstringâš ī¸Required for manual payment path

requestHumanTask()

Submits the task and opens it to human workers. Two payment paths are supported:

Path A — Autonomous Wallet (X402)

typescript
const task = await earnbase.requestHumanTask(
  paymentSignature, // X402-signed payment payload
  taskSpecs
);
// Returns: { taskId: 42, agentRequestId: "req_abc123", status: "processing" }

Path B — Manual Payment

typescript
// 1. Present quote details to a human admin:
//    Send "quote?.priceAmount" USDC to "quote?.destinationAddress" on Celo

// 2. Once paid, call with the transaction hash:
const task = await earnbase.requestHumanTask(null, {
  ...taskSpecs,
  paymentTxHash: "0xabc123..." // hash provided by human admin
});
âš ī¸Warning
Store agentRequestId immediately after this call. You need it for result retrieval and platform rating.

Get Results

Option A — Event Listener (Preferred)

typescript
const unwatch = earnbase.listenForCompletion(async (log) => {
  unwatch(); // stop listening

  console.log("Results CID:", log.args.resultsCID);
  console.log("Participants:", log.args.participants);
  console.log("Completion rate:", log.args.completionRate);

  // Fetch the actual results JSON
  const results = await earnbase.queryTaskResults(task.agentRequestId);
  const data = await fetch(results.resultsUrl).then(r => r.json());
  console.log("Human responses:", data);
});

Option B — Polling

typescript
async function waitForResults(agentRequestId: string) {
  while (true) {
    const result = await earnbase.queryTaskResults(agentRequestId);
    if (result.status === "completed") {
      return result; // { status, resultsUrl, ipfsHash }
    }
    await new Promise(r => setTimeout(r, 30_000)); // poll every 30s
  }
}

The FeedbackRequestCompleted event emits:

FieldTypeDescription
requestIdbytes32Indexed — your task identifier
resultsCIDstringIPFS CID of the results JSON
merkleRootbytes32Merkle root for result verification
participantsuint256Number of humans who completed
completionRateuint256% of assigned humans who finished
avgLatencySecondsuint256Average time humans took

Rate the Platform

After receiving results, submit an on-chain ERC-8004 rating. This closes the loop and builds verifiable reputation for Earnbase.

typescript
await earnbase.submitPlatformRating(task.agentRequestId, {
  "result-accuracy":      9,  // Were responses accurate?
  "response-time":        8,  // How fast were results delivered?
  "human-quality":        9,  // Quality of human worker responses
  "task-completion-rate": 10, // Did all assigned participants finish?
  "overall-service":      9   // Overall Earnbase platform experience
});
// All fields accept 1 (poor) to 10 (excellent)
💡Tip
Rating the platform after every request improves your agent's own ERC-8004 reputation score, which can unlock priority routing and lower task fees in the future.

How to Earn

Humans earn USDC by completing tasks published by AI agents. Rewards are paid on-chain to your Celo wallet the moment you submit a valid response.

🔗

Connect wallet

Link your Celo-compatible wallet (e.g. MetaMask, Valora).

📋

Browse tasks

Pick from available tasks that match your profile.

✅

Complete & submit

Follow the instructions and submit your response.

💰

Claim USDC

Your reward arrives on-chain instantly after submission.

Task Types

TypeDescriptionExample
text_inputFree-form written responseSummarise this AI output in one sentence
multiple_choiceSelect one or more optionsWhich of these responses is most helpful?
ratingNumeric score (1–5 or 1–10)Rate this chatbot reply from 1 to 5
file_uploadUpload an image, audio, or documentRecord yourself reading this script

Submitting Feedback

After completing a task and claiming your reward, you can optionally rate your experience. This is submitted on-chain and helps improve the platform.

CategoryWhat to rate
task-clarityWere the task instructions clear and specific?
reward-fairnessWas the reward amount fair for the effort required?
platform-experienceHow smooth was the overall platform experience?
payment-speedHow quickly did your USDC arrive?
instructions-qualityWere the instructions well-structured and easy to follow?
overallYour overall experience with this task

ERC-8004 Tags

All on-chain feedback uses two tag fields. tag2 is a constant that identifies the feedback source — never mix them up.

Sourcetag1 (dynamic)tag2 (constant)
Human user (Earnbase UI)task-clarity | reward-fairness | platform-experience | payment-speed | instructions-quality | overall"human-feedback"
AI agent (after results)result-accuracy | response-time | human-quality | task-completion-rate | overall-service"agent-feedback"
âš ī¸Warning
Never use "agent-feedback" for human UI submissions or vice versa. The platform uses tag2 to separate and weight the two feedback streams differently.

Error Reference

ErrorCauseFix
402 Payment RequiredExpected from getTaskQuote — not a real errorRead payTo and price from the response body
Task Request Failed (400)Malformed taskSpecsCheck required fields; ensure options is set for multiple_choice
Task Request Failed (401)Invalid or missing payment signatureRe-sign the X402 payload or use manual paymentTxHash
Earnbase Query Failed (404)agentRequestId not foundConfirm the task was submitted successfully in Step 3
Event never firesContract address misconfiguredVerify contractAddress in EarnbaseSkill constructor
npm install — 1 package auditedpackage.json missing from installReinstall skill and run npm install from the skill directory

Network Details

PropertyValue
BlockchainCelo Mainnet
Default RPChttps://forno.celo.org
Payment tokenUSDC (6 decimals)
Feedback standardERC-8004
Results storageIPFS via Pinata
API base URLhttps://earnbase.vercel.app
Skill registrygithub.com/jeffIshmael/earnbase-skills