IERC6538Registry
Title: IERC6538Registry
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from ScopeLift (https://github.com/ScopeLift/stealth-address-erc-contracts), Conforms to ERC-6538 (https://eips.ethereum.org/EIPS/eip-6538)
External interface for the ERC-6538 stealth meta-address registry: an on-chain mapping from a registrant address to the stealth meta-address others use to pay them privately.
The function and event ABIs match the canonical ERC-6538 reference exactly (address-keyed
registrant, Erc6538RegistryEntry EIP-712 entry, ERC6538Registry__InvalidSignature error)
so ERC-6538 indexers and wallets interoperate. Registrants may set their own keys
(registerKeys) or authorize a relayer with an EIP-712 signature (registerKeysOnBehalf,
ERC-1271-aware, replay-protected by a per-registrant nonce).
CONFORMANCE CAVEAT: as a Diamond facet the EIP-712 domain's verifyingContract is the host
diamond (not a fixed singleton), so relayers/wallets MUST read the live domain via
DOMAIN_SEPARATOR / ERC-5267 eip712Domain() rather than assuming a canonical address. An
on-behalf signature does not expire; a signer cancels an outstanding one with incrementNonce.
Functions
registerKeys
Sets the caller's stealth meta-address for schemeId (last-write-wins).
function registerKeys(uint256 schemeId, bytes calldata stealthMetaAddress) external;Parameters
| Name | Type | Description |
|---|---|---|
| schemeId | uint256 | The stealth-address scheme id. |
| stealthMetaAddress | bytes | The caller's stealth meta-address bytes. |
registerKeysOnBehalf
Sets registrant's stealth meta-address using an EIP-712 signature from registrant.
Verifies via ECDSA or ERC-1271 over the Erc6538RegistryEntry typed data bound to the
registrant's current nonce; the nonce is consumed so the signature is single-use.
function registerKeysOnBehalf(
address registrant,
uint256 schemeId,
bytes calldata signature,
bytes calldata stealthMetaAddress
) external;Parameters
| Name | Type | Description |
|---|---|---|
| registrant | address | The account authorizing the registration. |
| schemeId | uint256 | The stealth-address scheme id. |
| signature | bytes | The registrant's EIP-712 signature (EOA or ERC-1271). |
| stealthMetaAddress | bytes | The stealth meta-address bytes to store. |
incrementNonce
Advances the caller's nonce by one, invalidating any outstanding on-behalf signatures.
function incrementNonce() external;DOMAIN_SEPARATOR
Returns the EIP-712 domain separator used for registerKeysOnBehalf signatures.
function DOMAIN_SEPARATOR() external view returns (bytes32);Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
stealthMetaAddressOf
Returns the stealth meta-address registered by registrant for schemeId.
function stealthMetaAddressOf(address registrant, uint256 schemeId) external view returns (bytes memory);Parameters
| Name | Type | Description |
|---|---|---|
| registrant | address | The account to query. |
| schemeId | uint256 | The stealth-address scheme id. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes | The registered stealth meta-address bytes (empty if never registered). |
ERC6538REGISTRY_ENTRY_TYPE_HASH
Returns the EIP-712 type hash used in registerKeysOnBehalf.
function ERC6538REGISTRY_ENTRY_TYPE_HASH() external view returns (bytes32);Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
nonceOf
Returns the current on-behalf-registration nonce for registrant.
function nonceOf(address registrant) external view returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| registrant | address | The account to query. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 | The current nonce. |
Events
StealthMetaAddressSet
Emitted when a registrant sets or overwrites their stealth meta-address for a scheme.
event StealthMetaAddressSet(address indexed registrant, uint256 indexed schemeId, bytes stealthMetaAddress);Parameters
| Name | Type | Description |
|---|---|---|
| registrant | address | The account whose stealth meta-address was set. |
| schemeId | uint256 | The stealth-address scheme id (1 == SECP256k1 with view tags). |
| stealthMetaAddress | bytes | The registered stealth meta-address bytes. |
NonceIncremented
Emitted when a registrant advances their nonce, invalidating outstanding signatures.
event NonceIncremented(address indexed registrant, uint256 newNonce);Parameters
| Name | Type | Description |
|---|---|---|
| registrant | address | The account whose nonce advanced. |
| newNonce | uint256 | The nonce value after incrementing. |
Errors
ERC6538Registry__InvalidSignature
Thrown when the signature passed to registerKeysOnBehalf is not valid for registrant.
error ERC6538Registry__InvalidSignature();