The factory pattern and content-derived identity
Suggest an editWhen one part of a system creates many instances of the same kind of thing, other parts have to find a specific instance and trust that they have the right one. The usual answer is a registry, a lookup table someone keeps. A stronger answer is to derive each instance's identifier from its own content, so anyone can recompute the identifier and check it, with no registry to query and no keeper to trust.
Finding and trusting one instance among many
A system creates many instances of the same kind of object. The component that creates them is a factory: a single place that produces every instance of a kind, so they are all built the same way instead of being assembled by hand wherever one happens to be needed. Some other component now has to find a specific instance and be sure it has the right one and not a substitute.
The obvious approach is a registry, a central lookup table that maps a name to the instance, kept current by someone. It works, and it carries three standing costs. It must be queried, so every consumer has to reach it. It must be kept current, so someone owns the job of updating it. And it must be trusted, because if the registry is wrong, or out of date, or tampered with, every consumer that believed it is deceived at once. The registry becomes a thing everyone has to trust, and a thing an attacker would like to control.
Because the factory is the one place each instance comes from, it is also the natural place to decide how an instance is named. It can hand every instance a name from a central registry, or it can derive each instance's identifier from the instance's own content. The second choice is a content-derived identifier, and it needs no registry.
Let the content name itself
Git names every commit this way. A commit's identifier is a hash of the commit's content and its history: the files, the message, the author, and the identifier of the commit before it. No server assigns the identifier and no table stores it. Anyone holding the commit can run the same computation and get the same identifier, and if the two match, the commit is genuine.
Two independent parties always derive the same identifier for the same content, because the identifier is a function of the content and nothing else. And no party can substitute different content under the same identifier, because changing any part of the content changes the identifier it produces. The check is something each party does for itself, from material it already holds.
The same idea runs a deduplicating backup system. Every file is stored under a name computed from its contents, so two identical files anywhere on the system produce the same name and are kept only once. No index records which files happen to match. The shared name falls out of the shared content, as it does for a commit.
The identifier cannot outlive its content
If the content changes, the identifier changes. That is a feature, because it means substitution is always detectable. Change one byte of the commit and its identifier no longer matches, so a tampered commit announces itself. It is also a constraint, because you cannot keep an identifier while changing what it points to. An identifier derived from content cannot outlive that exact content. If you need a stable name for a thing whose content will change, a content-derived identifier is the wrong tool.
A stable name for content that changes still needs a table that maps the name to the current identifier, and that table is a registry with the same three costs. So content-derived identifiers remove the registry only where a name never has to point at new content.
Recompute before you trust
If a design calls for a registry so one component can find and trust another, ask whether the identifier could instead be computed from content both sides already have. If it can, the registry disappears, and with it the job of keeping it current and the risk of it lying. That is a stronger guarantee than any table an authority maintains, because it replaces trust in a keeper with a computation anyone can repeat. It is also a constraint bypass, because the table that someone keeps and everyone trusts was a property of one method, looking an instance up by name, and the goal of finding the right instance never required it.
Blockchain application
Ethereum's CREATE2 applies content-derived identity to deploying contracts. A contract's address is derived from the address of the deployer, a chosen value called a salt, and the hash of the contract's bytecode. Because the address is a function of those inputs, it can be computed before the contract exists and verified afterward without consulting any registry. In Uniswap v2 a separate Factory contract deploys every pair this way, and anyone can compute the address of the pair contract for two tokens directly from the two token addresses, then check that the contract at that address is the real one. The ERC-8009 design, described in The core and its routers, gives its single shared contract one canonical address on each chain. That fixed address is what lets hardware wallet firmware hardcode it and trust it.