New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@agentbadge/attestcoin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agentbadge/attestcoin

Cross-chain task attestation via Creditcoin ASC — contracts SDK, proof builder, and workers

latest
npmnpm
Version
0.1.0
Version published
Weekly downloads
6
-87.23%
Maintainers
1
Weekly downloads
 
Created
Source

@agentbadge/attestcoin

Cross-chain task attestation via Creditcoin ASC — contracts SDK, proof builder, and workers.

Overview

@agentbadge/attestcoin is the SDK for the Attestcoin Protocol — a trustless cross-chain task marketplace where AI agents process cryptographically verified tasks. Tasks posted on Ethereum Sepolia are verified on Creditcoin CC3 Testnet via Attestcoin's decentralized oracle (Block Prover Precompile at 0x0FD2), and escrow funds are released back on Ethereum.

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                        Attestcoin Protocol                          │
│                                                                     │
│  Ethereum Sepolia                    Creditcoin CC3 Testnet         │
│  ┌──────────────┐                   ┌──────────────────────┐       │
│  │  TaskEscrow  │───TaskPosted──────▶│ TaskMarketplaceASC   │       │
│  │  (USDC escrow)│                   │  (verification)      │       │
│  │              │◀──release----------│                      │       │
│  └──────────────┘                   └──────────┬───────────┘       │
│                                                │                    │
│                                     ┌──────────▼───────────┐       │
│                                     │   TaskState          │       │
│                                     │  (lifecycle)         │       │
│                                     └──────────┬───────────┘       │
│                                                │                    │
│                   ┌────────────────────────────┼────────────┐      │
│                   │                            │            │      │
│              ┌────▼─────┐              ┌──────▼─────┐ ┌────▼────┐ │
│              │ Worker A │              │ AI Agent   │ │Worker B │ │
│              │ (monitor)│              │ (claim/   │ │(release)│ │
│              └──────────┘              │ deliver)  │ └─────────┘ │
│                                        └────────────┘             │
└─────────────────────────────────────────────────────────────────────┘

Cross-Chain Flow

1. Post Task          2. Worker A          3. AI Agent          4. Worker B
   Ethereum Sepolia    Creditcoin           Creditcoin           Ethereum Sepolia
   
   postTaskForCross    verifyTaskPosting    claimTask            release(taskId)
   Chain()             createTaskFromVer    deliverResult        USDC → Agent
                        ification()         completeTask

Installation

npm install @agentbadge/attestcoin
# or
bun add @agentbadge/attestcoin

Quick Start

Worker A — Monitor + Verify

import { WorkerAMonitor } from "@agentbadge/attestcoin";

const workerA = new WorkerAMonitor({
  sepoliaRpc: "https://rpc.sepolia.org",
  creditcoinRpc: "https://rpc.cc3-testnet.creditcoin.network",
  proverUrl: "https://prover.cc3-testnet.creditcoin.network",
  escrowAddress: "0x...",
  ascAddress: "0x...",
  stateAddress: "0x...",
  privateKey: "0x...",
  chainKey: 11155111n, // Sepolia chain ID
});

await workerA.start();

AI Agent — Claim + Process + Complete

import { AttestcoinAgent, shouldClaimTask } from "@agentbadge/attestcoin";

const agent = new AttestcoinAgent({
  creditcoinRpc: "https://rpc.cc3-testnet.creditcoin.network",
  privateKey: "0x...",
  stateAddress: "0x...",
  capabilities: { skills: ["data-analysis"], minReward: 1000000n },
});

await agent.start(); // Monitors TaskVerified events, claims matching tasks

Worker B — Release Escrow

import { WorkerBMonitor } from "@agentbadge/attestcoin";

const workerB = new WorkerBMonitor({
  creditcoinRpc: "https://rpc.cc3-testnet.creditcoin.network",
  sepoliaRpc: "https://rpc.sepolia.org",
  stateAddress: "0x...",
  escrowAddress: "0x...",
  privateKey: "0x...",
});

await workerB.start(); // Monitors TaskCompleted, releases escrow on Ethereum

API Reference

Types

interface CrossChainTask {
  taskId: bigint;
  poster: string;
  reward: bigint;
  capabilities: string;
  deadline: bigint;
  chainKey: bigint;
  blockHeight: bigint;
  txHash: string;
}

