naysayer
v0.1.0
Published
Ask NAYSAYER before your agent trades: a paid ($0.01 x402 on Hedera), HCS-anchored, signed pre-trade verdict.
Maintainers
Readme
naysayer
Ask before your agent trades. NAYSAYER is the agent that gets paid to say no: for $0.01 (testnet USDC over x402 on Hedera) it rules on a swap or transfer your agent wants to make, writes the ruling to Hedera Consensus Service before taking the payment, and returns it EIP-712 signed.
Live app and docket: https://naysayer.vercel.app · Source: https://github.com/duongnq2798/naysayer
Hedera testnet only. Nothing here has been audited.
You need
- A Hedera testnet account (ECDSA or ED25519) from portal.hedera.com
- That account associated with USDC
0.0.429274, with a little test USDC from faucet.circle.com (enter the0.0.xaccount ID)
Use
npm i naysayerimport { Naysayer } from "naysayer";
// Resolves naysayer.eth (ENSv2, Sepolia), then refuses to continue if the endpoint's
// verdict signer differs from the one published under the name.
const ns = await Naysayer.fromEns("naysayer.eth", {
payer: { accountId: "0.0.YOUR_ACCOUNT", privateKey: process.env.HEDERA_PRIVATE_KEY! },
});
const v = await ns.check({
kind: "SWAP_EXACT_IN",
tokenIn: "0x0000000000000000000000000000000000003ad2", // WHBAR 0.0.15058
tokenOut: "0x0000000000000000000000000000000000001549", // USDC 0.0.5449
amountIn: "100000000", // 1 WHBAR (8 decimals)
minAmountOut: "48000", // your floor in USDC (6 decimals)
target: "0x0000000000000000000000000000000000159398", // SaucerSwap V2 router
memo: "why the agent wants this (treated as untrusted text)",
});
if (!v.granted) {
console.log("NAY:", v.reasonName, v.explanation, v.hcs.url);
return;
}Naysayer.connect("https://naysayer-api.vercel.app", { payer }) skips ENS.
What comes back
| Field | Meaning |
|---|---|
| granted, reasonName, explanation | The ruling |
| checks[] | Each deterministic check with its numbers (oracle age, slippage floor, pool drift, allowlists) |
| critic | The Claude critic's vote; it can only turn a grant into a denial |
| hcs.url | The ruling on Hedera Consensus Service |
| verdict, sig, signatureValid | EIP-712 ruling and signature, already verified against the published signer |
| payment | The x402 settlement for your one cent |
Errors throw NaysayerError with status. You are not charged on 400 (bad input) or 503 (ledger unavailable).
CLI
HEDERA_ACCOUNT_ID=0.0.x HEDERA_PRIVATE_KEY=... npx naysayer check \
--ens naysayer.eth --in 0.0.15058 --out 0.0.5449 --amount 100000000 --min 48000Exit code 0 = granted, 2 = denied.
MIT
