Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
ERC-7969 proposes a common registry interface for registering and validating the public-key hashes used by DKIM, an email authentication mechanism.
This article explains the following proposal.
My other articles cover EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.
Overview
ERC-7969 defines a standard interface for registering and validating DomainKeys Identified Mail (DKIM) public-key hashes on Ethereum.
DKIM allows a receiving system to verify that an email was signed by a key associated with a signing domain. A mail server signs selected headers and the message body using its private key. A verifier retrieves the corresponding public key from DNS and checks the signature.
A valid DKIM signature establishes that the signed material is consistent with a key authorized by the signing domain. It does not, by itself, prove the identity of the individual who sent the message or guarantee that the visible From address belongs to the signing domain.
ERC-7969 stores hashes of these public keys in a smart contract registry. An authorized registration process can obtain a public key from a DNS TXT record and register its hash. Applications can subsequently check that the key used in an email proof is recognized by the registry.
Combined with zkEmail, which uses zero-knowledge proofs to verify email-related claims, and account abstraction, this can support email-based wallet authorization and recovery.
The following diagram illustrates the flow from email delivery to on-chain verification.

The sending server signs the message with its private key and publishes the corresponding public key through DNS. The ERC-7969 registry records a hash of that public key. zkEmail applications and smart contract wallets can consult the registry when validating an email proof.
For background on ERC-4337, see:
ERC-4337: Account abstraction without protocol changes
Motivation
On-chain email-based authentication
The development of account abstraction (ERC-4337) and zkEmail has created demand for common interfaces that support on-chain verification of email-related claims.
Traditional blockchain accounts rely on private keys. Many users find it difficult to manage keys and recovery phrases, and losing them can result in losing access to assets.
Email is a familiar authentication channel. DKIM supplies cryptographic evidence that an email was signed by a recognized domain key. A verification system that also checks the relevant signed email fields and application-specific conditions can use this evidence to support email-based wallet operations.
Integration with account abstraction
Combining a DKIM registry with zkEmail can support email-based account abstraction.
A wallet can accept appropriately constructed and verified email proofs as part of an authorization policy, enabling use cases such as:
- Creating and managing smart contract wallets.
- Authorizing transactions using authenticated email instructions.
- Implementing social recovery mechanisms.
The wallet must bind the email proof to the intended account and action and enforce replay protection.
Account recovery
A recovery policy can allow a user who has lost a wallet key to regain access by presenting an email proof satisfying the wallet's recovery conditions.
DKIM provides cryptographic signature verification, but the recovery mechanism still depends on the security of the mail provider, the registry's key-management policy, and the proof and wallet implementations.
Specification
Interface definition
ERC-7969 defines a minimal interface for checking the relationship between domain hashes and DKIM public-key hashes.
pragma solidity ^0.8.25;
/// @title ERC-XXX DKIM Registry Interface
/// @dev ERC-165 identifier: 0xdee3d600
interface IDKIMRegistry {
event KeyHashRegistered(bytes32 domainHash, bytes32 keyHash);
event KeyHashRevoked(bytes32 domainHash);
function isKeyHashValid(
bytes32 domainHash,
bytes32 keyHash
) external view returns (bool);
}The interface contains two events, KeyHashRegistered and KeyHashRevoked, and a read-only function, isKeyHashValid. The events record changes to key registration, while the function reports whether a particular key hash is valid for a domain.
The following sections explain the two hash parameters.
Domain hash
The domainHash parameter is obtained by converting the domain name to lowercase and hashing the resulting string.
For example, the domain example.com is hashed using keccak256.
domainHash = keccak256(bytes("example.com"))For a subdomain, the complete domain name is hashed as a single string.
domainHash = keccak256(bytes("mail.example.com"))The registry treats domains and subdomains as independent entities. A key registered for example.com does not automatically apply to mail.example.com. Each subdomain may have its own registered DKIM public keys.
The following diagram illustrates the registry's data structure.

