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.

Background

ERC-6662 proposes extending the ERC-4337 account interface with IAccountMetadata. A user publishes authentication metadata onchain once so applications can discover how to request authentication.

This article explains and expands on the proposal below.

I also cover other Ethereum improvement proposals.

Overview

ERC-4337 brings account abstraction to Ethereum through smart contract accounts. Wallets can customize signing rules and key management to suit different security and usability needs.

IAccountMetadata extends this model with a way to publish authentication metadata onchain. Wallets can support authentication factors such as passwords, biometrics, and hardware tokens while publishing the information applications need to discover the authentication service.

Onchain metadata is public. ERC-6662 exposes relay URIs and request schemas, not raw passwords, biometric data, OTP secrets, or signing keys. Those secrets must remain offchain.

The proposed interface offers several benefits.

  • Integrity and transparency
    • Onchain metadata gives applications a common, auditable record and makes unauthorized changes easier to detect.
  • Convenience
    • Users can authenticate consistently across platforms and services. Wallets can support alternatives to traditional password-based login.
  • Customization
    • ERC-4337 smart accounts let developers design authentication flows for a particular application or group of users.

The design aims to make authentication easier to use while keeping security and the handling of authentication data in view.

For more on ERC-4337, see the following article.

[ERC-4337] How account abstraction works without protocol changes

https://mirror.xyz/0xcE77b9fCd390847627c84359fC1Bc02fC78f0e58/-qoixMc413uT4FFM61uhXYUiL05Hw-wahq9hV_JtjJs

Motivation

Once a user publishes authentication metadata through IAccountMetadata, dapps can read it from the chain. In the wallet-first model described by the proposal, users connect a wallet in advance and the wallet pushes account information to the dapp. Discoverable metadata gives dapps more flexibility in how they start authentication.

Background

ERC-4337 improves the account model, but dapps commonly still require users to connect a wallet before they can interact. That step can be a barrier, particularly for newcomers and nontechnical users.

The IAccountMetadata interface

A user publishes metadata that lets a dapp discover the appropriate authenticator and learn the format of its requests. The dapp can retrieve that metadata automatically when the user opens it. A wallet may use public-key credentials, biometrics, or one-time passwords internally. The interface does not require publishing the underlying credentials.

Benefits

Ease of use

Users can configure authentication once and then sign in to multiple dapps without repeating the initial setup.

Flexibility

Dapps can fetch metadata from the chain instead of asking users to supply it directly. This supports a wider range of authentication flows.

Security

Onchain metadata makes records transparent and auditable. A dapp can read only the fields it needs, but choosing which fields to read does not make published data private.

Implementation considerations

Privacy

Treat onchain metadata as public. Keep private authentication material offchain and protect sensitive requests with appropriate encryption and access controls.

Interface standardization

A shared interface lets dapps interpret and reuse the same metadata.

Updates and management

Wallets need a way for users to update or revoke authentication configuration and retain control over it.

These properties can improve usability and give developers more flexibility without requiring each dapp to invent its own discovery flow.

Specification

Authentication flow

Authentication flow through a relay Source: https://eips.ethereum.org/EIPS/eip-6662

The user's wallet address is an account-abstraction smart contract account. An authenticator holds the private key used to sign operations. It may be an offline mobile application or an online service. A relay forwards requests from dapps to the authenticator. An online authenticator can also act as the relay and accept requests directly.

Account-abstraction smart contract account

Account abstraction lets users act through programmable smart contract accounts. In contrast to an externally owned account (EOA), an account contract can implement its own logic and security controls.

Authenticator

The authenticator holds a private key and uses it to sign the user's operations. It might be a physical device such as a smartphone, an application, or a cloud service. An offline authenticator can keep the key in an isolated environment. An online service is easier to reach and needs appropriate security controls.

Relay

The relay forwards dapp requests to the authenticator so the user can authenticate and authorize operations. When the authenticator receives requests directly, no separate forwarding service is needed.

Benefits of the authentication flow

  • Security
    • The account can define additional controls for key management and authentication.
  • Flexibility
    • Users can select an authenticator that suits their security and convenience needs.
  • Usability
    • A relay coordinates requests between the dapp and the chosen authenticator.

