Skip to content

verifyByHash

const matches = await fidemark.verifyByHash(contentHash, options);

Returns an array of attestations, sorted newest-first.

verify(uid) answers “what does this attestation say?”. verifyByHash(hash) answers “who has attested this content?”, useful when:

  • A platform wants to surface every signature on a piece of media.
  • A creator wants to find duplicate or competing claims on their work.
  • An indexer needs to enumerate attestations for batch processing.

By default the SDK queries the resolver’s HumanAttestation and AIAttestation events filtered by the indexed contentHash topic. Both events index the hash, so the lookup is cheap on local + Sepolia. On busy mainnet RPCs the full-deployment-range eth_getLogs can be slow or rate-limited; in that case configure an EAS GraphQL indexer instead.

All three SDKs accept the same trio of modes:

ModeBehaviour
eventsDefault. Scan the resolver logs via the configured RPC.
graphqlQuery an EAS GraphQL endpoint and surface errors directly. Requires a URL or client.
autoQuery the indexer first; fall through to the event scan on any error. Picked automatically when you pass a URL or client.
const fidemark = new Fidemark({
network: "base",
privateKey: process.env.PRIVATE_KEY,
indexer: "auto",
indexerUrl: "https://base.easscan.org/graphql",
});

You can also inject a custom client (e.g. with auth headers, custom timeouts, or to mock GraphQL in tests) via indexerClient / indexer_client / IndexerClient.

{
type?: "human" | "ai", // restrict to one schema; default: both
fromBlock?: number, // start of scan; defaults to network.deployBlock
toBlock?: number | "latest",
}

Complete, copy-pasteable runnable. Read-only call: no signer required. See Configuration for every constructor option.

import { Fidemark, getNetwork, hashContent } from "@fidemark/sdk";
const fidemark = new Fidemark({ network: getNetwork("base-sepolia") });
const hash = hashContent(myArticle);
const matches = await fidemark.verifyByHash(hash, { type: "human" });
console.log(`${matches.length} human attestations on this article.`);