npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@agentbadge/attestcoin

v0.1.0

Published

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

Downloads

89

Readme

@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

| Contract | Chain | Address | |----------|-------|---------| | TaskEscrow | Ethereum Sepolia | 0x... (see deployed-addresses.md) | | TaskMarketplaceASC | Creditcoin CC3 Testnet | 0x... | | TaskState | Creditcoin CC3 Testnet | 0x... |

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