adapterscan/docs

Counterfactual registration

An identity that exists in the event log, keyed by its UBID, that can settle on-chain later - or never.

What it is

The counterfactual functions mirror the on-chain registration and setters but mint nothing and store nothing. Each one checks the caller's authority, computes the UBID, emits one event, and returns. The emitted events are the record; an indexer keys them by UBID and reconstructs the current identity from the latest ones.

counterfactualRegister(standard, boundAddress, tokenId, agentURI)      // the claim; restates the whole record
counterfactualSetAgentURI(standard, boundAddress, tokenId, newURI)
counterfactualSetMetadata(standard, boundAddress, tokenId, key, value)
counterfactualSetMetadataBatch(standard, boundAddress, tokenId, entries)
counterfactualSetAgentWallet(standard, boundAddress, tokenId, wallet)   // the profile's half of the wallet link
counterfactualUnsetAgentWallet(standard, boundAddress, tokenId)
counterfactualSetAgentWalletAndUBID(standard, boundAddress, tokenId)    // both halves, when caller is both

Why

  • Cost. The caller pays event-log gas for a claim and defers the mint until the identity needs registry state - if it ever does.
  • Scale. A collection can give every token an identity at mint for one event each.
  • Continuity. Reputation earned as a claim carries over to a full registration, because the UBID is the same.

Self-verifying events

Every counterfactual event carries both the UBID and the coordinates it was derived from. An indexer recomputes the hash from the coordinates and drops any event whose topic doesn't match. The contract emits nothing that fails this, but an indexer that checks is an indexer that can't be fooled by a look-alike contract's logs.

Indexing rules

  • Apply events in (blockNumber, logIndex) order. State is a pure replay; a reorg means replay from scratch.
  • Latest event per UBID wins. A new claim resets the URI and replaces the metadata map with exactly what it carries; field setters change one field.
  • An ERC-8004 registration for the same coordinates derives the same UBID, so its history joins with no link assertion needed.
  • Wallet designations and attestations resolve against the UBID, whether or not a claim has arrived yet.
Adapterscan's indexer is the reference implementation of these rules: indexer/SPEC.md documents the projection, and the trail every profile shows on its History tab is exactly the events it replayed.