verifyByHash
Signature
Section titled “Signature”const matches = await fidemark.verifyByHash(contentHash, options);matches = fidemark.verify_by_hash(content_hash, options)matches, err := client.VerifyByHash(ctx, contentHash, opts)Returns an array of attestations, sorted newest-first.
Why this exists
Section titled “Why this exists”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.
Implementation
Section titled “Implementation”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.
Indexer modes
Section titled “Indexer modes”All three SDKs accept the same trio of modes:
| Mode | Behaviour |
|---|---|
events | Default. Scan the resolver logs via the configured RPC. |
graphql | Query an EAS GraphQL endpoint and surface errors directly. Requires a URL or client. |
auto | Query 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",});fidemark = Fidemark( network=get_network("base"), private_key=os.environ["PRIVATE_KEY"], indexer="auto", indexer_url="https://base.easscan.org/graphql",)client, err := fidemark.New(fidemark.Config{ Network: network, PrivateKey: os.Getenv("PRIVATE_KEY"), Indexer: fidemark.IndexerAuto, 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.
Options
Section titled “Options”{ type?: "human" | "ai", // restrict to one schema; default: both fromBlock?: number, // start of scan; defaults to network.deployBlock toBlock?: number | "latest",}VerifyByHashOptions( type="human" | "ai" | None, from_block=None, to_block=None, # int or "latest")fidemark.VerifyByHashOptions{ Type: fidemark.SchemaHuman, // or SchemaAI, or "" for both FromBlock: 0, // 0 -> network.DeployBlock ToBlock: 0, // 0 -> latest}Example
Section titled “Example”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.`);from fidemark import Fidemark, VerifyByHashOptions, get_network, hash_content
fidemark = Fidemark(network=get_network("base-sepolia"))
hash_ = hash_content(my_article)matches = fidemark.verify_by_hash(hash_, VerifyByHashOptions(type="human"))print(f"{len(matches)} human attestations on this article.")import ( "context" "log"
"github.com/fidemark/sdk-go/fidemark")
network, _ := fidemark.GetNetwork("base-sepolia")client, err := fidemark.New(fidemark.Config{Network: network})if err != nil { log.Fatal(err) }
hash := fidemark.HashContent([]byte(myArticle))matches, err := client.VerifyByHash(context.Background(), hash, fidemark.VerifyByHashOptions{ Type: fidemark.SchemaHuman,})log.Printf("%d human attestations on this article.", len(matches))