Sigvara
v1.0.0-alpha.24Read-only checks of an AI agent's Sigvara standing, score, stake and slashes before you rely on it.
TypeScript SDK for the Sigvara protocol: on-chain agent identity, computed reputation, staked accountability, and Ed25519 challenge-response authentication between agents. Successor to @countersig/protocol-sdk. Runtime dependencies are ethers v6 and tweetnacl. Node 18 or newer. Use 1.0.0-alpha.12 or later. On 1.0.0-alpha.9 and earlier an agent object carries its secret key in an ordinary property, so JSON.stringify(agent) or logging one includes it; never log or serialize an agent from those versions.
Summary extracted from the README.
@sigvara/protocol-sdk
TypeScript SDK for the Sigvara protocol: on-chain agent identity, computed
reputation, staked accountability, and Ed25519 challenge-response
authentication between agents. Successor to @countersig/protocol-sdk.
npm install @sigvara/protocol-sdk
Runtime dependencies are ethers v6 and tweetnacl. Node 18 or newer.
Use 1.0.0-alpha.12 or later. On 1.0.0-alpha.9 and earlier an agent object carries its secret key in an
ordinary property, so JSON.stringify(agent) or logging one includes it; never log or serialize an
agent from those versions. If one was logged, serialized or sent to an error reporter, treat its key as
exposed and rotate it (Key Rotation).
Upgrading from 1.0.0-alpha.11:
agent.signChallengeis removed. It signed whatever it was handed, so a verifier could get an agent to sign a challenge naming a different verifier and present the signature there as the agent. A call does not compile in TypeScript, and in JavaScript it throws an error that namessignChallengeFor(payload, audience), which signs only a challenge addressed to the audience you pass and works from 1.0.0-alpha.10. The exported functionsignChallenge(payload, secretKey)is unchanged. Details in CHANGELOG.md.
Upgrading from 1.0.0-alpha.10:
verifySignaturenow requires the audience, as its fifth argument. Leaving it out used to compile and skip the check of who the agent had signed for, so a response given to one verifier was accepted at another, and a v1 payload was accepted too. It now does not compile in TypeScript, throwsexpectedAudience is requiredin JavaScript, and a v1 payload is always refused. A caller that already passes the audience needs no change. Details in CHANGELOG.md.
Upgrading from 1.0.0-alpha.9: the secret key is now a private field, so code that read it by reaching around the type system stops working; sign with
signChallengeFor. It signs only a challenge addressed to the audience you pass, wheresignChallengesigned whatever it was handed and is removed in 1.0.0-alpha.12. A gate now also checks the bond held now, so an agent admitted at an old minimum stake and not topped up is refused asnot_active. It refuses to be built with athresholdorttlSecondsthat is not a usable number, refuses a challenge dated more than 60 seconds ahead, and gives up on a chain read after 30 seconds (timeoutMs). The optionalmaxScoreAgeSecondsrefuses a score nobody has refreshed. Details in CHANGELOG.md.
Upgrading from 1.0.0-alpha.7:
generateChallengenow takes an audience as its second argument, and every existing call site needs it.- const challenge = generateChallenge(agentDid); + const challenge = generateChallenge(agentDid, 'https://your-service.example');Without it, a verifier holding a valid response could present that same response to a different verifier and be accepted as the agent. Pass the same audience to
verifySignatureas its fifth argument; on 1.0.0-alpha.10 and earlier, omitting it still compiles and still accepts the relayable older proofs. Full detail in CHANGELOG.md.This does not make you replay-proof. The audience stops a response being reused at a different verifier. Reuse at yours is stopped by remembering the nonce, and the SDK cannot do that for you — see What the SDK still needs from you.
What it does
- Agent identity. Generate an Ed25519 keypair, derive the agent's
did:sigvara:<chainId>:<address>and its on-chaindidHash, and register the agent from the operator wallet, with a proof of control signed by the agent address. - Agent-to-agent auth. Issue a challenge to a peer, sign one with the agent's key, and verify a signature against the public key stored on chain.
- Reads. Identity, status, six-factor reputation,
meetsThreshold, stake and minimum-stake checks, and a W3C DID Document built from chain state. - Stake.
depositStakehandles the ERC-20 approval and the deposit in one call, and is what moves a newly registered agent fromPendingBondtoActive. - A gate.
SigvaraGateturns the reads above into one decision: issue a challenge, admit or refuse, and say which reason applies. It owns the nonce, so replay protection is not left to the caller. - A check before paying or hiring.
SigvaraTrustCheckasks the gate's question about a bare address.sigvaraX402Fetchputs it in front of an x402 payment, andsigvaraTrustToolandrequireTrustedAgentput it in an agent framework's tools. - Payment outcomes. After paying an agent, sign whether the work was
delivered (
signPaymentOutcome), so the oracle can count it without a token, and check such a signature the way the oracle does (verifyPaymentOutcome).
Scores come in two forms. The earned score is what the oracle last finalized; the total
score is the matured one, which climbs toward it over time and is what meetsThreshold
checks. A newly bonded agent has earned a score before it can spend it.
Quick start
import { SigvaraAgent, SigvaraVerifier, registerAgent, depositStake, generateChallenge } from '@sigvara/protocol-sdk';
import { ethers } from 'ethers';
const RPC = 'https://rpc.testnet.arc.io';
const CHAIN_ID = 5042002; // Arc testnet
const addresses = { identity: '0x…', reputation: '0x…', staking: '0x…' }; // deployments/5042002.json
// Operator side: create, register and bond an agent
const { agent, privateKey } = SigvaraAgent.generate({ agentAddress: '0xAgent…', chainId: CHAIN_ID });
const operator = new ethers.Wallet(process.env.OPERATOR_KEY!, new ethers.JsonRpcProvider(RPC));
// The agent address must prove control of itself. Pass a signer for it, or
// { signature } if it was signed elsewhere (HSM, Safe, any ERC-1271 contract).
const agentSigner = new ethers.Wallet(process.env.AGENT_KEY!); // a signer for agent.agentAddress
await registerAgent(operator, agent.agentAddress, agent.publicKeyBytes32, addresses.identity, { agentSigner });
// Registration leaves the agent PendingBond. This deposit is what activates it.
await depositStake(operator, agent.didHash, 1000n * 10n ** 18n, addresses.staking);
// Counterparty side: challenge the agent, verify the signature, read status and score
const verifier = new SigvaraVerifier({ rpcUrl: RPC, addresses, chainId: CHAIN_ID });
// The second argument is the audience: who is asking. Pass a stable identifier you
// control, normally your own origin. It is signed, so the agent's response proves it was
// talking to *you* and cannot be relayed onward by anyone who receives it.
const challenge = generateChallenge(agent.did, 'https://your-service.example');
// Done by the agent, returned to the counterparty. signChallengeFor refuses a challenge that is not
// addressed to the verifier the agent means to prove itself to, which is what stops a verifier from
// collecting a signature meant for someone else.
const signature = agent.signChallengeFor(challenge.payload, 'https://your-service.example');
// Pass the same audience back when verifying. It is required: verifySignature throws without
// it, and it refuses a v1 payload, which names no audience to check.
const ok = await verifier.verifySignature(
agent.did, challenge.payload, signature, 300, 'https://your-service.example',
);
const trusted = ok && (await verifier.isActive(agent.did)) && (await verifier.meetsThreshold(agent.did, 40));
The 40 in these examples is a placeholder. A score below roughly 60 says little on its own, so read what a fake score costs before you pick a number, and sigvara.xyz/status for how the scores spread today.
Signature validity, status and score are separate reads. Combining them correctly is easy to get subtly wrong, so there is a piece that does it.
Refusing work: SigvaraGate
import { SigvaraGate } from '@sigvara/protocol-sdk';
const gate = new SigvaraGate({
rpcUrl: RPC, addresses, chainId: CHAIN_ID,
threshold: 40,
audience: 'https://your-service.example', // required, and signed into every challenge
});
// 1. hand the challenge to the agent
const challenge = gate.challenge(agentDid);
// 2. the agent signs challenge.payload and returns the signature
// 3. decide
const result = await gate.admit(agentDid, challenge, signature);
if (!result.ok) {
// 'bad_proof' | 'replayed' | 'not_active' | 'below_bond' | 'stale_score' | 'below_threshold'
return refuse(result.reason);
}
The reasons are separate because they need different responses. bad_proof means
nothing was proven. replayed means a valid signature arrived twice. not_active
means a real, proven agent that is unbonded, suspended or slashed, and telling that
caller to earn more points would be wrong. "Unbonded" is the bond held now against the
minimum stake in force now, not the status stored when the agent was admitted: a minimum
raised since leaves an agent marked Active while it holds less than the contract asks, and
the gate reads the bond for that reason. below_bond appears only if you set minBond, and
stale_score only if you set maxScoreAgeSeconds. Only below_threshold is about reputation,
and it carries the score so you can say how short they were.
A score nobody has refreshed. Nothing on chain ages a score, so one left over from an
oracle outage keeps passing a threshold. Set maxScoreAgeSeconds to refuse a score written
longer ago than that, or never, with stale_score. A healthy score gets to about two of your
oracle's proposals apart before the next one lands (about 20 hours on Arc testnet, where an unchanged score is proposed again every 12 hours, two days on a daily
epoch), so choose more than that. It is measured against your host's clock. Unset, a score is trusted however old it is.
It costs one more read per admission. The same check exists on chain as
SigvaraReader.isTrustedFresh, on Arc testnet at 0x99B15D0a2cdaf8610D3fBa6C7c0ed2D48b34fa17.
More at stake than the minimum covers. Set minBond to refuse an agent holding less, with
below_bond, whatever its score (from 1.0.0-alpha.16). It is in the bond token's base units, as
a bigint or a string of digits. A number is refused, because a floor past what a double can hold
would quietly become another floor. A floor under the protocol's minimum still needs the minimum,
and an amount queued for withdrawal does not count. It compares the same number as
SigvaraReader.isTrusted(agent, minScore, minBond), and costs one more read per admission.
The constructor refuses a threshold that is not a finite number of 0 or more, and a
ttlSeconds or maxScoreAgeSeconds that is not a positive number. A NaN threshold, for example
Number(process.env.THRESHOLD) with the variable unset, would otherwise admit every active
agent that can prove its key, whatever its score.
A gate that has to say how it runs. Two of the defaults suit a test bench and not a
deployment, and both fail open by being left out: instances defaults to one process, and no
maxScoreAgeSeconds means no age limit. profile: 'production' (from 1.0.0-alpha.14) makes the
constructor refuse to build the gate until both are set, and names everything missing in one error:
const gate = new SigvaraGate({
rpcUrl: RPC, addresses, chainId: CHAIN_ID,
threshold: 40,
audience: 'https://your-service.example',
profile: 'production',
instances: 'multiple', // or 'single' if exactly one process serves this gate
nonceStore, // shared and atomic, required with 'multiple' (see below)
maxScoreAgeSeconds: 86_400, // more than two of your oracle's proposals apart
});
Any other profile value is refused rather than ignored, so 'prod' read from an environment
variable does not quietly build the unchecked gate.
The proof is checked before the status or the score is read, so a caller who cannot prove an identity cannot make your gate read either, and a failed proof does not consume the nonce, so nobody can lock out a challenge's legitimate holder by spending it with garbage. Checking the proof does cost one read of the agent's registered key, because the key it is checked against lives on chain: rate-limit callers where the gate is exposed.
Reads give up after 30 seconds (timeoutMs on SigvaraGate and SigvaraVerifier changes it;
ethers' own default is five minutes), and the status, the bond and the score are read together.
The default nonce store is per process. It is correct for one instance and wrong for
a fleet: two processes do not share a set, so a response accepted by one replays against
the other. Pass a NonceStore backed by Redis or your database, and implement its
optional consume(nonce, expiresAt) as an atomic insert-if-absent (SET NX, a unique
index, a conditional put). seen then add is two round trips, and two concurrent
requests carrying the same nonce can both observe it unspent before either writes.
A store for Redis with ioredis looks like this. Each nonce is one key that expires with its
challenge, and SET ... NX succeeds only for the call that creates it:
import Redis from 'ioredis';
import { SigvaraGate, type NonceStore } from '@sigvara/protocol-sdk';
const redis = new Redis(process.env.REDIS_URL!);
const key = (nonce: string) => `sigvara:nonce:${nonce}`;
// Never shorter than the challenge: a nonce forgotten early can be replayed. The extra minute is
// for hosts whose clocks disagree.
const seconds = (expiresAt: number) => Math.max(1, expiresAt - Math.floor(Date.now() / 1000) + 60);
const nonceStore: NonceStore = {
consume: async (nonce, expiresAt) =>
(await redis.set(key(nonce), '1', 'EX', seconds(expiresAt), 'NX')) === 'OK',
seen: async (nonce) => (await redis.exists(key(nonce))) === 1,
add: async (nonce, expiresAt) => { await redis.set(key(nonce), '1', 'EX', seconds(expiresAt)); },
prune: () => {}, // Redis drops the keys itself
};
const gate = new SigvaraGate({
rpcUrl: RPC, addresses, chainId: CHAIN_ID,
threshold: 40,
audience: 'https://your-service.example',
nonceStore,
});
While consume exists the gate calls it and nothing else; seen and add are there because the
type asks for them. In SQL, make the nonce the primary key, have consume return whether
insert ... on conflict do nothing added a row, and have prune delete the rows past
expiresAt. Give every instance the same store. If the store throws, admit throws and has
admitted nothing: answer that as a refusal.
Only challenges this gate issued. A gate remembers what was spent, not what it issued, so by
default it accepts any challenge for its audience that the agent signed in the last ttlSeconds,
including one the agent wrote itself. Set challengeSecret (from 1.0.0-alpha.16, at least 32
characters) and the gate marks each nonce it issues with a keyed hash and refuses any other with
bad_proof, before any read. It keeps no state: give every instance the same secret, and they
accept each other's challenges. It adds to the nonce store and does not replace it, because a
challenge the gate did issue can still be presented twice.
Full protocol documentation, the reputation model and the contract addresses live in the repository.
What the SDK still needs from you
An audience you control. SigvaraGate requires one at construction and refuses to
be built without it, and verifySignature requires the same string as its fifth argument.
It is signed into every challenge and is what stops a response you
received being presented to somebody else as proof the agent was talking to them. Use one
stable value per service, normally your origin, not one per request.
A shared nonce store, if you run more than one instance. The gate remembers nonces so
you do not have to, which is the one thing this section used to say the library could not
do. The default store is in memory and therefore per process; see the note above for what
a distributed one has to implement. atomicNonceStore builds one from a Redis SET NX or a
database insert, and instances: 'multiple' makes the gate refuse to start without one (both
from 1.0.0-alpha.13).
An explicit topology and score age in production. Pass profile: 'production' and the gate
will not start until instances and maxScoreAgeSeconds are set, so a fleet cannot run on the
per-process store, or admit on a score the oracle stopped refreshing, because a setting was left
out (from 1.0.0-alpha.14).
Using verifySignature directly still leaves the nonce to you. It has no memory by
design, so if you are not going through the gate, store the nonces you issue, reject one
you have seen, and drop them past the TTL.
Before paying or hiring: SigvaraTrustCheck
From 1.0.0-alpha.16. The gate asks a caller to prove who it is. To decide whether to pay an address, what matters is who the money goes to, so there is no proof to ask for and the rest of the rule is the same:
import { SigvaraTrustCheck } from '@sigvara/protocol-sdk';
const trust = new SigvaraTrustCheck({
rpcUrl: RPC, addresses, chainId: CHAIN_ID,
minScore: 40,
minBond: 5_000_000_000n, // optional, as on the gate
maxScoreAgeSeconds: 86_400, // optional, as on the gate
});
const verdict = await trust.check('0x...');
// { ok: true, agent, score } or { ok: false, agent, reason, detail, score? }
// reason: 'not_an_address' | 'not_active' | 'below_bond' | 'stale_score' | 'below_threshold'
A read that fails throws, with any URL taken out of the message. It says nothing about the agent, so it is neither a yes nor a no, and whatever this guards should not go ahead.
x402: sigvaraX402Fetch
An x402 client wraps fetch: it sees a 402, picks an offer, signs a payment and retries. Nothing in that
asks whether the party being paid has any standing, and an exact payment is final once settled. Wrap the
fetch underneath the client, so the check sees the 402 first:
import { wrapFetchWithPayment, x402Client } from '@x402/fetch';
import { registerExactEvmScheme } from '@x402/evm/exact/client';
import { SigvaraTrustCheck, sigvaraX402Fetch, X402SellerRefused } from '@sigvara/protocol-sdk';
const trust = new SigvaraTrustCheck({ rpcUrl: RPC, addresses, chainId: CHAIN_ID, minScore: 40 });
const client = new x402Client();
registerExactEvmScheme(client, { signer: account });
const pay = wrapFetchWithPayment(sigvaraX402Fetch(fetch, trust), client);
try {
const res = await pay('https://seller.example/resource');
} catch (err) {
if (err instanceof X402SellerRefused) {
// err.refused[0].reason: why this seller was not paid
} else {
throw err;
}
}
It takes the older x402-fetch the same way, wrapFetchWithPayment(sigvaraX402Fetch(fetch, trust), wallet). Both
were run against a test seller and the real chain for this release. A seller without standing rejects the request
with X402SellerRefused, whose refused lists each verdict, and the client never gets anything to sign. Anything else, including a 402 whose sellers all pass, comes back
exactly as it arrived. Every address offered must pass, because the client chooses among them. It reads the v2
PAYMENT-REQUIRED header and the v1 JSON body, and a server sending both is held to both. A 402 it cannot read
is refused, since a client that can read it would then pay unchecked. So is one whose header or body is larger
than X402_MAX_BYTES (64 KiB), or that makes more than X402_MAX_OFFERS (16) offers. Sellers are checked four
at a time, and one address spelled in two cases is checked once.
A seller has to be paid at the agent's registered address for this to find it. One paid at another address, or on a chain with its own addresses, reads as having no standing, and is refused. This is a check on who is paid. It does not say the work will be delivered.
Agent frameworks: sigvaraTrustTool and requireTrustedAgent
See the LangChain section of the
framework guide. You pass in LangChain's tool, so it does not become a dependency of this package.
Payment outcomes: signPaymentOutcome
From 1.0.0-alpha.13.
The payer of an agent is the party whose opinion of the work counts most, and it already
holds a key. signPaymentOutcome signs, as the payer, whether one payment's work was
delivered, over EIP-712 typed data bound to that payment
(ADR 0006).
The result is the payerOutcome of the oracle's POST /attest, which takes it with no token:
the signature is the credential.
import { signPaymentOutcome, OUTCOME_DELIVERED } from '@sigvara/protocol-sdk';
// payerWallet sent the payment; txHash is its settlement transaction.
const payerOutcome = await signPaymentOutcome(payerWallet, {
chainId: 5042002, // the chain the payment settled on
reputationAddress: '0x…', // its SigvaraReputation proxy (deployments/5042002.json)
didHash: agent.didHash, // the agent paid
txHash,
outcome: OUTCOME_DELIVERED,
// evidence: optional 32 bytes, such as the hash of the response received
// deadline: seconds, at most 30 days after signing; a day by default
});
await fetch('https://oracle.sigvara.xyz/attest', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ didHash: agent.didHash, payment: { txHash }, payerOutcome }),
});
For a payment on a payment chain (ADR 0009),
sign with that chain's id and name it in the request: payment: { txHash, chainId }. Oracles that have
the chain switched on answer 503 until the payment is finalized there, so send it again.
A smart account pays and signs too, if it answers ERC-1271 for its owner's EIP-712
signatures: pass the owner's signer and the account as payer. An account that wraps what
its owner signs needs its own wallet SDK to sign the same typed data
(PAYMENT_OUTCOME_TYPES, paymentOutcomeDomain).
verifyPaymentOutcome checks such a signature the way the oracle does: by recovery for an
address without code, by ERC-1271 for one with code, with OpenZeppelin's rules for both. It
needs a provider on the payment's chain, because whether the payer has code decides which, and
takes a blockTag so both reads are at one block. It checks the signature only. The oracle also checks the payment, the payer's leg in it, the
timing and its own records, and takes only "delivered" until negatives are switched on.
test/vectors/payment-outcome.json in the repository holds the cases both functions are
tested against, and the same cases are checked on chain with OpenZeppelin's own code.
ERC-8004 validation: requestValidation and readValidation
From 1.0.0-alpha.24.
Sigvara answers ERC-8004 validation requests with the spendable score of the Sigvara agent an ERC-8004 agent is linked to, so the score sits in the Validation Registry, where readers of ERC-8004 already look (ADR 0014). The agent asks once, from the wallet that owns it, after linking:
import { requestValidation, ARC_TESTNET_VALIDATION } from '@sigvara/protocol-sdk';
const { requestHash, txHash } = await requestValidation(ownerWallet, agentId, ARC_TESTNET_VALIDATION);
Sigvara answers an agent's first request only, so requestValidation refuses when the agent has
asked already. It keeps the answer current: a changed score at most once a UTC day, a slash's
zero at once, and an unchanged score again every 7 days. validationRequestFile gives the
request's URI and hash for a wallet that sends the transaction itself.
Anyone reads the answer:
import { readValidation, ARC_TESTNET_VALIDATION } from '@sigvara/protocol-sdk';
const answer = await readValidation(provider, agentId, ARC_TESTNET_VALIDATION);
const current = answer.status === 'answered' && Date.now() / 1000 - answer.lastUpdate < 8 * 86_400;
if (current && answer.score >= 40) {
// a score of at least 40, sent or confirmed in the last 8 days
}
none means no request of the agent's has been answered yet, and retired that its link ended
or moved to another ERC-8004 agent, so there is no score. The read costs two calls however many
requests the agent has opened, and refuses an answer that does not name this agent and
validator. Both functions refuse a provider on another chain than the deployment's.
Trust lookups for agents: sigvara-mcp
From 1.0.0-alpha.15.
An MCP server that lets any agent with an MCP host (Claude, Cursor, ElizaOS through its MCP plugin, and others) check another agent on chain before paying or relying on it. Every tool reads. None signs or sends a transaction, and the server holds no key. It speaks MCP over stdio with no dependency beyond this package's own.
claude mcp add sigvara -- npx -y -p @sigvara/protocol-sdk sigvara-mcp
or, in a host's JSON config:
{ "mcpServers": { "sigvara": { "command": "npx", "args": ["-y", "-p", "@sigvara/protocol-sdk", "sigvara-mcp"] } } }
or in Codex:
codex mcp add sigvara -- npx -y -p @sigvara/protocol-sdk sigvara-mcp
It is listed in the official MCP Registry
as io.github.RunTimeAdmin/sigvara, from 1.0.0-alpha.20 (server.json), so a host that reads the registry can
find it by name.
It reads the Arc testnet deployment unless told otherwise. On another chain, set SIGVARA_RPC_URL,
SIGVARA_CHAIN_ID and the three registries (SIGVARA_IDENTITY, SIGVARA_REPUTATION, SIGVARA_STAKING);
there are no defaults off Arc testnet. Before its first read it asks the RPC which chain it serves, and
refuses every tool if that is not the configured chain. A failed read reaches the model as ethers' short
message with any URL removed, since an RPC URL often carries a provider key; the details go to stderr,
redacted the same way.
| Tool | What it answers |
|---|---|
sigvara_check_agent |
Registered, Active, holding the minimum stake now; the agent's and operator's addresses on chain; matured score, the band it is in (the bands the status page counts every agent in), and when it was written; the stake a slash could take; and what is pending: a slash, a queued withdrawal, a new score. With threshold (and optionally maxScoreAgeSeconds), a yes or no. |
sigvara_score |
The six factors, the earned total, the matured total a threshold is checked against, and a proposal waiting out its challenge window. |
sigvara_stake |
Stake held, queued for withdrawal and when it can leave, the minimum, and the most recent slash proposal. |
sigvara_identity |
Operator, status, registration time, the Ed25519 key and the DID document. |
sigvara_verify_evidence |
Whether the payments the oracle lists are the ones its score committed to: the finalized root on chain rebuilt from them, each confirmed by the contract's verifyEvidence, and a pending proposal's root checked too. Only with an evidence source (SIGVARA_EVIDENCE_URL, the primary operator by default on Arc testnet). |
sigvara_challenge |
A single-use challenge, naming you, to send to the party claiming to be the agent. Only with SIGVARA_AUDIENCE. |
sigvara_verify_proof |
Checks its signature against the key on chain, spends the challenge, and reports standing as sigvara_check_agent does. Only with SIGVARA_AUDIENCE. |
The yes or no is SigvaraGate's rule without the proof: Active with the minimum stake now, then a score
written recently enough if you set a limit, then a matured score at or above the threshold, refused in that
order with the gate's reasons (not_active, stale_score, below_threshold). test/mcp.test.ts runs both
over 96 combinations of chain state and requires the same answer from each.
A lookup says what an agent's record is, not that whoever you are talking to is that agent. Pay only the
onChain addresses a check reports, never one the counterparty supplies. The proof tools go further, within
a limit. sigvara_verify_proof returning proved: true means the agent's key signed this server's challenge,
naming you, within its lifetime. It shows you are dealing with the agent only if the agent checked that
name before signing, which SigvaraAgent.signChallengeFor does: an agent that signs whatever audience it is
told can be relayed, by a party that passes your challenge on and its answer back. So the audience has to be
something the agent can check about you: your own did:sigvara DID, or the origin it reaches you at. Set it
with SIGVARA_AUDIENCE; without it the proof tools are not offered. Use a value none of your SigvaraGates
also uses, or a proof given here would pass that gate within its lifetime. A challenge is spent by its first
valid proof, and a bad signature does not spend it. The server keeps up to 1,000 unexpired challenges; a host
that shares one server among several users should give each its own, so one cannot crowd out another's.
"Slashable" is the stake held plus what is queued for withdrawal, because a slash takes both, and the
share for the victim is a quarter of that (SigvaraStaking.executeSlash). It is what a slash could take, not a
promise that one will be filed: the slashing committee files slashes and names the victim. Amounts are in the
staking token's own decimals, read from the chain. The tools read the current state only.
sigvara_verify_evidence makes a score checkable without trusting the oracle. It fetches the payments the
oracle's /evidence lists and rebuilds every leaf from its fields, never from the leaf the oracle serves. It
then finds which of them the finalized root on chain covers: all of them, those counted by a cut-off when more
came later, or with an outcome the payer signed afterwards read as not yet reported. The same readings are
tried by sigvara.xyz/agents. A payment that settled on a payment chain has a leaf with its chain first and enters
a root its delay after settling, and its row names the chainId. Up to the last 100 covered payments listed are confirmed with the contract's
verifyEvidence, in one read through Multicall3, and the root match covers the rest. The contract's answer is a consistency check: the proofs
come from a tree whose root was just read from it, so a refusal means the root changed in between.
A reproduced root shows the oracle scored on exactly the payments it lists, with the outcome each row gives as
committedOutcome. An outcome that differs from it is one the payer signed after the root was made, and is the
oracle's word until its signature is checked. Neither shows that a transaction happened as listed; read a
payment's txHash on chain for that. A payment committed twice is flagged as duplicatedPayments.
The leaf and tree rules are in evidenceLeaf, evidenceRoot and matchEvidenceRoot, exported from the main
entry, and test/evidence.test.ts holds them to the fixture that CI holds to both oracle/merkle.js and the
contract. The oracle's answer is untrusted:
- It is read to at most 4 MB, with no redirects followed.
- It is refused unless it names the agent asked about, or if it lists more than 2,000 payments.
- Only the fields a leaf commits to, and the oracle's
outcomeSourcelabel from two fixed values, are returned. - Matching a root hashes each pair of nodes once across all the settlement cut-offs it tries, and tries no more once it has hashed 20,000, so a hostile list costs about a second, not a minute.
The server is also a module, for a host that runs its own transport:
import { createTrustServer, ARC_TESTNET } from '@sigvara/protocol-sdk/dist/mcp';
const server = createTrustServer({ ...ARC_TESTNET, audience: 'did:sigvara:5042002:0x…' /* you */ });
const reply = await server.handle({ jsonrpc: '2.0', id: 1, method: 'tools/list' });
Built from rpcUrl like this, it checks the chain as the command does. Given a verifier of your own, it
checks the chain itself only if you also pass readChainId, though a SigvaraVerifier built with a chainId
refuses to read from another chain in any case.
Links
- Repository: https://github.com/RunTimeAdmin/sigvara (this package is
packages/sdk) - Site and docs: https://sigvara.xyz
- License: MIT