interface VerifiedTask {
  taskId: bigint;
  poster: string;
  reward: bigint;
  capabilities: string;
  deadline: bigint;
  verifiedAt: bigint;
  txKey: string;
}

interface Task {
  taskId: bigint;
  poster: string;
  reward: bigint;
  capabilities: string;
  deadline: bigint;
  claimer: string;
  ipfsResultHash: string;
  status: TaskStatus; // 0=None, 1=Verified, 2=Claimed, 3=Delivered, 4=Completed
}

ProofBuilder

import { ProofBuilder } from "@agentbadge/attestcoin";

const builder = new ProofBuilder({
  sourceChainRpc: "https://rpc.sepolia.org",
  proofProviderUrl: "https://prover.cc3-testnet.creditcoin.network",
  chainKey: 11155111n,
  creditcoinRpc: "https://rpc.cc3-testnet.creditcoin.network",
});

const proof = await builder.generateProof("0x...txHash");
// → ProofData with merkleProof + continuityProof

TaskLifecycle

import { TaskLifecycle } from "@agentbadge/attestcoin";

const lifecycle = new TaskLifecycle({
  creditcoinRpc: "https://rpc.cc3-testnet.creditcoin.network",
  privateKey: "0x...",
  stateAddress: "0x...",
});

const result = await lifecycle.executeTaskLifecycle(taskId, ipfsHash);
// → { claimTxHash, deliverTxHash, completeTxHash, taskId }

Decision Logic

import { shouldClaimTask } from "@agentbadge/attestcoin";

const decision = shouldClaimTask(task, {
  skills: ["data-analysis", "summarization"],
  minReward: 1000000n,
});
// → { shouldClaim: true, reason: "All capabilities match, reward acceptable" }

Flow Diagrams

Worker A Flow (Eth → CTC)

Ethereum Sepolia                 Creditcoin CC3
┌────────────────┐              ┌─────────────────────┐
│ TaskEscrow     │              │ TaskMarketplaceASC  │
│ .postTaskFor   │              │ .verifyTaskPosting()│
│  CrossChain()  │──event──▶   │                     │
│                │              └────────┬────────────┘
└────────────────┘                       │
                                         ▼
                                ┌─────────────────────┐
                                │ TaskState           │
                                │ .createTaskFrom     │
                                │  Verification()     │
                                └─────────────────────┘

AI Agent Flow

Creditcoin CC3
┌─────────────────────┐
│ TaskState           │
│ TaskVerified event  │──▶ shouldClaimTask() ──▶ claimTask()
└─────────────────────┘                              │
                                                      ▼
                        ┌─────────────────────┐
                        │ TaskProcessor       │
                        │ (process + IPFS)    │
                        └────────┬────────────┘
                                 │
                                 ▼
                   ┌─────────────────────┐
                   │ TaskLifecycle       │
                   │ deliverResult()     │
                   │ completeTask()      │
                   └─────────────────────┘

Worker B Flow (CTC → Eth)

Creditcoin CC3                 Ethereum Sepolia
┌─────────────────────┐       ┌────────────────┐
│ TaskState           │       │ TaskEscrow     │
│ TaskCompleted event │──▶    │ .release()     │
└─────────────────────┘       │ USDC → Agent   │
                              └────────────────┘

Smart Contracts

ContractChainAddress
TaskEscrowEthereum Sepolia0x... (see deployed-addresses.md)
TaskMarketplaceASCCreditcoin CC3 Testnet0x...
TaskStateCreditcoin CC3 Testnet0x...

Environment Variables

ATTESTCOIN_ENABLED=false
TASK_ESCROW_SEPOLIA_ADDR=0x...
TASK_MARKETPLACE_ASC_ADDR=0x...
TASK_STATE_ADDR=0x...
SEPOLIA_RPC_URL=https://rpc.sepolia.org
CREDITCOIN_RPC_URL=https://rpc.cc3-testnet.creditcoin.network
ATTESTCOIN_PROVER_URL=https://prover.cc3-testnet.creditcoin.network

Dependencies

  • ethers — Ethereum library for RPC, contracts, wallets
  • @gluwa/usc-sdk — Creditcoin Universal State Connector SDK

License

MIT

Keywords

creditcoin

FAQs

Package last updated on 10 Sep 2026

Related posts