Quickstart
From zero to a registered, reputation-tracked AI agent on Robinhood Chain testnet in about 10 minutes. You need Node.js 18+, Robinhood testnet ETH, and an RPC URL.
Install the SDK
npm install @countersig/protocol-sdk ethers
Get testnet $CSIG
Call the public faucet on CSIGToken once per wallet (24-hour cooldown).
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const signer = new ethers.Wallet(process.env.OPERATOR_PRIVATE_KEY, provider);
const csig = new ethers.Contract(
'0x7E44aF56d14EBfd16D5D7Ba4F011b5206d487D55',
['function faucet() external'],
signer
);
await csig.faucet(); // Mints 1,000 CSIG to your wallet
Generate an Ed25519 keypair
Your agent's cryptographic identity. The public key is stored on-chain. Store the private key securely — it cannot be recovered.
import { CountersigAgent } from '@countersig/protocol-sdk';
const { agent, privateKey } = CountersigAgent.generate({
agentAddress: signer.address,
chainId: 46630,
});
console.log(agent.did);
// → did:countersig:46630:0xYourAddress
// Store privateKey in your secrets manager — never commit it.
Approve and register on-chain
Two transactions: approve the staking contract to spend CSIG, then register. The contract computes your didHash from your address and chain ID.
import { registerAgent } from '@countersig/protocol-sdk';
const IDENTITY_ADDRESS = '0xCCF2Fd69c07EDFbc3C215cfD31e2F20FC208A16C';
const STAKING_ADDRESS = '0x7281cf35ae9Bf56EAF5B1d0C2C8e167e50BCEC75';
const minStake = ethers.parseEther('1000');
await csig.approve(STAKING_ADDRESS, minStake);
const { didHash, txHash } = await registerAgent(
signer, signer.address, agent.publicKeyBytes32,
IDENTITY_ADDRESS, STAKING_ADDRESS, minStake
);
console.log('Registered:', `https://explorer.testnet.chain.robinhood.com/tx/${txHash}`);
Verify registration and check score
import { CountersigVerifier } from '@countersig/protocol-sdk';
const REPUTATION_ADDRESS = '0xbB0c9C2DF28af31905dEfEa04c80372C0909f1bF';
const verifier = new CountersigVerifier({
rpcUrl: process.env.RPC_URL,
addresses: { identity: IDENTITY_ADDRESS, reputation: REPUTATION_ADDRESS, staking: STAKING_ADDRESS },
chainId: 46630,
});
const identity = await verifier.getIdentity(agent.did);
console.log(identity.status); // → Active
const score = await verifier.getTotalScore(agent.did);
console.log(score); // → 5 (community baseline — grows with activity)
Sign a challenge (A2A authentication)
When a peer agent asks your agent to prove who it is, sign the challenge with your Ed25519 key.
const myAgent = new CountersigAgent({
privateKey: process.env.AGENT_ED25519_SEED,
agentAddress: signer.address,
chainId: 46630,
});
// Peer issues a challenge → your agent signs it
const signature = myAgent.signChallenge(challenge.payload);
// Peer verifies: signature + on-chain pubkey + reputation threshold
const valid = await verifier.verifySignature(myAgent.did, challenge.payload, signature);
const trusted = await verifier.meetsThreshold(myAgent.did, 60);
Audit every action with your DID
Pass agent_did in each CounterAudit ingest call. Your on-chain identity and live reputation score are sealed into every packet.
await fetch('https://api.counteraudit.io/v1/audit/ingest', {
method: 'POST',
headers: {
'Authorization': `Bearer ${CA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
connector_id: 'my-agent',
agent_did: myAgent.did,
raw_event: { action: 'tool_call', tool: 'web_search', query: '...' },
}),
});
Next steps
Now that your agent is registered, explore the rest of the documentation: