{"eip":7969,"title":"DomainKeys Identified Mail (DKIM) Registry","description":"A registry for DKIM public key hashes, enabling on-chain verification.","authors":["Mike Fu (@fumeng00mike)","Matthew Yu (@0xknon)","Ernesto García (@ernestognw)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2025-06-11","discussionsTo":"https://ethereum-magicians.org/t/new-erc-dkim-registry-interface/24530","repo":"ERCs","label":"ERC-7969","officialUrl":"https://eips.ethereum.org/EIPS/eip-7969","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7969.md","url":"https://eips.huatuo.xyz/eip-7969/","tldr":{"en":"A standard on-chain registry of DKIM public-key hashes per email domain, so contracts can check that a signed email really came from that domain, enabling email-based wallets and recovery.","ja":"メールドメインごとの DKIM 公開鍵ハッシュを記録する標準的なオンチェーンレジストリ。署名付きメールが本当にそのドメインから届いたことをコントラクトが確認でき、メールベースのウォレットやリカバリーを可能にする。","ko":"이메일 도메인별 DKIM 공개 키 해시를 기록하는 표준 온체인 레지스트리. 서명된 이메일이 실제로 해당 도메인에서 왔는지 컨트랙트가 확인할 수 있게 하여 이메일 기반 지갑과 복구를 가능하게 한다.","zh":"按邮件域名记录 DKIM 公钥哈希的标准链上注册表，让合约能够验证已签名的邮件确实来自该域名，从而支持基于邮件的钱包和恢复。"},"tags":["dkim","email","zk-email","registry","account-abstraction"],"explainers":{"en":{"lang":"en","tldr":"A standard on-chain registry of DKIM public-key hashes per email domain, so contracts can check that a signed email really came from that domain, enabling email-based wallets and recovery.","tags":["dkim","email","zk-email","registry","account-abstraction"],"related":[4337,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7969/","markdown":"## What problem does it solve?\n\nEvery major email provider signs outgoing mail with DKIM: a signature over the message made with a key whose public half is published in the domain's DNS. If a smart contract (or a zero-knowledge proof of an email, the \"ZK Email\" approach) can verify that signature, the user can prove \"I control alice@example.com\" on-chain, for example to approve a transaction or recover a lost wallet ([ERC-4337](/eip-4337/) accounts).\n\nContracts cannot query DNS, though. They need a trusted on-chain record of which DKIM keys belong to which domain. ERC-7969 standardises the interface of such a registry so wallets and verifiers can share one.\n\n## How it works\n\nThe registry stores pairs of hashes:\n\n- **`domainHash`**: hash of the lowercase domain, e.g. `keccak256(\"example.com\")`. Each subdomain is a separate entry; `mail.example.com` does not inherit from `example.com`.\n- **`keyHash`**: hash of the DKIM public key exactly as it appears in the DNS TXT record's `p=` value (base64, no PEM headers, no whitespace). Implementations may use keccak256 or a ZK-friendly hash such as Poseidon.\n\nThe required interface is tiny:\n\n```solidity\ninterface IDKIMRegistry {\n    event KeyHashRegistered(bytes32 domainHash, bytes32 keyHash);\n    event KeyHashRevoked(bytes32 domainHash);\n    function isKeyHashValid(bytes32 domainHash, bytes32 keyHash) external view returns (bool);\n}\n```\n\nIts ERC-165 interface ID is given as `0xdee3d600`. How keys get registered (owner, oracle, DAO) is up to the implementation; the reference uses an `Ownable` contract with `setKeyHash`, `setKeyHashes` and `revokeKeyHash`.\n\n## Sample code\n\nComputing the hashes off-chain and checking them against a registry (ethers v6):\n\n```ts\nimport { Contract, keccak256, toUtf8Bytes } from \"ethers\";\n\n// value of p= from the DNS TXT record, whitespace removed\nconst dkimPubKey = \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQ...IDAQAB\";\n\nconst domainHash = keccak256(toUtf8Bytes(\"example.org\"));\nconst keyHash = keccak256(toUtf8Bytes(dkimPubKey));\n\nconst registry = new Contract(\n  registryAddress,\n  [\"function isKeyHashValid(bytes32,bytes32) view returns (bool)\"],\n  provider,\n);\nconsole.log(await registry.isKeyHashValid(domainHash, keyHash));\n```\n\nA verifier contract would call `isKeyHashValid` with the key hash proven inside its ZK circuit before accepting the email proof.\n\n## Things to know\n\n- **Status: Draft.** The interface may still change.\n- The registry is only as trustworthy as whoever writes to it. Access control, key rotation and revocation are left to implementations, and the security section flags all three.\n- The hash function is not fixed by the standard, so a verifier must know which hash a given registry uses. Changing it later is disruptive.\n- Domains rotate DKIM keys. Old keys must be revoked, and proofs over old emails may need the historical key to still be valid.\n- The spec text says the key must be an RSA key in RFC 6376 format. Domains using other DKIM key types are not covered.\n"},"ja":{"lang":"ja","tldr":"メールドメインごとの DKIM 公開鍵ハッシュを記録する標準的なオンチェーンレジストリ。署名付きメールが本当にそのドメインから届いたことをコントラクトが確認でき、メールベースのウォレットやリカバリーを可能にする。","tags":["dkim","email","zk-email","registry","account-abstraction"],"related":[4337,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7969/","markdown":"## 何を解決するのか\n\n主要なメールプロバイダーはすべて、送信メールに DKIM で署名しています。DKIM は、公開鍵がドメインの DNS に公開されている鍵でメッセージに署名する仕組みです。スマートコントラクト（またはメールのゼロ知識証明、いわゆる「ZK Email」方式）がこの署名を検証できれば、ユーザーはオンチェーンで「alice@example.com を管理している」ことを証明できます。たとえばトランザクションの承認や、紛失したウォレット（[ERC-4337](/eip-4337/) アカウント）のリカバリーに使えます。\n\nただし、コントラクトは DNS を照会できません。どの DKIM 鍵がどのドメインに属するかを示す、信頼できるオンチェーンの記録が必要です。ERC-7969 は、そのようなレジストリのインターフェースを標準化し、ウォレットや検証者が 1 つのレジストリを共有できるようにします。\n\n## 仕組み\n\nレジストリはハッシュのペアを保存します。\n\n- **`domainHash`**: 小文字のドメインのハッシュ。例: `keccak256(\"example.com\")`。サブドメインはそれぞれ別のエントリで、`mail.example.com` は `example.com` を継承しません。\n- **`keyHash`**: DNS TXT レコードの `p=` の値にあるとおりの DKIM 公開鍵（base64、PEM ヘッダーなし、空白なし）のハッシュ。実装は keccak256 でも、Poseidon のような ZK に適したハッシュでも構いません。\n\n必須のインターフェースはごく小さなものです。\n\n```solidity\ninterface IDKIMRegistry {\n    event KeyHashRegistered(bytes32 domainHash, bytes32 keyHash);\n    event KeyHashRevoked(bytes32 domainHash);\n    function isKeyHashValid(bytes32 domainHash, bytes32 keyHash) external view returns (bool);\n}\n```\n\nその ERC-165 インターフェース ID は `0xdee3d600` と示されています。鍵をどのように登録するか（オーナー、オラクル、DAO）は実装次第です。リファレンス実装は、`setKeyHash`、`setKeyHashes`、`revokeKeyHash` を持つ `Ownable` コントラクトを使っています。\n\n## サンプルコード\n\nハッシュをオフチェーンで計算し、レジストリと照合する（ethers v6）:\n\n```ts\nimport { Contract, keccak256, toUtf8Bytes } from \"ethers\";\n\n// value of p= from the DNS TXT record, whitespace removed\nconst dkimPubKey = \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQ...IDAQAB\";\n\nconst domainHash = keccak256(toUtf8Bytes(\"example.org\"));\nconst keyHash = keccak256(toUtf8Bytes(dkimPubKey));\n\nconst registry = new Contract(\n  registryAddress,\n  [\"function isKeyHashValid(bytes32,bytes32) view returns (bool)\"],\n  provider,\n);\nconsole.log(await registry.isKeyHashValid(domainHash, keyHash));\n```\n\n検証者コントラクトは、メールの証明を受け入れる前に、ZK 回路内で証明された鍵ハッシュを使って `isKeyHashValid` を呼び出します。\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** インターフェースはまだ変更される可能性があります。\n- レジストリの信頼性は、書き込み権限を持つ主体の信頼性と同じです。アクセス制御、鍵のローテーション、失効は実装に委ねられており、セキュリティの節でもこの 3 点が指摘されています。\n- ハッシュ関数は標準では固定されていないため、検証者はそのレジストリがどのハッシュを使っているかを把握している必要があります。後から変更すると混乱が生じます。\n- ドメインは DKIM 鍵をローテーションします。古い鍵は失効させる必要があり、古いメールに対する証明には、過去の鍵が引き続き有効であることが必要な場合があります。\n- 仕様の文面では、鍵は RFC 6376 形式の RSA 鍵でなければならないとされています。他の種類の DKIM 鍵を使うドメインは対象外です。\n"},"ko":{"lang":"ko","tldr":"이메일 도메인별 DKIM 공개 키 해시를 기록하는 표준 온체인 레지스트리. 서명된 이메일이 실제로 해당 도메인에서 왔는지 컨트랙트가 확인할 수 있게 하여 이메일 기반 지갑과 복구를 가능하게 한다.","tags":["dkim","email","zk-email","registry","account-abstraction"],"related":[4337,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7969/","markdown":"## 어떤 문제를 해결하나요?\n\n주요 이메일 제공업체는 모두 발신 메일에 DKIM으로 서명합니다. DKIM은 공개 키가 도메인의 DNS에 게시된 키로 메시지에 서명하는 방식입니다. 스마트 컨트랙트(또는 이메일의 영지식 증명, 이른바 \"ZK Email\" 방식)가 이 서명을 검증할 수 있다면, 사용자는 온체인에서 \"나는 alice@example.com을 관리한다\"는 것을 증명할 수 있습니다. 예를 들어 트랜잭션을 승인하거나 분실한 지갑([ERC-4337](/eip-4337/) 계정)을 복구할 때 쓸 수 있습니다.\n\n하지만 컨트랙트는 DNS를 조회할 수 없습니다. 어떤 DKIM 키가 어떤 도메인에 속하는지에 대한 신뢰할 수 있는 온체인 기록이 필요합니다. ERC-7969는 이런 레지스트리의 인터페이스를 표준화하여 지갑과 검증자가 하나의 레지스트리를 공유할 수 있게 합니다.\n\n## 어떻게 동작하나요?\n\n레지스트리는 해시 쌍을 저장합니다.\n\n- **`domainHash`**: 소문자 도메인의 해시. 예: `keccak256(\"example.com\")`. 서브도메인은 각각 별도 항목이며, `mail.example.com`은 `example.com`을 상속하지 않습니다.\n- **`keyHash`**: DNS TXT 레코드의 `p=` 값에 나타난 그대로의 DKIM 공개 키(base64, PEM 헤더 없음, 공백 없음)의 해시. 구현은 keccak256 또는 Poseidon 같은 ZK 친화적 해시를 사용할 수 있습니다.\n\n필수 인터페이스는 아주 작습니다.\n\n```solidity\ninterface IDKIMRegistry {\n    event KeyHashRegistered(bytes32 domainHash, bytes32 keyHash);\n    event KeyHashRevoked(bytes32 domainHash);\n    function isKeyHashValid(bytes32 domainHash, bytes32 keyHash) external view returns (bool);\n}\n```\n\nERC-165 인터페이스 ID는 `0xdee3d600`으로 명시되어 있습니다. 키를 어떻게 등록할지(소유자, 오라클, DAO)는 구현에 달려 있으며, 레퍼런스 구현은 `setKeyHash`, `setKeyHashes`, `revokeKeyHash`를 가진 `Ownable` 컨트랙트를 사용합니다.\n\n## 샘플 코드\n\n해시를 오프체인에서 계산하고 레지스트리와 대조하기(ethers v6):\n\n```ts\nimport { Contract, keccak256, toUtf8Bytes } from \"ethers\";\n\n// value of p= from the DNS TXT record, whitespace removed\nconst dkimPubKey = \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQ...IDAQAB\";\n\nconst domainHash = keccak256(toUtf8Bytes(\"example.org\"));\nconst keyHash = keccak256(toUtf8Bytes(dkimPubKey));\n\nconst registry = new Contract(\n  registryAddress,\n  [\"function isKeyHashValid(bytes32,bytes32) view returns (bool)\"],\n  provider,\n);\nconsole.log(await registry.isKeyHashValid(domainHash, keyHash));\n```\n\n검증자 컨트랙트는 이메일 증명을 받아들이기 전에, 자신의 ZK 회로 안에서 증명된 키 해시로 `isKeyHashValid`를 호출합니다.\n\n## 알아둘 점\n\n- **상태: Draft.** 인터페이스는 아직 바뀔 수 있습니다.\n- 레지스트리는 쓰기 권한을 가진 주체만큼만 신뢰할 수 있습니다. 접근 제어, 키 교체, 폐기는 구현에 맡겨져 있으며, 보안 섹션에서도 이 세 가지를 짚고 있습니다.\n- 해시 함수는 표준에서 고정되어 있지 않으므로, 검증자는 해당 레지스트리가 어떤 해시를 쓰는지 알아야 합니다. 나중에 바꾸면 혼란이 생깁니다.\n- 도메인은 DKIM 키를 교체합니다. 이전 키는 폐기해야 하며, 오래된 이메일에 대한 증명에는 과거 키가 여전히 유효해야 할 수 있습니다.\n- 명세 본문은 키가 RFC 6376 형식의 RSA 키여야 한다고 말합니다. 다른 DKIM 키 유형을 사용하는 도메인은 다루지 않습니다.\n"},"zh":{"lang":"zh","tldr":"按邮件域名记录 DKIM 公钥哈希的标准链上注册表，让合约能够验证已签名的邮件确实来自该域名，从而支持基于邮件的钱包和恢复。","tags":["dkim","email","zk-email","registry","account-abstraction"],"related":[4337,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7969/","markdown":"## 它解决什么问题？\n\n所有主流邮件服务商都会用 DKIM 对外发邮件签名：用一把密钥对邮件内容签名，其公钥发布在域名的 DNS 中。如果智能合约（或邮件的零知识证明，即\"ZK Email\"方式）能够验证这个签名，用户就可以在链上证明\"我控制 alice@example.com\"，例如用来批准交易或恢复丢失的钱包（[ERC-4337](/eip-4337/) 账户）。\n\n但合约无法查询 DNS。它们需要一份可信的链上记录，说明哪些 DKIM 密钥属于哪个域名。ERC-7969 将这类注册表的接口标准化，使钱包和验证者可以共用同一个注册表。\n\n## 它如何运作\n\n注册表存储成对的哈希：\n\n- **`domainHash`**：小写域名的哈希，例如 `keccak256(\"example.com\")`。每个子域名都是单独的条目，`mail.example.com` 不会继承 `example.com`。\n- **`keyHash`**：DKIM 公钥的哈希，公钥与 DNS TXT 记录中 `p=` 的值完全一致（base64，无 PEM 头，无空白）。实现可以使用 keccak256，也可以使用 Poseidon 这类对 ZK 友好的哈希。\n\n所需的接口非常小：\n\n```solidity\ninterface IDKIMRegistry {\n    event KeyHashRegistered(bytes32 domainHash, bytes32 keyHash);\n    event KeyHashRevoked(bytes32 domainHash);\n    function isKeyHashValid(bytes32 domainHash, bytes32 keyHash) external view returns (bool);\n}\n```\n\n其 ERC-165 接口 ID 给定为 `0xdee3d600`。密钥如何注册（所有者、预言机、DAO）由实现决定；参考实现使用一个带有 `setKeyHash`、`setKeyHashes` 和 `revokeKeyHash` 的 `Ownable` 合约。\n\n## 示例代码\n\n在链下计算哈希，并与注册表核对（ethers v6）：\n\n```ts\nimport { Contract, keccak256, toUtf8Bytes } from \"ethers\";\n\n// value of p= from the DNS TXT record, whitespace removed\nconst dkimPubKey = \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQ...IDAQAB\";\n\nconst domainHash = keccak256(toUtf8Bytes(\"example.org\"));\nconst keyHash = keccak256(toUtf8Bytes(dkimPubKey));\n\nconst registry = new Contract(\n  registryAddress,\n  [\"function isKeyHashValid(bytes32,bytes32) view returns (bool)\"],\n  provider,\n);\nconsole.log(await registry.isKeyHashValid(domainHash, keyHash));\n```\n\n验证者合约在接受邮件证明之前，会用其 ZK 电路内证明过的密钥哈希调用 `isKeyHashValid`。\n\n## 需要注意\n\n- **状态：Draft。** 接口仍可能变化。\n- 注册表的可信度取决于谁能向其写入。访问控制、密钥轮换和撤销都留给各实现处理，安全性部分也指出了这三点。\n- 标准没有固定哈希函数，因此验证者必须知道某个注册表使用的是哪种哈希。之后再更换会造成混乱。\n- 域名会轮换 DKIM 密钥。旧密钥必须被撤销，而针对旧邮件的证明可能要求历史密钥仍然有效。\n- 规范文本称密钥必须是 RFC 6376 格式的 RSA 密钥。使用其他 DKIM 密钥类型的域名不在涵盖范围内。\n"}}}