Multiple public-key hashes can be associated with one domain hash, with validity managed individually.
Independence of domains and subdomains
This is consistent with DKIM's operational model. DNS records such as selector._domainkey.example.com identify keys through a selector and signing domain. Different subdomains may use different keys.
Key hash
The keyHash parameter is a cryptographic hash of a DKIM public key in the format described by the proposal and RFC 6376.
The choice of key hash function is left to the implementation. Keccak256 is one option, while cryptographically secure alternatives such as Poseidon may be better suited to zero-knowledge proof systems.
Poseidon hash
Poseidon is designed to be efficient in arithmetic circuits used by zero-knowledge proof systems. Applications such as zkEmail may select it to reduce the cost of proving hash computations.
DKIM public-key format
The proposal describes the public key using the DKIM format specified in RFC 6376.
| Requirement | Description |
|---|---|
| Format | Value of the p= parameter in the DNS record |
| Encoding | Base64 |
| Key type | Valid RSA public key in the format described by the proposal |
| Headers | No PEM headers or additional formatting |
| Whitespace | No whitespace or line breaks |
The key representation is the value of the p= parameter published in the DNS TXT record. The registry and proof implementation must agree on the exact representation that is hashed.
Registration flow
The original diagram shows how a domain owner obtains a key from DNS, computes its hash and the domain hash, submits them to a registry, and allows a verification client to check the resulting registration.
sequenceDiagram
participant Owner as ドメイン所有者
participant DNS as DNSサーバー
participant Registry as DKIMレジストリ
participant Client as 検証クライアント
Owner->>DNS: DKIM TXTレコードを設定
Note over DNS: v=DKIM1, p=MIGfMA0G...
Owner->>DNS: 公開鍵(pパラメータ)を取得
DNS-->>Owner: Base64エンコードされた公開鍵
Owner->>Owner: keyHash = keccak256(公開鍵)
Owner->>Owner: domainHash = keccak256(ドメイン名)
Owner->>Registry: setKeyHash(domainHash, keyHash)
Registry-->>Registry: KeyHashRegistered発行
Client->>Registry: isKeyHashValid(domainHash, keyHash)
Registry-->>Client: true / false
Consider the following DKIM record from RFC 6376.
$ORIGIN _domainkey.example.org.
brisbane IN TXT ("v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQ"
"KBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkMoGeLnQg1fWn7/zYt"
"IxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v"
"/RtdC2UzJ1lWT947qR+Rcac2gbto/NMqJ0fzfVjH4OuKhi"
"tdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB")The Base64 string following the p= parameter represents the public key.
-
The domain owner retrieves the DNS TXT record and extracts the p= value.
-
Compute the keccak256 hash of the public key.
javascriptbytes32 keyHash = keccak256(bytes("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQ...")); -
Compute the keccak256 hash of the domain name.
javascriptbytes32 domainHash = keccak256(bytes("example.org")); -
Register the hashes.
javascriptregistry.setKeyHash(domainHash, keyHash);
The sample key string in the code is abbreviated for illustration; an actual registration must hash the complete key representation.
The contract stores hashes instead of variable-length domain and key strings. This reduces storage overhead. Hashing public DNS values does not provide strong confidentiality because observers can compute the same hashes from known domains and public keys.
Events
KeyHashRegistered
event KeyHashRegistered(bytes32 domainHash, bytes32 keyHash);Emitted when a new DKIM public-key hash is registered for a domain.
Off-chain indexers and monitoring services can follow this event to track registry changes.
| Parameter | Type | Indexed | Description |
|---|---|---|---|
| domainHash | bytes32 | No | Hash of the registered domain |
| keyHash | bytes32 | No | Hash of the registered DKIM public key |
KeyHashRevoked
event KeyHashRevoked(bytes32 domainHash);Emitted when a key hash is revoked for a domain. Revocation can be used during key rotation or in response to a compromised key.
| Parameter | Type | Indexed | Description |
|---|---|---|---|
| domainHash | bytes32 | No | Hash of the affected domain |
The event does not identify the individual revoked key. Indexers may need to examine transaction inputs or query registry state to determine which key changed.
Functions
isKeyHashValid
function isKeyHashValid(
bytes32 domainHash,
bytes32 keyHash
) external view returns (bool);A read-only function returning whether a specified public-key hash is valid for a specified domain hash.
A smart contract wallet or a verifier using zkEmail can consult this function to determine whether the key referenced in an email proof is recognized by the registry. The application must separately verify the DKIM signature or the corresponding zero-knowledge proof and the relevant signed email claims.
For example, an application verifying a claim associated with an example.com email address needs both a valid recognized key and evidence binding the authenticated message to the relevant address and action.
Parameters
| Parameter | Type | Description |
|---|---|---|
| domainHash | bytes32 | Hash of the domain being checked |
| keyHash | bytes32 | Hash of the DKIM public key being checked |
Return value
Returns true if the key hash is valid, and false otherwise.
Rationale
Why the interface is minimal
The interface focuses on key registration and revocation events and the validity query. The actual registration functions, authorization policies, and registration workflows are left to implementers.
This allows:
- Different registry governance models, including administrators, DAOs, and oracle-based approaches.
- A common validation interface for applications beyond zkEmail.
- A relatively small contract surface that may reduce execution and auditing costs.
KeyHashRegistered and KeyHashRevoked also allow off-chain systems to monitor changes, providing a record of the registry's operation.
Flexibility in hash functions
The proposal's rationale discusses keccak256 as a consistent and secure choice for hashing domains and keys, while allowing implementers to select another cryptographically secure function for public-key hashing.
This flexibility is important for zero-knowledge proof systems. Keccak256 can be expensive in arithmetic circuits; Poseidon or other appropriate hash functions may offer better efficiency, depending on the circuit and proof system.
The interface uses bytes32 values. A common type allows applications to call the same function, but does not make different hash algorithms interchangeable. The registry, proof circuit, and verifier must agree on the algorithm and data encoding.
Relationship to existing standards
ERC-7969 introduces an interface without requiring modifications to existing contracts.
It can be used alongside ERC-4337 account abstraction to support email-based account operations. The proposal also specifies ERC-165 interface detection, using interface identifier 0xdee3d600. A conforming implementation can advertise support through supportsInterface.
For background on ERC-165, see:
ERC-165: Detecting whether a contract implements an interface
Security considerations
Private-key and domain management
Domain operators must protect their DKIM private keys and DNS administration. A compromised DKIM private key can allow an attacker to create apparently valid signatures for the signing domain. Applications relying on that key for email-based authorization may consequently accept fraudulent claims.
Access control
The registry needs an authorization mechanism preventing unauthorized key registrations and revocations. The example uses OpenZeppelin's Ownable, which restricts updates to the contract owner.
Production implementations may use multisignature administration or DAO-based governance, according to their trust model. The registration authority must verify the relationship between the signing domain and its public key.
Key rotation
DKIM keys may be rotated periodically or following compromise. A registry should support coordinated registration of replacement keys and revocation of old ones.
Delayed updates may cause legitimate proofs to fail or allow authentication using keys that should no longer be trusted. Applications should define how historical signatures are treated.
Rate limiting
Implementers may consider rate limits and registration controls to prevent abusive mass registrations and unnecessary growth in storage and event logs. The appropriate mitigation depends on who can submit updates and who pays their gas costs.
Choosing hash functions
The algorithms and encodings for domainHash and keyHash must be selected carefully. Upgrading a hash function requires a migration plan, because different algorithms produce different identifiers for the same underlying values.
Reference implementation
The following example implements a DKIM registry using OpenZeppelin's Ownable.
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IDKIMRegistry.sol";
contract DKIMRegistry is IDKIMRegistry, Ownable {
constructor(address _owner) Ownable(_owner) { }
// ドメイン名ハッシュ => 公開鍵ハッシュ => 有効フラグ
mapping(bytes32 => mapping(bytes32 => bool)) private _keyHashes;
function isKeyHashValid(
bytes32 domainHash,
bytes32 keyHash
) public view returns (bool) {
return _keyHashes[domainHash][keyHash];
}
function setKeyHash(
bytes32 domainHash,
bytes32 keyHash
) public onlyOwner {
require(keyHash != bytes32(0), "cannot set zero hash");
_keyHashes[domainHash][keyHash] = true;
emit KeyHashRegistered(domainHash, keyHash);
}
function setKeyHashes(
bytes32 domainHash,
bytes32[] memory keyHashes
) public onlyOwner {
require(keyHashes.length > 0, "empty array");
for (uint256 i = 0; i < keyHashes.length; i++) {
setKeyHash(domainHash, keyHashes[i]);
}
}
function revokeKeyHash(
bytes32 domainHash,
bytes32 keyHash
) public onlyOwner {
delete _keyHashes[domainHash][keyHash];
emit KeyHashRevoked(domainHash);
}
}Storage structure
_keyHashes is a nested mapping. The first key is the domain hash, the second key is the public-key hash, and the stored Boolean indicates validity.
This supports multiple registered keys for a single domain, as may be needed when several mail servers or DKIM selectors use different keys.
setKeyHash
Registers a single public-key hash. The onlyOwner modifier restricts the operation to the contract owner. The zero hash is rejected, and a successful registration emits KeyHashRegistered.
Rejecting the zero hash alone does not establish that a submitted nonzero hash corresponds to a valid DKIM key. The owner must perform appropriate checks before registration.
setKeyHashes
Registers multiple public-key hashes in one operation by repeatedly calling setKeyHash. The example rejects an empty array.
revokeKeyHash
Revokes a particular public-key hash associated with a domain. The function clears the mapping entry, returning it to false, and emits KeyHashRevoked.
This operation supports key rotation and invalidation of compromised keys.
The KeyHashRevoked event records only domainHash, but the function accepts both domainHash and keyHash and revokes the specified key.
Parameters
| Parameter | Type | Description |
|---|---|---|
| domainHash | bytes32 | Hash of the affected domain |
| keyHash | bytes32 | Hash of the DKIM public key being revoked |
The reference code is reproduced as originally published. Its interface-detection support, dependency versions, and actual registration policy should be checked before production use.
References
https://ethereum-magicians.org/t/new-erc-dkim-registry-interface/24530
Conclusion
ERC-7969 provides a minimal interface for checking DKIM public-key registrations on Ethereum. Applications can combine the registry with email verification proofs and programmable wallets to build email-based authorization and recovery mechanisms.
If you have questions, feel free to contact me on Twitter.
You can also find my work on the following sites.