Interface

ERC-6662 introduces IAccountMetadata as an extension to the ERC-4337 account model. It lets applications find the information they need to request authentication from a smart account's authenticator.

IAccountMetadata interface

ts
interface IAccountMetadata {
  struct AuthenticatorInfo {
    // a list of service URIs to relay message from dApps to authenticators
    string[] relayURI;
    // a JSON string or URI pointing to a JSON file describing the
    // schema of AuthenticationRequest. The URI should follow ERC-4804
    // if the schema file is stored on-chain
    string schema;
  }

  function getAuthenticationInfo() external view returns(AuthenticatorInfo[] memory);
}
AuthenticatorInfo struct

The struct exposes two fields.

  • relayURI
    • An array of service URIs for relaying messages from dapps to authenticators.
  • schema
    • A JSON string describing the request schema or a URI pointing to a JSON file. If the schema file is stored onchain, the URI should follow ERC-4804.

For more on ERC-4804, see the following article.

[ERC-4804] Calling contracts through Web3 URLs

getAuthenticationInfo function

This external view function returns an array of AuthenticatorInfo structs.

Authentication request schema

An authenticator's schema field defines the shape of the AuthenticationRequest object it consumes. The example supports end-to-end encryption by putting encrypted fields together in encryptedData. A schema may define fields beyond those shown here. A marker such as $e2ee can indicate that a field is encrypted.

Example schema

The illustrative snippet is reproduced as published and contains trailing commas that strict JSON parsers reject.

json
{
    "title": "AuthenticationRequest",
    "type": "object",
    "properties": {
        "entrypoint": {
            "type": "string",
            "description": "the entrypoint contract address",
        },
        "chainId": {
            "type": "string",
            "description": "the chain id represented as hex string, e.g. 0x5 for goerli testnet",
        },
        "userOp": {
            "type": "object",
            "description": "UserOp struct defined by ERC-4337 without signature",
        },
        "encryptedData": {
            "type": "string",
            "description": "contains all encrypted fields"
        },
    }
}
  • entrypoint
    • The EntryPoint contract address.
  • chainId
    • The chain ID encoded as hexadecimal. For example, the historical Goerli testnet uses 0x5.
  • userOp
    • The ERC-4337 UserOp without its signature.
  • encryptedData
    • A string containing all encrypted fields.

Why the schema matters

The dapp can use the published request format to communicate with the authenticator through a relay. Standard request shapes help implementations interoperate, while end-to-end encryption can protect sensitive fields from intermediaries.

Additional notes

The dapp needs two pieces of information to use this authentication flow.

Where is the authenticator?

The relayURI field in AuthenticatorInfo lists locations through which the dapp can reach it. The user exposes those locations as account metadata, making discovery possible without a separate exchange of wallet information.

What format does AuthenticationRequest use?

The schema field in AuthenticatorInfo describes the object the authenticator consumes. It can also describe additional relay-specific fields, for example to support access control.

Selecting a relay

Each authenticator can list several relay services. A dapp should try them until it finds one that works. All relays listed for a given authenticator must support the same schema.

Signature aggregation

An account can publish multiple AuthenticatorInfo entries for multisignature authorization. Authenticators can independently sign UserOperations and submit them to a bundler. The proposal describes aggregating these signatures with the ERC-4337 aggregator.

Future extensions

The interface could evolve to support other needs. For example, a future extension might add aliases or avatars for profile displays.

The relay URI tells a dapp where to send a request, and the schema tells it what to send. Multiple relays and signature aggregation allow more flexible setups. Future extensions could expose additional information while retaining the same discovery model.

Compatibility

The new interface is compatible with ERC-4337.

Security considerations

End-to-end encryption (E2EE) can protect privacy and reduce front-running risks caused by exposing authentication requests in transit. Encrypting sensitive fields between the dapp and the authenticator limits what intermediaries can read. Authenticated encryption also lets the recipient detect modifications to protected data.

One option is JSON Web Encryption (JWE), defined in RFC 7516.

