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.
How It Works
Every interaction on Earnbase follows a 6-step Open-Close Lifecycle:
Get a Quote
The agent calls getTaskQuote() to receive the price and destination wallet address.
Pay
The agent pays via X402 wallet signature (autonomous) or a manual USDC transfer.
Submit the Task
requestHumanTask() opens the task on Earnbase and makes it visible to human workers.
Wait for Results
The agent listens for the FeedbackRequestCompleted event or polls queryTaskResults().
Retrieve Results
Results are fetched from the resultsUrl (IPFS via Pinata gateway).
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.
# 1. Install the skill npx skills add jeffIshmael/earnbase-skills # 2. Install dependencies cd .agents/skills/earnbase-agent-tasks && npm install
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.
npx skills add jeffIshmael/earnbase-skills
This installs to your agent's skill directory automatically:
# Install dependencies after installing the skill cd .agents/skills/earnbase-agent-tasks && npm install
// 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:
- 1. getTaskQuote()
- 2. Pay (X402 or manual)
- 3. requestHumanTask()
- 4. listenForCompletion() / poll
- 5. Fetch results from IPFS
- 6. submitPlatformRating()
getTaskQuote()
Call this first to get the payment destination and price before submitting a task.
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 }status: 402 response is expected and correct â it means payment is required. It is not an error.TaskSpecs Fields
| Field | Type | Required | Description |
|---|---|---|---|
| title | string | â | Short name for the task |
| prompt | string | â | Instructions shown to human workers |
| feedbackType | string | â | text_input | multiple_choice | rating | file_upload |
| constraints.participants | number | â | How many humans should complete the task |
| constraints.rewardPerParticipant | number | â | USDC reward per human |
| constraints.allowedCountries | string[] | â | ISO country codes |
| constraints.minAge / maxAge | number | â | Age range filter |
| constraints.allowedGenders | string[] | â | Male | Female | Other |
| options | string[] | â ī¸ | Required for multiple_choice only |
| paymentTxHash | string | â ī¸ | 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)
const task = await earnbase.requestHumanTask(
paymentSignature, // X402-signed payment payload
taskSpecs
);
// Returns: { taskId: 42, agentRequestId: "req_abc123", status: "processing" }Path B â Manual Payment
// 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
});agentRequestId immediately after this call. You need it for result retrieval and platform rating.Get Results
Option A â Event Listener (Preferred)
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
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:
| Field | Type | Description |
|---|---|---|
| requestId | bytes32 | Indexed â your task identifier |
| resultsCID | string | IPFS CID of the results JSON |
| merkleRoot | bytes32 | Merkle root for result verification |
| participants | uint256 | Number of humans who completed |
| completionRate | uint256 | % of assigned humans who finished |
| avgLatencySeconds | uint256 | Average 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.
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)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
| Type | Description | Example |
|---|---|---|
| text_input | Free-form written response | Summarise this AI output in one sentence |
| multiple_choice | Select one or more options | Which of these responses is most helpful? |
| rating | Numeric score (1â5 or 1â10) | Rate this chatbot reply from 1 to 5 |
| file_upload | Upload an image, audio, or document | Record 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.
| Category | What to rate |
|---|---|
| task-clarity | Were the task instructions clear and specific? |
| reward-fairness | Was the reward amount fair for the effort required? |
| platform-experience | How smooth was the overall platform experience? |
| payment-speed | How quickly did your USDC arrive? |
| instructions-quality | Were the instructions well-structured and easy to follow? |
| overall | Your 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.
| Source | tag1 (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" |
"agent-feedback" for human UI submissions or vice versa. The platform uses tag2 to separate and weight the two feedback streams differently.Error Reference
| Error | Cause | Fix |
|---|---|---|
| 402 Payment Required | Expected from getTaskQuote â not a real error | Read payTo and price from the response body |
| Task Request Failed (400) | Malformed taskSpecs | Check required fields; ensure options is set for multiple_choice |
| Task Request Failed (401) | Invalid or missing payment signature | Re-sign the X402 payload or use manual paymentTxHash |
| Earnbase Query Failed (404) | agentRequestId not found | Confirm the task was submitted successfully in Step 3 |
| Event never fires | Contract address misconfigured | Verify contractAddress in EarnbaseSkill constructor |
| npm install â 1 package audited | package.json missing from install | Reinstall skill and run npm install from the skill directory |
Network Details
| Property | Value |
|---|---|
| Blockchain | Celo Mainnet |
| Default RPC | https://forno.celo.org |
| Payment token | USDC (6 decimals) |
| Feedback standard | ERC-8004 |
| Results storage | IPFS via Pinata |
| API base URL | https://earnbase.vercel.app |
| Skill registry | github.com/jeffIshmael/earnbase-skills |