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.

This article examines ERC-6944, which adds an ERC-4804 resolution mode for resolving resource requests using ERC-5219 contracts.

This article translates, summarizes, and supplements the material linked below.

I have also covered other EIPs.

Overview

Ethereum Improvement Proposals (EIPs) describe proposed Ethereum standards and extensions. This proposal adds a resolveMode to ERC-4804 for handling resource requests through ERC-5219 contracts.

See the following article for ERC-5219.

[ERC5219] Understanding efficient DApp communication using GET-style requests

See the following article for ERC-4804.

[ERC4804] Understanding contract calls through HTTP-like Web3 URLs

ERC5219

ERC-5219 standardizes an interface for requesting resources from smart contracts and receiving HTTP-like responses. This allows decentralized applications (DApps) on Ethereum to operate in a more decentralized manner.

Its motivation is that users often must visit a centralized website containing frontend code before accessing a supposedly decentralized application. This introduces risks involving trust minimization, censorship, permanence, and interoperability between DApp interfaces and smart contracts.

The standard separates application logic from frontend logic and requires DApp contracts to implement a particular interface. To reduce gas costs, it recommends using the message/external-body MIME type to reference data that a smart contract cannot access directly. For example, a response can instruct the client to retrieve data from IPFS.

Resource requests are read-only. This avoids transaction submission costs, degraded user experience, and the expense and complexity of storing frontend interaction logic in contracts. The mechanism can be combined with other EIPs to request state-changing operations.

Rather than reproducing the full HTTP request model, it adopts a simplified approach centered on GET-style resource requests and query parameters.

ERC4804

ERC-4804 defines a standard that enables users to access Web3 blockchain content, particularly on-chain web content such as SVG and HTML, more directly.

This reduces dependence on Web2 proxies for reading blockchain data and increases user control. It primarily defines read-only semantics, such as Solidity view calls. State-changing operations may be addressed by future extensions.

The standard uses Web3 URLs with the following components.

  • web3Schema specifies the URL scheme, such as web3:// or w3://.
  • userinfo corresponds to the EVM call message's From field. The default is 0x0 if omitted.
  • contractName identifies the contract and corresponds to the EVM call message's To field. It can be an address or a name provided by a naming service, in which case a suffix such as eth identifies the naming service.
  • chainid identifies the chain used for resolving the contract name and making the call. If omitted, the applicable naming-service chain is used under the standard's resolution rules.
  • query is an optional sequence of attribute-value pairs.

The goal is to improve interoperability between Web2 and Web3 and enable more direct access to Web3 content.

Specification

ts
/// @dev IDecentralizedApp is the ERC-5219 interface
interface IERC5219Resolver is IDecentralizedApp {
    // @notice The ERC-4804 resolve mode
    // @dev    This MUST return "5219" (0x3532313900000000000000000000000000000000000000000000000000000000) for ERC-5219 resolution (case-insensitive). The other options, as of writing this, are "auto" for automatic resolution, or "manual" for manual resolution.
    function resolveMode() external pure returns (bytes32 mode);
}

A contract that wishes to use ERC-5219 as an ERC-4804 resolution mode implements the interface described below.

The IERC5219Resolver interface defines the requirements for applying ERC-5219 within the ERC-4804 resolution mechanism.

IERC5219Resolver Interface

This interface inherits IDecentralizedApp and is intended for DApps conforming to ERC-5219. Inheritance includes the common functions and definitions of the decentralized application interface.

resolveMode() Function

Specifies the resolution mode used by ERC-4804.

  • Return value
    • Returns mode as a bytes32 value.
    • The mode determines how resource requests are resolved.
  • Defined modes
    • "5219"
      • Explicitly selects the ERC-5219 resolution mechanism.
      • The returned value is 0x3532313900000000000000000000000000000000000000000000000000000000, representing the zero-padded hexadecimal encoding of "5219".
      • A contract selecting this mode uses the ERC-5219 resource request mechanism.
    • "auto"
      • Selects the automatic resolution mode defined by ERC-4804.
    • "manual"
      • Selects the manual resolution mode defined by ERC-4804.

The latter two modes are existing ERC-4804 modes; their concrete semantics are specified by ERC-4804 rather than by ERC-6944.

Implementation

A smart contract selecting ERC-5219 as its ERC-4804 resolution mode implements IERC5219Resolver and returns "5219" from resolveMode().

This identifies ERC-5219 as the resource resolution mechanism.

The design allows developers to explicitly specify how resources are resolved, promotes ERC-5219 adoption, and improves standardization and interoperability among Ethereum DApps.

Additional Notes

ERC-165 defines a way to detect whether a smart contract supports a particular interface.

When a contract implements ERC-165, other contracts can call supportsInterface to query support for a specific interface identifier. This helps establish interoperability between smart contracts.

In this proposal, ERC-4804's resolveMode function makes it possible to discover the resolution mode without relying on ERC-165.

Calling resolveMode in the ERC-4804 context identifies whether the contract selects ERC-5219 resolution. The returned value, such as "5219", "auto", or "manual", explicitly indicates the selected mode.

Rather than calling ERC-165's supportsInterface to discover the applicable resolution mechanism, a client can call resolveMode directly. This provides a more direct way to establish interoperability for ERC-4804 and ERC-5219 resource resolution, without removing the broader usefulness of ERC-165.

See the following article for ERC-165.

[ERC165] Understanding how to check whether a contract supports an interface

Implementation

ts
abstract contract ERC5219Resolver is IDecentralizedApp {
    function resolveMode() public pure returns (bytes32 mode) {
      return "5219";
    }
}

Security

The security considerations of ERC-4804 and ERC-5219 apply.

Citation

Gavin John (@Pandapip1), Qi Zhou (@qizhou), "ERC-6944: ERC-5219 Resolve Mode [DRAFT]," Ethereum Improvement Proposals, no. 6944, April 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-6944.

Conclusion

ERC-6944 adds an ERC-4804 resolution mode for resource requests handled by ERC-5219 contracts.

If you have questions, feel free to contact me on Twitter.

Twitter @cardene777

I also publish articles on the following platforms.

https://chaldene.net/