Using JWE

  1. Generate a Content Encryption Key (CEK).
    • The dapp uses this symmetric key to encrypt the fields marked for end-to-end encryption.
  2. Encrypt the CEK with the recipient's public key.
    • In this example, only the authenticator that holds the corresponding private key can recover the CEK.
  3. Create the JWE object.
    • Package the encrypted fields of the AuthenticationRequest and the encrypted CEK in the JWE object.
  4. Transmit the object through the relay.
    • The relay can forward it, but cannot recover the CEK or read the protected fields.

Security and privacy

  • User privacy
    • E2EE keeps authentication information and other sensitive data confidential in transit.
  • Front-running exposure
    • Hiding protected request fields limits opportunities to act on them before the intended operation is submitted. This does not prevent front-running after an operation becomes public.
  • Integrity and sender authentication
    • JWE can protect the integrity of encrypted data. In the recipient-public-key example, JWE by itself does not authenticate the sender, since other parties can encrypt to the same public key. The application needs a separate sender authentication mechanism if it relies on that property.

JWE can therefore protect authentication request contents through a relay, with sender verification handled separately where needed.

CEK

A Content Encryption Key directly encrypts a message or file. In this flow, it protects the request fields marked for end-to-end encryption.

What a CEK does

  • Encrypts the payload.
    • The CEK protects data such as a message body or file contents.
  • Keeps bulk processing efficient.
    • Symmetric encryption supports fast encryption and decryption of the payload.

CEK in end-to-end encryption

  1. Generate the CEK.
    • The sender creates the key for the payload.
  2. Encrypt the data.
    • The sender uses the CEK to encrypt the plaintext.
  3. Protect the CEK.
    • In the public-key example, the sender encrypts the CEK to the recipient's public key, so only that recipient can recover it.
  4. Send both outputs.
    • The sender transmits the ciphertext and encrypted CEK.
  5. Decrypt at the destination.
    • The recipient recovers the CEK with their private key and uses it to decrypt the payload.

Benefits of a CEK

  • Security
    • A symmetric CEK can protect the payload while public-key encryption restricts who can recover the key.
  • Flexibility
    • The same approach can protect different kinds of data efficiently.

JWE

JSON Web Encryption is a standard for representing encrypted data in a JSON-compatible form. RFC 7516 defines the format for securely transporting encrypted data over the web.

JWE components

A typical JWE representation includes the following components.

  • Header
    • Specifies algorithms and other metadata. A protected header is Base64url-encoded.
  • Encrypted Key
    • Contains the protected CEK. In the example above, the CEK is encrypted using the recipient's public key. The resulting value is Base64url-encoded.
  • Initialization Vector (IV)
    • Supplies the per-encryption value required by the algorithm, so the same plaintext can produce different ciphertext. It is Base64url-encoded.
  • Ciphertext
    • Contains the encrypted content and is Base64url-encoded.
  • Authentication Tag
    • Lets the recipient verify the integrity of the encrypted content and is Base64url-encoded.

The JWE process

  1. Encrypt.
    • Generate a CEK and protect it for the recipient. Encrypt the data with the CEK and the initialization vector, and generate the authentication tag.
  2. Transmit.
    • Send the resulting JWE representation, including the protected key, IV, ciphertext, and tag.
  3. Decrypt.
    • Recover the CEK and use it to decrypt the ciphertext. Verify the authentication tag before accepting the plaintext.

Benefits of JWE

  • Confidentiality and integrity
    • JWE protects content from disclosure and lets the recipient detect unauthorized changes.
  • Flexibility
    • The standard supports multiple encryption algorithms and key-management modes.
  • Interoperability
    • Its JSON-compatible representations fit web applications and APIs.

These properties make JWE suitable for carrying sensitive request fields between web applications and authenticators.

Citation

Shu Dong (@dongshu2013), Zihao Chen (@zihaoccc), Peter Chen (@pette1999), "ERC-6662: AA Account Metadata For Authentication [DRAFT]," Ethereum Improvement Proposals, no. 6662, March 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-6662.

Conclusion

ERC-6662 extends the ERC-4337 account model with a way to discover authentication relays and request schemas from onchain account metadata. A user can publish the metadata once and let dapps discover how to reach the authenticator when needed.

Questions are welcome by direct message.

Twitter @cardene777

I also write at the following sites.

https://chaldene.net/