ERC-6538 · Final · ERC · 2023-01-24
ERC-6538: Stealth Meta-Address Registry
A singleton registry contract where anyone can publish their stealth meta-address, so senders can look it up and pay them privately using ERC-5564 stealth addresses.
What problem does it solve?
ERC-5564 stealth addresses let a sender derive a fresh, one-time address for a recipient so observers cannot link payments to the recipient's public identity. To do that, the sender first needs the recipient's stealth meta-address (a spending public key plus a viewing public key).
Without a standard place to publish it, meta-addresses would be scattered across websites, ENS text records and off-chain services, and contracts could not look them up at all. ERC-6538 defines one canonical on-chain registry for them.
How it works
ERC6538Registry is a singleton: one instance per chain. It stores:
stealthMetaAddressOf[registrant][schemeId] -> bytes
schemeIdselects the stealth address scheme.1is secp256k1 with view tags, as defined in ERC-5564.- The stored bytes are the spending and viewing public keys concatenated. The chain prefix used in the text form
st:<shortName>:0x...is implied by which chain the registry is on.
Ways to register:
registerKeys(schemeId, stealthMetaAddress): register for yourself (msg.sender).registerKeysOnBehalf(registrant, schemeId, signature, stealthMetaAddress): a third party (for example a relayer paying gas) submits it with the registrant's EIP-712 signature overErc6538RegistryEntry(uint256 schemeId,bytes stealthMetaAddress,uint256 nonce). Smart accounts are supported through ERC-1271 signature checks.incrementNonce(): invalidate any signatures you handed out but that have not been used yet.
Every change emits StealthMetaAddressSet(registrant, schemeId, stealthMetaAddress).
The spec specifies a deterministic deployment through the standard CREATE2 deployer so the registry has the same address on every chain; that address is given in the ERC.
Sample code
Looking up a recipient and registering your own meta-address (ethers v6):
import { Contract } from "ethers";
const abi = [
"function stealthMetaAddressOf(address registrant, uint256 schemeId) view returns (bytes)",
"function registerKeys(uint256 schemeId, bytes stealthMetaAddress)",
"event StealthMetaAddressSet(address indexed registrant, uint256 indexed schemeId, bytes stealthMetaAddress)",
];
const registry = new Contract(REGISTRY_ADDRESS /* from the ERC */, abi, signer);
// Sender: fetch recipient's meta-address for scheme 1 (secp256k1)
const meta: string = await registry.stealthMetaAddressOf(recipient, 1n);
if (meta === "0x") throw new Error("recipient has not registered");
// ...then derive a one-time stealth address with ERC-5564 `generateStealthAddress`
// Recipient: publish your own spending+viewing public keys
await registry.registerKeys(1n, spendingPubKey + viewingPubKey.slice(2));
Things to know
- Status: Final.
- The registry only publishes public keys. Funds are received at addresses derived from them, and the recipient scans ERC-5564 announcements with their viewing key to find payments.
- Registration itself is public: it reveals that an address uses stealth payments, though not which payments it receives.
- If your spending or viewing key is compromised, update or clear your registration immediately so new senders stop deriving addresses from it.
- Signed registrations include a per-registrant nonce, so a signature can be used only once; use
incrementNonceto cancel outstanding ones.