01
Subject derivation
ZhenRegistry identifies circuits and processors by deterministic 32-byte subject hashes so badges never collide across contracts:
circuitSubject(processor, id) = keccak256(abi.encode(uint8(1), processor, uint256(id)))
processorSubject(processor) = bytes32(uint256(uint160(processor)))02
Holder-bound auto-lapse
- Mint-time check: For circuit badges, attest() executes a 50,000-gas staticcall to processor.ownerOf(id) and requires the caller (msg.sender) to be the current ERC-721 owner.
- Transfer auto-lapse: isVerified(subject) re-checks ownerOf(id) against the stored recorder address on every read. The moment a circuit is transferred or sold, isVerified returns false with zero extra transactions.
- ERC-8021 attribution: Web transactions append builder code kdh49g9t0gohczft to calldata for X Layer builder attribution.
03
Reading badges in viem
import { createPublicClient, http } from 'viem'
const client = createPublicClient({ transport: http('https://rpc.xlayer.tech') })
const registry = '0xba2B0feEce41f64cCbf2432c54C425eAdB2C9819'
const subject = await client.readContract({
address: registry,
abi: registryAbi,
functionName: 'circuitSubject',
args: [processor, BigInt(id)],
})
const active = await client.readContract({
address: registry,
abi: registryAbi,
functionName: 'isVerified',
args: [subject],
})For key isolation, admin controls and disclosure policy, see Security & contracts.
04
Marketplace & listing embeds
Marketplaces and sellers can embed a live ZhenRegistry SVG shield by TapeOut name or processor/id, or link directly to the verdict and standalone DeWEB reader:
<!-- Live SVG shield by TapeOut name -->
<img src="https://usezhen.xyz/api/v1/badge/svg?name=1961.2.323" alt="Zhen badge" />
<!-- Live SVG shield by processor + id -->
<img src="https://usezhen.xyz/api/v1/badge/svg?processor=0x87bfca3494aa228ff589ab9b642143a5e8c8f9a6&id=1961" alt="Zhen badge" />
<!-- Direct buyer check link -->
<a href="https://usezhen.xyz/check?q=1961.2.323">Check on Zhen</a>Browse recorded badges on /badges · Standalone DeWEB reader